else: units = "mph" if "month1" in form and "monthlimit" in form: months = numpy.array((int(form["month1"].value), )) else: months = numpy.arange(1, 13) database = 'asos' if form["network"].value in ('KCCI', 'KELO', 'KIMT'): database = 'snet' elif form["network"].value in ('IA_RWIS'): database = 'rwis' elif form["network"].value in ('ISUSM'): database = 'isuag' try: nsector = int(form['nsector'].value) except: nsector = 36 windrose(form["station"].value, database=database, sts=sts, ets=ets, months=months, hours=hours, units=units, nsector=nsector, justdata=("justdata" in form))
hours = numpy.arange(sts.hour, ets.hour) else: hours = numpy.arange(0, 24) if "units" in form and form["units"].value in ['mph', 'kts', 'mps', 'kph']: units = form["units"].value else: units = "mph" if "month1" in form and "monthlimit" in form: months = numpy.array((int(form["month1"].value),)) else: months = numpy.arange(1, 13) database = 'asos' if form["network"].value in ('KCCI', 'KELO', 'KIMT'): database = 'snet' elif form["network"].value in ('IA_RWIS'): database = 'rwis' elif form["network"].value in ('ISUSM'): database = 'isuag' try: nsector = int(form['nsector'].value) except: nsector = 36 windrose(form["station"].value, database=database, sts=sts, ets=ets, months=months, hours=hours, units=units, nsector=nsector, justdata=("justdata" in form))
""" Drive a windrose for a given network and site """ from pyiem.network import Table as NetworkTable from pyiem.plot import windrose import datetime import sys net = sys.argv[1] nt = NetworkTable( net ) sid = sys.argv[2] database = 'asos' if net in ('KCCI','KELO','KIMT'): database = 'snet' elif net in ('IA_RWIS'): database = 'rwis' elif net in ('ISUSM'): database = 'isuag' fp = "/mesonet/share/windrose/climate/yearly/%s_yearly.png" % (sid,) print "%4s %-20.20s -- YR" % (sid, nt.sts[sid]['name']), windrose(sid, fp=fp, database=database) for m in range(1,13): fp = "/mesonet/share/windrose/climate/monthly/%02i/%s_%s.png" % ( m, sid, datetime.datetime(2000,m,1).strftime("%b").lower() ) print "%s" % (m,), windrose(sid, fp=fp, months=(m,), database=database) print