当前位置: 首页>>代码示例>>Python>>正文


Python MapPlot.close方法代码示例

本文整理汇总了Python中pyiem.plot.MapPlot.close方法的典型用法代码示例。如果您正苦于以下问题:Python MapPlot.close方法的具体用法?Python MapPlot.close怎么用?Python MapPlot.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyiem.plot.MapPlot的用法示例。


在下文中一共展示了MapPlot.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def main():
    """Go Main"""
    grbs = pygrib.open('ds.snow.bin')
    # skip 1-off first field
    total = None
    lats = lons = None
    for grb in grbs[1:]:
        if lats is None:
            lats, lons = grb.latlons()
            total = grb['values']
            continue
        total += grb['values']
    # TODO tz-hack here
    analtime = grb.analDate - datetime.timedelta(hours=5)

    mp = MapPlot(
        sector='custom', west=-100, east=-92, north=45, south=41,
        axisbg='tan',
        title=("NWS Forecasted Accumulated Snowfall "
               "thru 7 PM 12 April 2019"),
        subtitle='NDFD Forecast Issued %s' % (
            analtime.strftime("%-I %p %-d %B %Y"), )
    )
    cmap = nwssnow()
    cmap.set_bad('tan')
    mp.pcolormesh(
        lons, lats, total * 39.3701,
        [0.01, 1, 2, 3, 4, 6, 8, 12, 18, 24, 30, 36],
        cmap=cmap,
        units='inch')

    mp.drawcounties()
    mp.drawcities()
    mp.postprocess(filename='test.png')
    mp.close()
开发者ID:akrherz,项目名称:DEV,代码行数:37,代码来源:plot_ndfd.py

示例2: compute

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def compute(valid):
    ''' Get me files '''
    prob = None
    for hr in range(-15,0):
        ts = valid + datetime.timedelta(hours=hr)
        fn = ts.strftime("hrrr.ref.%Y%m%d%H00.grib2")
        if not os.path.isfile(fn):
            continue

        grbs = pygrib.open(fn)
        gs = grbs.select(level=1000,forecastTime=(-1 * hr * 60))
        ref = generic_filter(gs[0]['values'], np.max, size=10)
        if prob is None:
            lats, lons = gs[0].latlons()
            prob = np.zeros( np.shape(ref) )
        
        prob = np.where(ref > 29, prob+1, prob)

    prob = np.ma.array(prob / 15. * 100.)
    prob.mask = np.ma.where(prob < 1, True, False)    
    
    m = MapPlot(sector='iowa',
                title='HRRR Composite Forecast 4 PM 20 May 2014 30+ dbZ Reflectivity',
                subtitle='frequency of previous 15 model runs all valid at %s, ~15km smoothed' % (valid.astimezone(pytz.timezone("America/Chicago")).strftime("%-d %b %Y %I:%M %p %Z"),))

    m.pcolormesh(lons, lats, prob, np.arange(0,101,10), units='%',
                     clip_on=False)
    m.map.drawcounties()
    m.postprocess(filename='test.ps')
    m.close()
开发者ID:KayneWest,项目名称:iem,代码行数:32,代码来源:ref_probability.py

示例3: draw_map

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def draw_map():
    """make maps, not war."""
    m = MapPlot(sector='conus',
                title='4 March 2019 :: DEP Precip Points')
    update_grid(m.ax)
    m.postprocess(filename='/tmp/map_clipoints.png')
    m.close()
开发者ID:akrherz,项目名称:idep,代码行数:9,代码来源:map_clifile_points.py

示例4: make_plots

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def make_plots(nc):
    ''' Generate some plots '''
    sts = compute_sts(nc)
    lats = nc.variables['lat'][:]
    lons = nc.variables['lon'][:]
    rts = (sts.astimezone(pytz.timezone("America/Chicago"))).strftime(
                                                            "%d %b %Y %H %p")
    for i, tm in enumerate(nc.variables['time'][:]):
        dt = sts + datetime.timedelta(minutes=float(tm))
        if dt.minute != 0:
            continue
        fhour = int( tm / 60.0 )
        fts = (dt.astimezone(pytz.timezone("America/Chicago"))).strftime(
                                                            "%d %b %Y %H %p")
        for pvar in PVARS:
            m = MapPlot(title='ISUMM5/Bridget Modelled %s' % (
                                                    PVARS[pvar]['title'],),
                        subtitle='Model Run: %s Forecast Valid: %s' % (rts, fts))
            vals = nc.variables[pvar][i,:,:]
            if pvar == 'bdeckt':
                vals = temperature(vals, 'K').value('F')
            m.pcolormesh(lons, lats, vals, PVARS[pvar]['levels'], units='mm')
            pqstr = "plot c %s model/frost/bridget/%02i/%s_%02i_f%03i.png bogus png" % (
                                        sts.strftime("%Y%m%d%H%M"), sts.hour,
                                        pvar, sts.hour, fhour)
            m.postprocess(pqstr=pqstr)
            m.close()
