<commit_before>""" Dump out obs from the database for use by other apps """
import subprocess
import os
import datetime

import shapefile
import psycopg2.extras
from pyiem.util import get_dbconn


def main():
    """Go main!"""
    pgconn = get_dbconn('iem', user='nobody')
    icursor = pgconn.cursor(cursor_factory=psycopg2.extras.DictCursor)

    now = datetime.datetime.now()
    ts = now.strftime('%Y%m%d')
    yyyy = now.strftime('%Y')

    cob = {}

    icursor.execute("""SELECT s.id, coalesce(c.pday, 0) as pday,
        coalesce(c.snow,-99) as snow, coalesce(c.snowd,-99) as snowd,
        coalesce(c.max_tmpf, -99) as max_tmpf,
        case when c.min_tmpf < 99 THEN c.min_tmpf ELSE -99 END as min_tmpf,
        ST_x(s.geom) as lon, ST_y(s.geom) as lat, s.name,
        c2.valid at time zone 'UTC' as vvv, s.elevation
        from summary_%s c, current c2, stations s WHERE
        c.iemid = c2.iemid and s.iemid = c.iemid and
        s.network ~* 'COOP' and min_tmpf > -99 and c2.valid > 'TODAY'
        and day = 'TODAY'""" % (yyyy,))

    for row in icursor:
        thisStation = row["id"]
        cob[thisStation] = {}
        thisPrec = row["pday"]
        thisSnow = row["snow"]
        thisSnowD = row["snowd"]
        thisHigh = row["max_tmpf"]
        thisLow = row["min_tmpf"]

        # First we update our cobs dictionary
        cob[thisStation]["TMPX"] = int(thisHigh)
        cob[thisStation]["TMPN"] = int(thisLow)
        cob[thisStation]["P24I"] = round(float(thisPrec), 2)
        cob[thisStation]["SNOW"] = float(thisSnow)
        cob[thisStation]["SNOD"] = float(thisSnowD)
        cob[thisStation]["LAT"] = row['lat']
        cob[thisStation]["LON"] = row['lon']
        cob[thisStation]["NAME"] = row['name']
        cob[thisStation]['ELEV_M'] = row['elevation']<commit_msg>remove invalid min_tmpf check on coop dump<commit_after>""" Dump out obs from the database for use by other apps """
import subprocess
import os
import datetime

import shapefile
import psycopg2.extras
from pyiem.util import get_dbconn


def main():
    """Go main!"""
    pgconn = get_dbconn('iem', user='nobody')
    icursor = pgconn.cursor(cursor_factory=psycopg2.extras.DictCursor)

    now = datetime.datetime.now()
    ts = now.strftime('%Y%m%d')
    yyyy = now.strftime('%Y')

    cob = {}

    icursor.execute("""SELECT s.id, coalesce(c.pday, 0) as pday,
        coalesce(c.snow,-99) as snow, coalesce(c.snowd,-99) as snowd,
        coalesce(c.max_tmpf, -99) as max_tmpf,
        coalesce(c.min_tmpf, -99) as min_tmpf,
        ST_x(s.geom) as lon, ST_y(s.geom) as lat, s.name,
        c2.valid at time zone 'UTC' as vvv, s.elevation
        from summary_%s c, current c2, stations s WHERE
        c.iemid = c2.iemid and s.iemid = c.iemid and
        s.network ~* 'COOP' and min_tmpf > -99 and c2.valid > 'TODAY'
        and day = 'TODAY'""" % (yyyy,))

    for row in icursor:
        thisStation = row["id"]
        cob[thisStation] = {}
        thisPrec = row["pday"]
        thisSnow = row["snow"]
        thisSnowD = row["snowd"]
        thisHigh = row["max_tmpf"]
        thisLow = row["min_tmpf"]

        # First we update our cobs dictionary
        cob[thisStation]["TMPX"] = int(thisHigh)
        cob[thisStation]["TMPN"] = int(thisLow)
        cob[thisStation]["P24I"] = round(float(thisPrec), 2)
        cob[thisStation]["SNOW"] = float(thisSnow)
        cob[thisStation]["SNOD"] = float(thisSnowD)
        cob[thisStation]["LAT"] = row['lat']
        cob[thisStation]["LON"] = row['lon']
        cob[thisStation]["NAME"] = row['name']
        cob[thisStation]['ELEV_M'] = row['elevation']
{'fraction_non_alphanumeric': 0.15008291873963517, 'fraction_numerical': 0.011608623548922056, 'mean_word_length': 2.8582089552238807, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6624314', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1315, 'n_words': 302}