Ejemplo n.º 1
0
def plotter(fdict):
    """ Go """
    ctx = get_autoplot_context(fdict, get_description())
    ctx['qc'] = loadqc(date=ctx['date'])
    ctx['pgconn'] = get_dbconn('isuag')
    ctx['nt'] = NetworkTable("ISUSM")
    # Adjust stations to make some room
    ctx['nt'].sts['BOOI4']['lon'] -= 0.15
    ctx['nt'].sts['BOOI4']['lat'] -= 0.15
    ctx['nt'].sts['AHTI4']['lon'] += 0.25
    ctx['nt'].sts['AHTI4']['lat'] += 0.25

    title = 'TBD'
    subtitle = 'TBD'
    if ctx['opt'] == '1':
        title = 'ISU Soil Moisture Max/Min 4 Inch Soil Temperature'
        subtitle = 'based on available hourly observations'
        data, df = plot1(ctx)
    elif ctx['opt'] == '2':
        title = 'ISU Soil Moisture Max/Min Air Temperature'
        subtitle = 'based on available daily summary data'
        data, df = plot2(ctx)
    elif ctx['opt'] == '3':
        title = 'ISU Soil Moisture Average 4 Inch Soil Temperature'
        subtitle = 'based on available daily summary data'
        data, df = plot3(ctx)
    elif ctx['opt'] == '4':
        title = 'ISU Soil Moisture Solar Radiation [MJ]'
        subtitle = 'based on available daily summary data'
        data, df = plot4(ctx)
    elif ctx['opt'] == '5':
        title = 'ISU Soil Moisture Potential Evapotranspiration [inch]'
        subtitle = 'based on available daily summary data'
        data, df = plot5(ctx, "dailyet")
    elif ctx['opt'] == '6':
        title = 'ISU Soil Moisture Precipitation [inch]'
        subtitle = (
            'based on available daily summary data, liquid equiv of snow '
            'estimated'
        )
        data, df = plot5(ctx, "rain_mm_tot")
    elif ctx['opt'] == '7':
        title = 'ISU Soil Moisture Peak Wind Gust [MPH]'
        subtitle = 'based on available daily summary data'
        data, df = plot7(ctx)
    elif ctx['opt'] == '8':
        title = 'ISU Soil Moisture Average Wind Speed [MPH]'
        subtitle = 'based on available daily summary data'
        data, df = plot8(ctx)

    tle = ctx['date'].strftime("%b %-d, %Y")
    mp = MapPlot(
        sector='iowa', continentalcolor='white', nocaption=True,
        title='%s %s' % (tle, title),
        subtitle=subtitle)
    mp.drawcounties('#EEEEEE')
    mp.plot_station(data, fontsize=12)

    return mp.fig, df
Ejemplo n.º 2
0
def plotter(fdict):
    """ Go """
    ctx = get_autoplot_context(fdict, get_description())
    ctx["qc"] = loadqc(date=ctx["date"])
    ctx["pgconn"] = get_dbconn("isuag")
    ctx["nt"] = NetworkTable("ISUSM")
    if not ctx["nt"].sts:
        raise NoDataFound("No station metadata found.")
    # Adjust stations to make some room
    ctx["nt"].sts["BOOI4"]["lon"] -= 0.15
    ctx["nt"].sts["BOOI4"]["lat"] -= 0.15
    ctx["nt"].sts["AHTI4"]["lon"] += 0.25
    ctx["nt"].sts["AHTI4"]["lat"] += 0.25

    title = "TBD"
    subtitle = "TBD"
    if ctx["opt"] == "1":
        title = "ISU Soil Moisture Max/Min 4 Inch Soil Temperature"
        subtitle = "based on available hourly observations"
        data, df = plot1(ctx)
    elif ctx["opt"] == "2":
        title = "ISU Soil Moisture Max/Min Air Temperature"
        subtitle = "based on available daily summary data"
        data, df = plot2(ctx)
    elif ctx["opt"] == "3":
        title = "ISU Soil Moisture Average 4 Inch Soil Temperature"
        subtitle = "based on available daily summary data"
        data, df = plot3(ctx)
    elif ctx["opt"] == "4":
        title = "ISU Soil Moisture Solar Radiation [MJ]"
        subtitle = "based on available daily summary data"
        data, df = plot4(ctx)
    elif ctx["opt"] == "5":
        title = "ISU Soil Moisture Potential Evapotranspiration [inch]"
        subtitle = "based on available daily summary data"
        data, df = plot5(ctx, "dailyet")
    elif ctx["opt"] == "6":
        title = "ISU Soil Moisture Precipitation [inch]"
        subtitle = (
            "based on available daily summary data, liquid equiv of snow "
            "estimated")
        data, df = plot5(ctx, "rain_mm_tot")
    elif ctx["opt"] == "7":
        title = "ISU Soil Moisture Peak Wind Gust [MPH]"
        subtitle = "based on available daily summary data"
        data, df = plot7(ctx)
    elif ctx["opt"] == "8":
        title = "ISU Soil Moisture Average Wind Speed [MPH]"
        subtitle = "based on available daily summary data"
        data, df = plot8(ctx)

    tle = ctx["date"].strftime("%b %-d, %Y")
    mp = MapPlot(
        sector="iowa",
        continentalcolor="white",
        nocaption=True,
        title="%s %s" % (tle, title),
        subtitle=subtitle,
    )
    mp.drawcounties("#EEEEEE")
    mp.plot_station(data, fontsize=12)

    return mp.fig, df