开发者ID:akrherz,项目名称:bridget,代码行数:29,代码来源:make_plots.py

示例5: doday

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def doday(ts, realtime):
    """
    Create a plot of precipitation stage4 estimates for some day

    We should total files from 1 AM to midnight local time
    """
    sts = ts.replace(hour=1)
    ets = sts + datetime.timedelta(hours=24)
    interval = datetime.timedelta(hours=1)
    now = sts
    total = None
    lts = None
    while now < ets:
        gmt = now.astimezone(pytz.timezone("UTC"))
        fn = gmt.strftime(("/mesonet/ARCHIVE/data/%Y/%m/%d/"
                           +"stage4/ST4.%Y%m%d%H.01h.grib"))
        if os.path.isfile(fn):
            lts = now
            grbs = pygrib.open(fn)

            if total is None:
                g = grbs[1]
                total = g["values"]
                lats, lons = g.latlons()
            else:
                total += grbs[1]["values"]
            grbs.close()
        now += interval

    if lts is None and ts.hour > 1:
        print 'stage4_today_total.py found no data!'
    if lts is None:
        return
    lts = lts - datetime.timedelta(minutes=1)
    subtitle = "Total between 12:00 AM and %s" % (lts.strftime("%I:%M %p %Z"),)
    routes = 'ac'
    if not realtime:
        routes = 'a'
    for sector in ['iowa', 'midwest', 'conus']:
        pqstr = "plot %s %s00 %s_stage4_1d.png %s_stage4_1d.png png" % (routes,
                ts.strftime("%Y%m%d%H"), sector, sector )
        
        m = MapPlot(sector=sector,
                    title="%s NCEP Stage IV Today's Precipitation" % (
                                                    ts.strftime("%-d %b %Y"),),
                    subtitle=subtitle)
            
        clevs = np.arange(0, 0.25, 0.05)
        clevs = np.append(clevs, np.arange(0.25, 3., 0.25))
        clevs = np.append(clevs, np.arange(3., 10.0, 1))
        clevs[0] = 0.01
    
        m.pcolormesh(lons, lats, total / 24.5, clevs, units='inch')
    
        #map.drawstates(zorder=2)
        if sector == 'iowa':
            m.drawcounties()
        m.postprocess(pqstr=pqstr)
        m.close()
开发者ID:muthulatha,项目名称:iem,代码行数:61,代码来源:stage4_today_total.py

示例6: do

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def do(ts, hours):
    """
    Create a plot of precipitation stage4 estimates for some day
    """
    ts = ts.replace(minute=0)
    sts = ts - datetime.timedelta(hours=hours)
    ets = ts 
    interval = datetime.timedelta(hours=1)
    now = sts
    total = None
    lts = None
    while now < ets:
        fn = "/mesonet/ARCHIVE/data/%s/stage4/ST4.%s.01h.grib" % (
            now.strftime("%Y/%m/%d"), 
            now.strftime("%Y%m%d%H") )

        if os.path.isfile(fn):
            lts = now
            grbs = pygrib.open(fn)

            if total is None:
                g = grbs[1]
                total = g["values"]
                lats, lons = g.latlons()
            else:
                total += grbs[1]["values"]
            grbs.close()
        now += interval
    
    if lts is None and ts.hour > 1:
        print 'Missing StageIV data!'
    if lts is None:
        return
    
    cmap = cm.get_cmap("jet")
    cmap.set_under('white')
    cmap.set_over('black')
    clevs = [0.01,0.1,0.25,0.5,1,2,3,5,8,9.9]
    localtime = (ts - datetime.timedelta(minutes=1)).astimezone(
                                        pytz.timezone("America/Chicago"))

    for sector in ['iowa', 'midwest', 'conus']:
        m = MapPlot(sector=sector,
                    title='NCEP Stage IV %s Hour Precipitation' % (hours,),
                    subtitle='Total up to %s' % (
                                    localtime.strftime("%d %B %Y %I %p %Z"),))
        m.pcolormesh(lons, lats, total / 24.5, clevs, units='inch')
        pqstr = "plot %s %s00 %s_stage4_%sh.png %s_stage4_%sh_%s.png png" % (
                                'ac', ts.strftime("%Y%m%d%H"), sector, hours,
                                sector, hours, ts.strftime("%H"))
        if sector == 'iowa':
            m.drawcounties()
        m.postprocess(pqstr=pqstr)
        m.close()
