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


Python MapPlot.plot_station方法代码示例

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


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

示例1: main

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import plot_station [as 别名]
def main():
    """Do Something"""
    cursor = IEM.cursor()
    data = []
    cursor.execute("""SELECT ST_x(geom), ST_y(geom), tsf0, tsf1, tsf2, tsf3,
    id, rwis_subf from current c JOIN stations t on (t.iemid = c.iemid)
    WHERE c.valid > now() - '1 hour'::interval""")
    for row in cursor:
        val = cln(row[2:6])
        if val is None:
            continue
        d = dict(lat=row[1], lon=row[0], tmpf=val, id=row[6])
        if row[7] is not None and not np.isnan(row[7]):
            d['dwpf'] = row[7]
        data.append(d)

    now = datetime.datetime.now()
    m = MapPlot(axisbg='white',
                title='Iowa RWIS Average Pavement + Sub-Surface Temperature',
                subtitle=("Valid: %s (pavement in red, sub-surface in blue)"
                          "") % (now.strftime("%-d %b %Y %-I:%M %p"),))
    m.plot_station(data)
    m.drawcounties()
    pqstr = ("plot c %s rwis_sf.png rwis_sf.png png"
             "") % (datetime.datetime.utcnow().strftime("%Y%m%d%H%M"), )
    m.postprocess(view=False, pqstr=pqstr)
开发者ID:KayneWest,项目名称:iem,代码行数:28,代码来源:plot_rwis_sf.py

示例2: test_stationplot

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import plot_station [as 别名]
def test_stationplot():
    """Testing the plotting of wind barbs"""
    mp = MapPlot(continentalcolor='white', nocaption=True)
    data = [
        dict(lat=41.5, lon=-96, tmpf=50, dwpf=30, id='BOOI4'),
        dict(lat=42.0, lon=-95.5, tmpf=50, dwpf=30, id='CSAI4'),
    ]
    mp.plot_station(data, fontsize=12)
    return mp.fig
开发者ID:akrherz,项目名称:pyIEM,代码行数:11,代码来源:test_geoplot.py

示例3: plot_hilo

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import plot_station [as 别名]
def plot_hilo(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 max_tmpf, min_tmpf, 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 max_tmpf is not null and max_tmpf >= -30 and
    min_tmpf is not null and min_tmpf < 99 and
    extract(hour from coop_valid) between 5 and 10""", (valid.date(),))
    data = []
    for row in cursor:
        data.append(dict(lat=row[4], lon=row[3], tmpf=row[0],
                         dwpf=row[1], id=row[2]))

    m = MapPlot(title=('%s NWS COOP 24 Hour High/Low Temperature [$^\circ$F]'
                       ) % (valid.strftime("%-d %b %Y"),),
                subtitle='Reports valid between 6 and 9 AM',
                axisbg='white', figsize=(10.24, 7.68))
    m.plot_station(data)
    m.drawcounties()

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

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

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

示例4: NetworkTable

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import plot_station [as 别名]
nt = NetworkTable('IACLIMATE')
nt.sts["IA0200"]["lon"] = -93.6
nt.sts["IA5992"]["lat"] = 41.65
import psycopg2.extras
coop = psycopg2.connect(database='coop', host='iemdb', user='nobody')

# Compute normal from the climate database
sql = """SELECT station, high, low from climate WHERE valid = '2000-%s'
    and substr(station,0,3) = 'IA'""" % (now.strftime("%m-%d"),)

obs = []
c = coop.cursor(cursor_factory=psycopg2.extras.DictCursor)
c.execute(sql)
for row in c:
    sid = row['station']
    if sid[2] == 'C' or sid[2:] == '0000' or sid not in nt.sts:
        continue
    obs.append(dict(id=sid[2:], lat=nt.sts[sid]['lat'],
                    lon=nt.sts[sid]['lon'], tmpf=row['high'],
                    dwpf=row['low']))

m = MapPlot(title="Average High + Low Temperature [F] (1893-%s)" % (now.year,),
            subtitle="For Date: %s" % (now.strftime("%d %b"),),
            axisbg='white')
m.drawcounties()
m.plot_station(obs)
pqstr = ("plot ac %s0000 climate/iowa_today_avg_hilo_pt.png "
         "coop_avg_temp.png png") % (now.strftime("%Y%m%d"), )
m.postprocess(view=False, pqstr=pqstr)
m.close()
开发者ID:KayneWest,项目名称:iem,代码行数:32,代码来源:today_hilo.py

示例5: ST_x

# 需要导入模块: from pyiem.plot import MapPlot [as 别名]
# 或者: from pyiem.plot.MapPlot import plot_station [as 别名]
from pyiem.datatypes import direction, speed
import pyiem.meteorology as meteorology
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = IEM.cursor(cursor_factory=psycopg2.extras.DictCursor)

# Compute normal from the climate database
sql = """
SELECT 
  s.id, tmpf, dwpf, sknt, drct,  ST_x(s.geom) as lon, ST_y(s.geom) as lat
FROM 
  current c, stations s 
WHERE
  s.network IN ('IA_RWIS') and c.iemid = s.iemid and 
  valid + '20 minutes'::interval > now() and
  tmpf > -50 and dwpf > -50
"""

data = []
icursor.execute(sql)
for row in icursor:
    data.append(row)

m = MapPlot(axisbg='white',
            title='Iowa DOT RWIS Mesoplot',
            subtitle='plot valid %s' % (now.strftime("%-d %b %Y %H:%M %P"), ))
m.plot_station(data)
m.drawcounties(color='#EEEEEE')
pqstr = "plot c 000000000000 iowa_rwis.png bogus png"
m.postprocess(pqstr=pqstr)
m.close()
开发者ID:KayneWest,项目名称:iem,代码行数:32,代码来源:rwis_station.py


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