@@ -0,0 +1,1793 @@
+import iemdb%0Aimport math%0Aimport numpy%0Afrom pyIEM import mesonet%0AASOS = iemdb.connect('asos', bypass=True)%0Aacursor = ASOS.cursor()%0AMESOSITE = iemdb.connect('mesosite', bypass=True)%0Amcursor = MESOSITE.cursor()%0A%0Aclimate = numpy.zeros( (24,2012-1951), 'f')%0A%0A# Find list of stations%0Astations = %5B%5D%0Amcursor.execute(%22%22%22%0A    SELECT id from stations WHERE network in ('IA_ASOS', 'MO_ASOS','KS_ASOS','NE_ASOS','SD_ASOS','ND_ASOS',%0A    'MN_ASOS','WI_ASOS','IL_ASOS','IN_ASOS','MI_ASOS') and archive_begin %3C '1960-01-01'%0A    %22%22%22)%0Afor row in mcursor:%0A    stations.append( row%5B0%5D )%0A%0Afor yr in range(1951,2012):%0A    acursor.execute(%22%22%22%0A    SELECT valid + '10 minutes'::interval, tmpf, dwpf from t%25s WHERE station in %25s%0A    and extract(month from valid) = 7 and dwpf %3E -30 and tmpf %3E -30%0A    %22%22%22 %25 (yr, str(tuple(stations))))%0A    hourly = numpy.zeros( (24,), 'f')%0A    counts = numpy.zeros( (24,), 'f')%0A    for row in acursor:%0A        dwpc = mesonet.f2c( row%5B2%5D )%0A        e  = 6.112 * math.exp( (17.67 * dwpc) / (dwpc + 243.5))%0A        mixr =  0.62197 * e / (1000.0 - e)%0A        if mixr %3E 0:%0A            hourly%5B row%5B0%5D.hour - 1%5D += mixr%0A            counts%5B row%5B0%5D.hour - 1%5D += 1%0A        %0A    climate%5B:,yr-1951%5D = hourly / counts * 1000.%0A    print yr, numpy.sum(hourly) / numpy.sum(counts) * 1000.%0A    %0Aimport matplotlib.pyplot as plt%0A%0Afig = plt.figure()%0Aax = fig.add_subplot(111)%0A%0Ares = ax.imshow( climate, aspect='auto', interpolation='nearest' )%0Aclr = fig.colorbar(res)%0Aclr.ax.set_ylabel(%22g/kg%22)%0A%0Aax.set_ylim(-0.5,23.5)%0Aax.set_yticks( numpy.arange(0,24,4))%0Aax.set_yticklabels( ('Mid', '4 AM', '8 AM', 'Noon', '4 PM', '8 PM'))%0Aax.set_xticks( numpy.arange(0,61,10) )%0Aax.set_xticklabels( numpy.arange(1951,2012,10) )%0Aax.set_title(%22Mid-West July Average Hourly Mixing Ratio (1951-2011)%22)%0A%0Afig.savefig('test.png')%0A

add some dew point comparison work