开发者ID:pingyangtiaer,项目名称:iem,代码行数:56,代码来源:stage4_Xhour.py

示例7: doit

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def doit(now):
    """
      Generate some plots for the COOP data!
    """
    # We'll assume all COOP data is 12z, sigh for now
    sql = """SELECT id, pday, network
           from summary_%s s JOIN stations t ON (t.iemid = s.iemid) 
           WHERE day = '%s' and
           t.network ~* 'COOP' and pday >= 0""" % (now.year,
           now.strftime("%Y-%m-%d") )

    lats = []
    lons = []
    vals = []
    icursor.execute( sql )
    iamax = 0.
    for row in icursor:
        sid = row[0]
        if not st.sts.has_key(sid):
            continue
        #labels.append( id[2:] )
        lats.append( st.sts[sid]['lat'] )
        lons.append( st.sts[sid]['lon'] )
        vals.append( row[1] )
        if row[2] == 'IA_COOP' and row[1] > iamax:
            iamax = row[1]

#if iamax == 0:
# Dummy in some bad data to prevent the contouring from going mad
#      lats.append( 42. )
#      lons.append( -96.0 )
#      vals.append( 1. )
    
    # Plot Iowa
    m = MapPlot(sector='iowa',
                title='24 Hour NWS COOP Precipitation [inch]',
                subtitle='Ending %s at roughly 12Z' % (now.strftime("%d %B %Y"),))

    m.contourf(lons, lats, vals, clevs, units='inch')

    pqstr = "plot ac %s0000 iowa_coop_12z_precip.png iowa_coop_12z_precip.png png" % (now.strftime("%Y%m%d"),)
    m.postprocess(pqstr=pqstr)
    m.close()

    m = MapPlot(sector='midwest',
                title='24 Hour NWS COOP Precipitation [inch]',
                subtitle='Ending %s at roughly 12Z' % (now.strftime("%d %B %Y"),))

    m.contourf(lons, lats, vals, clevs, units='inch')

    pqstr = "plot ac %s0000 midwest_coop_12z_precip.png midwest_coop_12z_precip.png png" % (now.strftime("%Y%m%d"),)
    m.postprocess(pqstr=pqstr)
    m.close()
开发者ID:KayneWest,项目名称:iem,代码行数:55,代码来源:12z_precip.py

示例8: plot

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def plot():
    """Make a pretty plot"""
    df = pd.read_csv('wfo.csv')
    df.set_index('wfo', inplace=True)
    m = MapPlot(sector='conus',
                title="Percentage of Flash Flood Watches receiving 1+ FFW",
                subtitle='PRELIMINARY PLOT! Please do not share :)')
    cmap = plt.get_cmap('jet')
    df2 = df[df['freq'].notnull()]
    m.fill_cwas(df2['freq'].to_dict(), cmap=cmap, units='%',
                lblformat='%.0f', ilabel=True)
    m.postprocess(filename='test.png')
    m.close()
开发者ID:akrherz,项目名称:DEV,代码行数:15,代码来源:watch_into_warning.py

示例9: doday

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def doday(ts, realtime):
    """
    Create a plot of precipitation stage4 estimates for some day
    """
    lts = datetime.datetime.utcnow().replace(
                tzinfo=pytz.timezone("UTC"))
    lts = lts.astimezone(pytz.timezone("America/Chicago"))
    # make assumptions about the last valid MRMS data
    if realtime:
        # Up until :59 after of the last hour
        lts = (lts - datetime.timedelta(hours=1)).replace(minute=59)
    else:
        lts = lts.replace(year=ts.year, month=ts.month, day=ts.day,
                          hour=23, minute=59)

    idx = iemre.daily_offset(ts)
    ncfn = "/mesonet/data/iemre/%s_mw_mrms_daily.nc" % (ts.year,)
    nc = netCDF4.Dataset(ncfn)
    precip = nc.variables['p01d'][idx, :, :]
    lats = nc.variables['lat'][:]
    lons = nc.variables['lon'][:]
    subtitle = "Total between 12:00 AM and %s" % (
                                            lts.strftime("%I:%M %p %Z"),)
    routes = 'ac'
    if not realtime:
        routes = 'a'

    # clevs = np.arange(0, 0.25, 0.05)
    # clevs = np.append(clevs, np.arange(0.25, 3., 0.25))
    # clevs = np.append(clevs, np.arange(3., 10.0, 1))
    clevs = [0.01, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 8,
             10]

    sector = 'iowa'
    pqstr = ("plot %s %s00 %s_q2_1d.png %s_q2_1d.png png"
             ) % (routes, ts.strftime("%Y%m%d%H"), sector, sector)
    m = MapPlot(title=("%s NCEP MRMS Q3 Today's Precipitation"
                       ) % (ts.strftime("%-d %b %Y"),),
                subtitle=subtitle, sector=sector)

    (x, y) = np.meshgrid(lons, lats)

    m.pcolormesh(x, y, distance(precip, 'MM').value('IN'), clevs,
                 cmap=nwsprecip(), units='inch')
    m.drawcounties()
    m.postprocess(pqstr=pqstr, view=False)
    m.close()
开发者ID:akrherz,项目名称:iem,代码行数:49,代码来源:q3_today_total.py

示例10: plot_precip_month

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def plot_precip_month(valid):
    """ Go Main Go

    Args:
      valid (datetime): The timestamp we are interested in!
    """
    pgconn = psycopg2.connect(database='iem', host='iemdb', user='nobody')
    cursor = pgconn.cursor()

    d1 = valid.replace(day=1)
    d2 = d1 + datetime.timedelta(days=35)
    d2 = d2.replace(day=1)

    cursor.execute("""SELECT sum(pday), id, st_x(geom), st_y(geom)
    from summary s JOIN stations t on
    (t.iemid = s.iemid) WHERE s.day >= %s and s.day < %s
    and t.network in ('IA_COOP', 'NE_COOP', 'MO_COOP', 'IL_COOP', 'WI_COOP',
    'MN_COOP')
    and pday is not null and pday >= 0 and
    extract(hour from coop_valid) between 5 and 10
    GROUP by id, st_x, st_y""", (d1.date(), d2.date()))
    labels = []
    vals = []
    lats = []
    lons = []
    for row in cursor:
        labels.append(row[1])
        vals.append(pretty(row[0]))
        lats.append(row[3])
        lons.append(row[2])

    m = MapPlot(title='%s NWS COOP Month Precipitation Totals [inch]' % (
                                            valid.strftime("%-d %b %Y"),),
                subtitle='Reports valid between 6 and 9 AM',
                axisbg='white', figsize=(10.24, 7.68))
    m.plot_values(lons, lats, vals, fmt='%s', labels=labels,
                  labelcolor='tan')
    m.drawcounties()

    pqstr = "plot ac %s0000 coopMonthPlot.gif coopMonthPlot.gif gif" % (
                                                    valid.strftime("%Y%m%d"),)

    m.postprocess(pqstr=pqstr)
    m.close()

    pgconn.close()
开发者ID:muthulatha,项目名称:iem,代码行数:48,代码来源:plot_coop.py

示例11: main

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def main():
    """Go Main!"""
    nt = NetworkTable("IACLIMATE")
    pgconn = get_dbconn('coop')

    df = read_sql("""
    with monthly as (
        select station, year, month, avg((high+low)/2.) from alldata_ia
        WHERE day < '2018-06-01' and high is not null
        GROUP by station, year, month),
    agg as (
        select station, year, month, avg,
        lag(avg) OVER (PARTITION by station ORDER by year ASC, month ASC)
        from monthly),
    agg2 as (
        select station, year, month, avg, lag, avg - lag as val,
        rank() OVER (PARTITION by station ORDER by avg - lag DESC)
        from agg WHERE lag is not null)
    select * from agg2 where rank = 1 ORDER by station
    """, pgconn, index_col='station')
    df['lat'] = 0.
    df['lon'] = 0.
    for station, _ in df.iterrows():
        if station in nt.sts and station != 'IA0000' and station[2] != 'C':
            df.at[station, 'lat'] = nt.sts[station]['lat']
            df.at[station, 'lon'] = nt.sts[station]['lon']

    mp = MapPlot(title="Largest Positive Change in Month to Month Average Temperature",
                 subtitle=('values in red set record for April to May 2018'), sector='state',
                 state='IA',
                 drawstates=True, continentalcolor='white')
    df2 = df[df['year'] == 2018]
    mp.plot_values(df2['lon'].values,
                   df2['lat'].values,
                   df2['val'].values, fmt='%.1f', textsize=12, labelbuffer=5,
                   color='r')
    df2 = df[df['year'] != 2018]
    mp.plot_values(df2['lon'].values,
                   df2['lat'].values,
                   df2['val'].values, fmt='%.1f', textsize=12, labelbuffer=5,
                   color='b')
    mp.drawcounties()
    mp.postprocess(filename='test.png')
    mp.close()
开发者ID:akrherz,项目名称:DEV,代码行数:46,代码来源:map_percentile.py

示例12: plot_snowdepth

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def plot_snowdepth(valid):
    """ Go Main Go

    Args:
      valid (datetime): The timestamp we are interested in!
    """
    pgconn = psycopg2.connect(database='iem', host='iemdb', user='nobody')
    cursor = pgconn.cursor()

    cursor.execute("""SELECT snowd, id, st_x(geom), st_y(geom)
    from summary s JOIN stations t on
    (t.iemid = s.iemid) WHERE s.day = %s
    and t.network in ('IA_COOP', 'NE_COOP', 'MO_COOP', 'IL_COOP', 'WI_COOP',
    'MN_COOP')
    and snowd is not null and snowd >= 0 and
    extract(hour from coop_valid) between 5 and 10""", (valid.date(),))
    labels = []
    vals = []
    lats = []
    lons = []
    for row in cursor:
        labels.append(row[1])
        vals.append(pretty(row[0], precision=0))
        lats.append(row[3])
        lons.append(row[2])

    m = MapPlot(title='%s NWS COOP Snowfall Depth Reports [inch]' % (
                                            valid.strftime("%-d %b %Y"),),
                subtitle='Reports valid between 6 and 9 AM',
                axisbg='white', figsize=(10.24, 7.68))
    m.plot_values(lons, lats, vals, fmt='%s', labels=labels,
                  labelcolor='tan')
    m.drawcounties()

    pqstr = "plot ac %s0000 coopSnowDepth.gif coopSnowDepth.gif gif" % (
                                                    valid.strftime("%Y%m%d"),)

    m.postprocess(pqstr=pqstr)
    m.close()

    pgconn.close()
开发者ID:muthulatha,项目名称:iem,代码行数:43,代码来源:plot_coop.py

示例13: main

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def main():
    """Go Main Go"""
    pgconn = get_dbconn('postgis')
    cursor = pgconn.cursor()
    sts = datetime.date(2018, 1, 24)
    ets = datetime.date(2017, 8, 1)
    now = sts
    xaxis = np.arange(reference.IA_WEST, reference.IA_EAST, GX)
    yaxis = np.arange(reference.IA_SOUTH, reference.IA_NORTH, GX)
    """
    days = np.ones((len(yaxis), len(xaxis)), 'i') * -1

    count = 0
    while now >= ets:
        cursor.execute(""
        select distinct st_x(geom) as lon, st_y(geom) as lat
        from nldn_all n, states s
        WHERE n.valid >= %s and n.valid < %s
        and s.state_abbr = 'IA' and n.geom && s.the_geom
        "", (now, now + datetime.timedelta(days=1)))
        print("date: %s rows: %s" % (now, cursor.rowcount))
        for row in cursor:
            yidx = int((row[1] - reference.IA_SOUTH) / GX)
            xidx = int((row[0] - reference.IA_WEST) / GX)
            if days[yidx, xidx] < 0:
                days[yidx, xidx] = count
        now -= datetime.timedelta(days=1)
        count += 1

    np.save('days', days)
    """
    days = np.load('days.npy')
    mp = MapPlot()
    ramp = [1, 24, 55, 85, 116, 146, 177]
    mp.pcolormesh(xaxis, yaxis, days, ramp,
                  cmap=plt.get_cmap('afmhot_r'))
    mp.postprocess(filename='test.png')
    mp.close()
开发者ID:akrherz,项目名称:DEV,代码行数:40,代码来源:nldn_days.py

示例14: doit

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def doit(ts):
    """
    Generate hourly plot of stage4 data
    """
    routes = "a"
    if ((gmtnow - ts).days * 86400. + (gmtnow - ts).seconds) < 7200:
        routes = "ac"

    fn = "/mesonet/ARCHIVE/data/%s/stage4/ST4.%s.01h.grib" % (
                        ts.strftime("%Y/%m/%d"), ts.strftime("%Y%m%d%H") )
    if not os.path.isfile(fn):
        print 'current/stage4_hourly.py Missing stage4 %s' % (fn,)
        return

    grbs = pygrib.open(fn)
    grib = grbs[1]
    lats, lons = grib.latlons()
    vals = grib.values / 25.4

    cmap = cm.get_cmap("jet")
    cmap.set_under('white')
    cmap.set_over('black')
    clevs = [0.01,0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.5,2,3]
    localtime = ts.astimezone(pytz.timezone("America/Chicago"))

    for sector in ['iowa', 'midwest', 'conus']:
        m = MapPlot(sector=sector,
                    title='Stage IV One Hour Precipitation',
                    subtitle='Hour Ending %s' % (
                                    localtime.strftime("%d %B %Y %I %p %Z"),))
        m.pcolormesh(lons, lats, vals, clevs, units='inch')
        pqstr = "plot %s %s00 %s_stage4_1h.png %s_stage4_1h_%s.png png" % (
                                routes, ts.strftime("%Y%m%d%H"), sector,
                                sector, ts.strftime("%H"))
        if sector == 'iowa':
            m.drawcounties()
        m.postprocess(view=False, pqstr=pqstr)
        m.close()
开发者ID:KayneWest,项目名称:iem,代码行数:40,代码来源:stage4_hourly.py

示例15: doday

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import close [as 别名]
def doday(ts, realtime):
    """
    Create a plot of precipitation stage4 estimates for some day
    """
    nc = netCDF4.Dataset("/mesonet/data/iemre/%s_ifc_daily.nc" % (ts.year,))
    idx = daily_offset(ts)
    xaxis = nc.variables['lon'][:]
    yaxis = nc.variables['lat'][:]
    total = nc.variables['p01d'][idx, :, :]
    nc.close()
    lastts = datetime.datetime(ts.year, ts.month, ts.day, 23, 59)
    if realtime:
        now = datetime.datetime.now() - datetime.timedelta(minutes=60)
        lastts = now.replace(minute=59)
    subtitle = "Total between 12:00 AM and %s" % (
                                                  lastts.strftime("%I:%M %p"),)
    routes = 'ac'
    if not realtime:
        routes = 'a'

    clevs = [0.01, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 8,
             10]

    pqstr = ("plot %s %s00 iowa_ifc_1d.png iowa_ifc_1d.png png"
             ) % (routes, ts.strftime("%Y%m%d%H"))
    m = MapPlot(title=("%s Iowa Flood Center Today's Precipitation"
                       ) % (ts.strftime("%-d %b %Y"),),
                subtitle=subtitle, sector='custom',
                west=xaxis[0], east=xaxis[-1],
                south=yaxis[0], north=yaxis[-1])

    (x, y) = np.meshgrid(xaxis, yaxis)

    m.pcolormesh(x, y, distance(total, 'MM').value("IN"), clevs,
                 cmap=nwsprecip(), units='inch')
    m.drawcounties()
    m.postprocess(pqstr=pqstr, view=False)
    m.close()
开发者ID:akrherz,项目名称:iem,代码行数:40,代码来源:ifc_today_total.py


注:本文中的pyiem.plot.MapPlot.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。