Surface Data with Siphon and MetPy

Unidata Logo

Working with Surface Observations in Siphon and MetPy

Unidata Python Workshop


METAR

Questions

  1. What's the best way to get surface station data from a THREDDS data server?
  2. What's the best way to make a station plot of data?
  3. How can I request a time series of data for a single station?

Objectives

  1. Use the netCDF Subset Service (NCSS) to request a portion of the data
  2. Download data for a single time across stations and create a station plot
  3. Request a time series of data and plot

1. Using NCSS to get point data

In [1]:
from siphon.catalog import TDSCatalog

# copied from the browser url box
metar_cat_url = ('http://thredds.ucar.edu/thredds/catalog/'
                 'irma/metar/catalog.xml?dataset=irma/metar/Metar_Station_Data_-_Irma_fc.cdmr')

# Parse the xml
catalog = TDSCatalog(metar_cat_url)

# what datasets are here?
print(list(catalog.datasets))
['Feature Collection']
In [2]:
metar_dataset = catalog.datasets['Feature Collection']

Once we've grabbed the "Feature Collection" dataset, we can request a subset of the data:

In [3]:
# Can safely ignore the warnings
ncss = metar_dataset.subset()

What variables do we have available?

In [4]:
ncss.variables
Out[4]:
{'altimeter_setting',
 'dewpoint',
 'report',
 'sea_level_pressure',
 'sky_coverage',
 'temperature',
 'visibility',
 'wind_direction',
 'wind_gust',
 'wind_speed'}

Top


2. Making a station plot

  • Make new NCSS query
  • Request data closest to a time
In [5]:
from datetime import datetime

query = ncss.query()
query.lonlat_box(north=34, south=24, east=-80, west=-90)
query.time(datetime(2017, 9, 10, 12))
query.variables('temperature', 'dewpoint', 'altimeter_setting',
                'wind_speed', 'wind_direction', 'sky_coverage')
query.accept('csv')
Out[5]:
var=temperature&var=wind_speed&var=wind_direction&var=dewpoint&var=sky_coverage&var=altimeter_setting&time=2017-09-10T12%3A00%3A00&west=-90&east=-80&south=24&north=34&accept=csv
In [6]:
# Get the data
data = ncss.get_data(query)
data
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/siphon/ncss.py:433: VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.
  converters={'date': lambda s: parse_iso_date(s.decode('utf-8'))})
Out[6]:
{'time': array([b'2017-09-10T13:00:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:51:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:50:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:51:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:50:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:50:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T13:00:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:52:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:45:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T11:56:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:55:00Z', b'2017-09-10T12:55:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:58:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:53:00Z', b'2017-09-10T12:53:00Z',
        b'2017-09-10T12:58:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z',
        b'2017-09-10T12:56:00Z', b'2017-09-10T12:56:00Z'], dtype='|S20'),
 'station': array([b'KMIS', b'KSTF', b'KCEW', b'KEET', b'KFFC', b'KPDK', b'KTLH',
        b'KCBM', b'KCBM', b'KCBM', b'KCBM', b'KLOR', b'KLOR', b'KSSC',
        b'KSSC', b'KSSC', b'KSSC', b'KSSC', b'KSSC', b'KSSC', b'KSSC',
        b'KSSC', b'KEUF', b'KSPG', b'KAGS', b'KOGB', b'KCUB', b'KGZH',
        b'KLSF', b'KLSF', b'KLSF', b'KLSF', b'KPAM', b'KPAM', b'KPAM',
        b'KPAM', b'KPAM', b'KPAM', b'KPAM', b'KDYA', b'KINF', b'KBHM',
        b'KCHS', b'KCHS', b'KCHS', b'KCAE', b'KMCN', b'KLUL', b'KAIK',
        b'KDYB', b'K2J9', b'KARW', b'KVDF', b'KEKY', b'KFTY', b'K24J',
        b'KBNL', b'KCLW', b'KJZI', b'KPLR', b'KSEM', b'KX60', b'KJFX',
        b'KMNI', b'KWRB', b'KWRB', b'KWRB', b'KWRB', b'KWRB', b'K1A9',
        b'K28J', b'K54J', b'K5A6', b'K6A1', b'KASN', b'KBGE', b'KBQK',
        b'KDNL', b'KGAD', b'KA08', b'KALX', b'KBIJ', b'KCCO', b'KCQF',
        b'KDLP', b'KFZG', b'KIKT', b'KTBR', b'KTPF', b'KVDI', b'KVOA',
        b'KWDR', b'K0R0', b'KBXA', b'KCKF', b'KDQH', b'KEDN', b'KLGC',
        b'KPXE', b'KMKS', b'KOBE', b'KPCM', b'KPUJ', b'KRBW', b'KSCD',
        b'KTVI', b'KMMT', b'KMMT', b'KMMT', b'KMMT', b'KMMT', b'KVAD',
        b'KVAD', b'KVAD', b'KVAD', b'KVAD', b'KVAD', b'KVAD', b'KVAD',
        b'KVAD', b'KEZM', b'KOPN', b'KSEF', b'KTMA', b'KAAF', b'KJKA',
        b'KAHN', b'KDBN', b'KSMS', b'KCTJ', b'KHQU', b'KVVG', b'KMXF',
        b'KMXF', b'KMXF', b'KMXF', b'KMXF', b'KPIE', b'KCSG', b'KANB',
        b'KHEY', b'KHEY', b'KMGE', b'KMGE', b'KMGE', b'KMGE', b'KHOE',
        b'KNPA', b'KNPA', b'KNPA', b'KNPA', b'KNPA', b'KNPA', b'KNPA',
        b'KHRT', b'KHRT', b'KHRT', b'KHRT', b'KHRT', b'KMCF', b'KMCF',
        b'KMCF', b'KMCF', b'KMCF', b'KMCF', b'KMCF', b'KSVN', b'KSVN',
        b'KSVN', b'KLAL', b'KGNV', b'KHXD', b'KVRB', b'KPMP', b'KPNS',
        b'KPQL', b'KRSW', b'KHBG', b'KCRG', b'KDAB', b'KDAB', b'KDAB',
        b'KABY', b'KAMG', b'KAPF', b'KASD', b'KMAI', b'KMCO', b'KMCO',
        b'KMCO', b'KMIA', b'KBFM', b'KATL', b'KORL', b'KPBI', b'KPBI',
        b'KPBI', b'KPGD', b'KSRQ', b'KTCL', b'KTMB', b'KLEE', b'KECP',
        b'KFXE', b'KGIF', b'KGPT', b'KSFB', b'KTPA', b'KDHN', b'KNRB',
        b'KNRB', b'KNRB', b'KNRB', b'KNRB', b'KNRB', b'KDTS', b'KDTS',
        b'KDTS', b'KSAV', b'KSAV', b'KSAV', b'KOZR', b'KOZR', b'KOZR',
        b'KOZR', b'KOZR', b'KTDR', b'KTDR', b'KHSA', b'KGTR', b'KFLL',
        b'KFLL', b'KFLL', b'KPIB', b'KVPS', b'KVPS', b'KVPS', b'KVPS',
        b'KVPS', b'KVPS', b'KSXS', b'KSXS', b'KBIX', b'KBIX', b'KBIX',
        b'KBIX', b'KBIX', b'KBIX', b'KBIX', b'KEGI', b'KEGI', b'KEGI',
        b'KNMM', b'KNMM', b'KNMM', b'KNMM', b'KNMM', b'KNMM', b'KNSE',
        b'KNSE', b'KNSE', b'KNSE', b'KNSE', b'KNSE', b'K79J', b'K79J',
        b'K79J', b'K79J', b'K79J', b'KPRN', b'KJAX', b'KMOB', b'KNDZ',
        b'KNDZ', b'KNDZ', b'KNIP', b'KNIP', b'KNIP', b'KNIP', b'KNIP',
        b'KNIP', b'KNIP', b'KNIP', b'KNIP', b'KNIP', b'KNIP', b'KNIP',
        b'KNIP', b'KMEI', b'KNBC', b'KNBC', b'KNBC', b'KNBC', b'KNBC',
        b'KNBC', b'KNBC'], dtype='|S4'),
 'latitude': array([29.299, 33.43 , 30.78 , 33.18 , 33.349, 33.88 , 30.399, 33.63 ,
        33.63 , 33.63 , 33.63 , 31.35 , 31.35 , 33.97 , 33.97 , 33.97 ,
        33.97 , 33.97 , 33.97 , 33.97 , 33.97 , 33.97 , 31.95 , 27.77 ,
        33.36 , 33.47 , 33.97 , 31.42 , 32.319, 32.319, 32.319, 32.319,
        30.069, 30.069, 30.069, 30.069, 30.069, 30.069, 30.069, 32.47 ,
        28.799, 33.569, 32.9  , 32.9  , 32.9  , 33.93 , 32.68 , 31.469,
        33.65 , 33.069, 30.6  , 32.419, 28.02 , 33.319, 33.779, 30.299,
        33.25 , 27.979, 32.7  , 33.569, 32.349, 29.35 , 33.9  , 33.58 ,
        32.61 , 32.61 , 32.61 , 32.61 , 32.61 , 32.599, 29.67 , 30.729,
        33.47 , 32.569, 33.569, 30.969, 31.25 , 33.47 , 33.97 , 32.52 ,
        32.919, 31.399, 33.319, 30.469, 29.12 , 31.68 , 28.52 , 32.47 ,
        27.92 , 32.2  , 29.229, 33.97 , 31.299, 30.819, 31.979, 31.479,
        31.299, 33.   , 32.52 , 33.18 , 27.27 , 28.   , 33.919, 32.919,
        33.169, 30.899, 33.919, 33.919, 33.919, 33.919, 33.919, 30.969,
        30.969, 30.969, 30.969, 30.969, 30.969, 30.969, 30.969, 30.969,
        32.22 , 32.95 , 27.45 , 31.43 , 29.729, 30.28 , 33.95 , 32.569,
        34.   , 33.63 , 33.529, 28.95 , 32.36 , 32.36 , 32.36 , 32.36 ,
        32.36 , 27.92 , 32.52 , 33.58 , 31.35 , 31.35 , 33.919, 33.919,
        33.919, 33.919, 31.049, 30.35 , 30.35 , 30.35 , 30.35 , 30.35 ,
        30.35 , 30.35 , 30.42 , 30.42 , 30.42 , 30.42 , 30.42 , 27.85 ,
        27.85 , 27.85 , 27.85 , 27.85 , 27.85 , 27.85 , 32.02 , 32.02 ,
        32.02 , 27.969, 29.7  , 32.22 , 27.649, 26.25 , 30.479, 30.469,
        26.53 , 31.27 , 30.329, 29.18 , 29.18 , 29.18 , 31.53 , 31.53 ,
        26.149, 30.35 , 30.829, 28.42 , 28.42 , 28.42 , 25.799, 30.62 ,
        33.63 , 28.549, 26.68 , 26.68 , 26.68 , 26.92 , 27.399, 33.22 ,
        25.649, 28.819, 30.35 , 26.2  , 28.069, 30.42 , 28.77 , 27.969,
        31.319, 30.379, 30.379, 30.379, 30.379, 30.379, 30.379, 30.399,
        30.399, 30.399, 32.11 , 32.11 , 32.11 , 31.28 , 31.28 , 31.28 ,
        31.28 , 31.28 , 30.049, 30.049, 30.37 , 33.45 , 26.069, 26.069,
        26.069, 31.469, 30.469, 30.469, 30.469, 30.469, 30.469, 30.469,
        31.37 , 31.37 , 30.42 , 30.42 , 30.42 , 30.42 , 30.42 , 30.42 ,
        30.42 , 30.629, 30.629, 30.629, 32.529, 32.529, 32.529, 32.529,
        32.529, 32.529, 30.729, 30.729, 30.729, 30.729, 30.729, 30.729,
        31.319, 31.319, 31.319, 31.319, 31.319, 31.85 , 30.5  , 30.68 ,
        30.7  , 30.7  , 30.7  , 30.219, 30.219, 30.219, 30.219, 30.219,
        30.219, 30.219, 30.219, 30.219, 30.219, 30.219, 30.219, 30.219,
        32.33 , 32.47 , 32.47 , 32.47 , 32.47 , 32.47 , 32.47 , 32.47 ]),
 'longitude': array([-88.849, -88.849, -86.519, -86.779, -84.569, -84.3  , -84.349,
        -88.449, -88.449, -88.449, -88.449, -85.75 , -85.75 , -80.47 ,
        -80.47 , -80.47 , -80.47 , -80.47 , -80.47 , -80.47 , -80.47 ,
        -80.47 , -85.129, -82.629, -81.97 , -80.839, -81.   , -87.05 ,
        -84.97 , -84.97 , -84.97 , -84.97 , -85.569, -85.569, -85.569,
        -85.569, -85.569, -85.569, -85.569, -87.949, -82.319, -86.75 ,
        -80.029, -80.029, -80.029, -81.12 , -83.65 , -89.33 , -81.68 ,
        -80.279, -84.55 , -80.629, -82.33 , -86.919, -84.519, -83.019,
        -81.379, -82.769, -80.   , -86.25 , -86.98 , -82.47 , -87.319,
        -80.22 , -83.58 , -83.58 , -83.58 , -83.58 , -83.58 , -86.519,
        -81.68 , -86.15 , -89.73 , -84.25 , -86.05 , -84.629, -81.47 ,
        -82.029, -86.069, -87.379, -85.97 , -84.9  , -84.769, -87.879,
        -89.55 , -83.269, -88.279, -81.73 , -82.449, -82.37 , -87.779,
        -83.669, -89.816, -89.87 , -83.769, -82.87 , -85.9  , -85.069,
        -83.769, -80.029, -80.839, -82.169, -84.93 , -80.629, -86.3  ,
        -83.879, -80.779, -80.779, -80.779, -80.779, -80.779, -83.199,
        -83.199, -83.199, -83.199, -83.199, -83.199, -83.199, -83.199,
        -83.199, -83.129, -84.269, -81.349, -83.48 , -85.029, -87.669,
        -83.33 , -82.98 , -80.37 , -85.15 , -82.519, -81.97 , -86.37 ,
        -86.37 , -86.37 , -86.37 , -86.37 , -82.68 , -84.949, -85.849,
        -85.65 , -85.65 , -84.519, -84.519, -84.519, -84.519, -82.779,
        -87.319, -87.319, -87.319, -87.319, -87.319, -87.319, -87.319,
        -86.669, -86.669, -86.669, -86.669, -86.669, -82.519, -82.519,
        -82.519, -82.519, -82.519, -82.519, -82.519, -81.15 , -81.15 ,
        -81.15 , -82.019, -82.279, -80.699, -80.419, -80.12 , -87.18 ,
        -88.529, -81.75 , -89.25 , -81.519, -81.059, -81.059, -81.059,
        -84.199, -82.5  , -81.769, -89.819, -85.18 , -81.33 , -81.33 ,
        -81.33 , -80.279, -88.069, -84.449, -81.33 , -80.089, -80.089,
        -80.089, -82.   , -82.569, -87.62 , -80.43 , -81.809, -85.8  ,
        -80.18 , -81.75 , -89.08 , -81.22 , -82.529, -85.449, -81.419,
        -81.419, -81.419, -81.419, -81.419, -81.419, -86.47 , -86.47 ,
        -86.47 , -81.199, -81.199, -81.199, -85.72 , -85.72 , -85.72 ,
        -85.72 , -85.72 , -85.519, -85.519, -89.449, -88.569, -80.15 ,
        -80.15 , -80.15 , -89.319, -86.519, -86.519, -86.519, -86.519,
        -86.519, -86.519, -85.849, -85.849, -88.919, -88.919, -88.919,
        -88.919, -88.919, -88.919, -88.919, -86.519, -86.519, -86.519,
        -88.569, -88.569, -88.569, -88.569, -88.569, -88.569, -87.019,
        -87.019, -87.019, -87.019, -87.019, -87.019, -86.4  , -86.4  ,
        -86.4  , -86.4  , -86.4  , -86.62 , -81.68 , -88.25 , -87.019,
        -87.019, -87.019, -81.669, -81.669, -81.669, -81.669, -81.669,
        -81.669, -81.669, -81.669, -81.669, -81.669, -81.669, -81.669,
        -81.669, -88.75 , -80.72 , -80.72 , -80.72 , -80.72 , -80.72 ,
        -80.72 , -80.72 ]),
 'temperature': array([26., 17., 21., 18., 17., 16., 22., 17., 17., 17., 17., 21., 21.,
        16., 16., 16., 16., 16., 16., 16., 16., 16., 21., 27., 19., 17.,
        17., 21., 21., 21., 21., 21., 23., 23., 23., 23., 23., 23., 23.,
        17., 25., 18., 18., 18., 18., 17., 19., 19., 16., 18., 22., 18.,
        26., 18., 17., 20., 18., 24., 19., 18., 19., 25., 18., 16., 19.,
        19., 19., 19., 19., 19., 24., 21., 17., 19., nan, 22., 20., 18.,
        18., 18., 18., 22., 18., 21., 28., 18., 27., 19., nan, 20., 26.,
        16., 19., 19., 22., 19., 20., 20., 19., 17., 23., 25., 18., 17.,
        20., 21., 16., 16., 16., 16., 16., 18., 18., 18., 18., 18., 18.,
        18., 18., 18., 21., 17., 25., 19., 22., 20., 16., 18., 16., 17.,
        16., 24., 20., 20., 20., 20., 20., 27., 20., 17., 21., 21., 17.,
        17., 17., 17., nan, 23., 23., 23., 23., 23., 23., 23., 22., 22.,
        22., 22., 22., 24., 24., 24., 24., 24., 24., 24., 17., 17., 17.,
        24., 23., 18., 27., 28., 23., 21., 24., 19., 24., 28., 28., 28.,
        21., 21., 24., 19., 22., 26., 26., 26., 26., 21., 17., 26., 28.,
        28., 28., 23., 25., 19., nan, 26., 23., 26., 25., 20., 26., 26.,
        21., 24., 24., 24., 24., 24., 24., 24., 24., 24., 16., 16., 16.,
        21., 21., 21., 21., 21., 22., 22., 19., 19., nan, nan, nan, 17.,
        22., 22., 22., 22., 22., 22., 21., 21., 20., 20., 20., 20., 20.,
        20., 20., 21., 21., 21., 19., 19., 19., 19., 19., 19., 21., 21.,
        21., 21., 21., 21., 23., 23., 23., 23., 23., 20., 24., 21., 23.,
        23., 23., 24., 24., 24., 24., 24., 24., 24., 24., 24., 24., 24.,
        24., 24., 19., 17., 17., 17., 17., 17., 17., 17.]),
 'wind_speed': array([13.375556 ,  3.6011112,  4.115556 ,  2.5722222,  4.63     ,
         4.63     ,  5.1444445,        nan,        nan,        nan,
               nan,  4.63     ,  4.63     ,  7.7166667,  7.7166667,
         7.7166667,  7.7166667,  7.7166667,  7.7166667,  7.7166667,
         7.7166667,  7.7166667,  4.63     , 13.375556 ,  5.658889 ,
         6.173333 ,  2.057778 ,  4.63     ,  5.1444445,  5.1444445,
         5.1444445,  5.1444445,  5.658889 ,  5.658889 ,  5.658889 ,
         5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,  2.5722222,
         6.687778 ,  3.6011112,  6.173333 ,  6.173333 ,  6.173333 ,
         5.658889 ,  5.1444445,  3.6011112,  7.7166667,  5.1444445,
         3.6011112,  8.745556 ,  3.6011112,  4.115556 ,  6.173333 ,
         4.63     ,  7.2022223,  4.63     ,  5.1444445,  2.5722222,
         4.63     ,  6.173333 ,        nan,        nan,  4.63     ,
         4.63     ,  4.63     ,  4.63     ,  4.63     ,  3.0866666,
         8.745556 ,  5.1444445,  2.5722222,  6.687778 ,        nan,
         8.231112 ,  5.658889 ,  7.2022223,  4.63     ,  3.0866666,
         3.6011112,  3.6011112,  5.658889 ,  4.63     ,  3.6011112,
         4.115556 ,  6.687778 ,  4.115556 ,  9.774445 ,  4.63     ,
        15.947778 ,  2.057778 ,  5.658889 ,  3.0866666,  4.63     ,
         7.2022223,  2.5722222,  4.63     ,  7.7166667,  3.0866666,
         6.687778 ,  5.1444445,  6.173333 ,  5.658889 ,  5.658889 ,
         6.687778 ,  2.5722222,  2.5722222,  2.5722222,  2.5722222,
         2.5722222,  5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,
         5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,
         5.658889 ,  4.115556 ,  8.231112 ,  5.658889 ,  7.2022223,
         3.0866666,  5.658889 ,  6.173333 ,  5.1444445,  3.6011112,
         5.658889 ,        nan,  5.1444445,  5.1444445,  5.1444445,
         5.1444445,  5.1444445,  9.26     ,  5.1444445,  3.6011112,
         7.2022223,  7.2022223,  5.1444445,  5.1444445,  5.1444445,
         5.1444445,  3.0866666,  7.2022223,  7.2022223,  7.2022223,
         7.2022223,  7.2022223,  7.2022223,  7.2022223,  6.173333 ,
         6.173333 ,  6.173333 ,  6.173333 ,  6.173333 ,  8.745556 ,
         8.745556 ,  8.745556 ,  8.745556 ,  8.745556 ,  8.745556 ,
         8.745556 ,  5.658889 ,  5.658889 ,  5.658889 ,  8.231112 ,
         8.745556 ,  5.1444445,        nan, 16.976667 ,  4.115556 ,
         5.1444445, 10.803333 ,  2.057778 ,  9.26     ,  8.745556 ,
         8.745556 ,  8.745556 , 11.317778 ,  3.0866666, 16.976667 ,
         3.6011112,  8.745556 ,  6.687778 ,  6.687778 ,  6.687778 ,
        22.12111  ,  5.1444445,  8.231112 ,  4.63     , 20.577778 ,
        20.577778 , 20.577778 ,  9.26     ,  6.687778 ,  6.173333 ,
               nan,  7.7166667,  7.2022223, 25.207777 ,  7.7166667,
         3.6011112,  5.1444445,  5.1444445,  7.2022223, 15.433333 ,
        15.433333 , 15.433333 , 15.433333 , 15.433333 , 15.433333 ,
         6.173333 ,  6.173333 ,  6.173333 ,  6.687778 ,  6.687778 ,
         6.687778 ,  6.687778 ,  6.687778 ,  6.687778 ,  6.687778 ,
         6.687778 ,  6.687778 ,  6.687778 ,  3.0866666,  4.115556 ,
               nan,        nan,        nan,  3.6011112,  5.658889 ,
         5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,  5.658889 ,
         5.1444445,  5.1444445,  5.1444445,  5.1444445,  5.1444445,
         5.1444445,  5.1444445,  5.1444445,  5.1444445,  4.63     ,
         4.63     ,  4.63     ,  3.6011112,  3.6011112,  3.6011112,
         3.6011112,  3.6011112,  3.6011112,  4.63     ,  4.63     ,
         4.63     ,  4.63     ,  4.63     ,  4.63     ,  4.115556 ,
         4.115556 ,  4.115556 ,  4.115556 ,  4.115556 ,  4.115556 ,
         9.26     ,  7.2022223,  6.687778 ,  6.687778 ,  6.687778 ,
        11.317778 , 11.317778 , 11.317778 , 11.317778 , 11.317778 ,
        11.317778 , 11.317778 , 11.317778 , 11.317778 , 11.317778 ,
        11.317778 , 11.317778 , 11.317778 ,  5.1444445,  6.687778 ,
         6.687778 ,  6.687778 ,  6.687778 ,  6.687778 ,  6.687778 ,
         6.687778 ]),
 'wind_direction': array([ 70.,  60.,  40.,  nan,  70.,  80.,  50.,  nan,  nan,  nan,  nan,
         50.,  50.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,
         50.,  60.,  50.,  40.,  70.,  40.,  30.,  30.,  30.,  30.,  50.,
         50.,  50.,  50.,  50.,  50.,  50.,  20.,  40.,  60.,  30.,  30.,
         30.,  40.,  50.,  40.,  40.,  20.,  30.,  30.,  40.,  50.,  70.,
         20.,  40.,  40.,  20.,  nan,  50., 360.,  nan,  nan,  50.,  50.,
         50.,  50.,  50.,  40.,  60.,  50.,  40.,  70.,  nan,  50.,  30.,
         30.,  70.,  30.,  40.,  50.,  80.,  40.,  50.,  30.,  50.,  30.,
         40.,  40.,  60.,  60.,  50.,  20.,  60.,  50.,  50.,  70.,  60.,
         30.,  70.,  30., 100.,  30.,  80.,  60.,  20.,  20.,  20.,  20.,
         20.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  50.,
         70.,  70.,  50.,  40.,  30.,  60.,  60.,  10.,  80., 120.,  nan,
         50.,  50.,  50.,  50.,  50.,  40.,  80.,  80.,  50.,  50.,  80.,
         80.,  80.,  80.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,
         40.,  40.,  40.,  40.,  40.,  60.,  60.,  60.,  60.,  60.,  60.,
         60.,  20.,  20.,  20.,  40.,  20., 360.,  nan, 110.,  40.,  30.,
         40.,  20.,  60.,  70.,  70.,  70.,  50.,  nan,  60.,  10.,  60.,
         40.,  40.,  40., 100., 350.,  70.,  50., 100., 100., 100.,  40.,
         40.,  40.,  nan,  40.,  20., 110.,  50.,  30.,  60.,  40.,  60.,
         60.,  60.,  60.,  60.,  60.,  60.,  40.,  40.,  40.,  30.,  30.,
         30.,  40.,  40.,  40.,  40.,  40.,  40.,  40.,  30.,  60.,  nan,
         nan,  nan,  10.,  50.,  50.,  50.,  50.,  50.,  50.,  70.,  70.,
         40.,  40.,  40.,  40.,  40.,  40.,  40.,  50.,  50.,  50.,  40.,
         40.,  40.,  40.,  40.,  40.,  50.,  50.,  50.,  50.,  50.,  50.,
         50.,  50.,  50.,  50.,  50.,  50.,  40.,  30.,  50.,  50.,  50.,
         50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,  50.,
         50.,  50.,  30.,  40.,  40.,  40.,  40.,  40.,  40.,  40.]),
 'dewpoint': array([20., 13., 14., 13., 11.,  9., 17., 14., 14., 14., 14., 14., 14.,
        11., 11., 11., 11., 11., 11., 11., 11., 11., 13., 24., 10., 11.,
        10., 14., 12., 12., 12., 12., 15., 15., 15., 15., 15., 15., 15.,
        13., 25., 12., 13., 13., 13., 10., 12., 13., 10., 12., 15., 13.,
        24., 12., 11., 20., 12., 24., 15., 14., 12., 25., 15., 13., 12.,
        12., 12., 12., 12., 13., 24., 14., 14., 11., nan, 16., 18., 10.,
        13., 13., 12., 13., 12., 14., 20., 16., 21.,  9., nan, 12., 20.,
        11., nan, 15., 13., 12., 13., 12., 12., 11., 22., 25., 13., 11.,
        13., 16., 11., 11., 11., 11., 11., 16., 16., 16., 16., 16., 16.,
        16., 16., 16.,  6.,  8., 23., 14., 18., 14., 12., 10., 11., 11.,
        11., 24., 13., 13., 13., 13., 13., 24., 11., 12., 13., 13., 10.,
        10., 10., 10., nan, 13., 13., 13., 13., 13., 13., 13., 13., 13.,
        13., 13., 13., 24., 24., 24., 24., 24., 24., 24., 15., 15., 15.,
        24., 22., 16., 25., nan, 13., 13., 23., 15., 21., 25., 25., 25.,
        13., 13., 23., 15., 14., 26., 26., 26., 24., 16., 11., 26., 26.,
        26., 26., 22., 24., 14., nan, 24., 14., 25., 24., 14., 24., 24.,
        14., 22., 22., 22., 22., 22., 22., 13., 13., 13., 14., 14., 14.,
        13., 13., 13., 13., 13., 16., 16., 14., 13., nan, nan, nan, 14.,
        13., 13., 13., 13., 13., 13., 13., 13., 14., 14., 14., 14., 14.,
        14., 14., 13., 13., 13., 14., 14., 14., 14., 14., 14., 13., 13.,
        13., 13., 13., 13., 13., 13., 13., 13., 13., 13., 23., 13., 13.,
        13., 13., 23., 23., 23., 23., 23., 23., 23., 23., 23., 23., 23.,
        23., 23., 14., 14., 14., 14., 14., 14., 14., 14.]),
 'sky_coverage': array([100.,   0.,  75.,   0.,  50.,   0., 100.,   0.,   0.,   0.,   0.,
        100., 100.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,
        100.,  50.,  75., 100.,   0.,  75.,   0.,   0.,   0.,   0.,  75.,
         75.,  75.,  75.,  75.,  75.,  75.,   0.,  75.,   0., 100., 100.,
        100.,  75., 100.,   0.,  75., 100., 100.,  75., 100.,   0.,   0.,
        100., 100., 100.,  50.,   0.,  75.,  50.,   0.,  75., 100., 100.,
        100., 100., 100., 100., 100., 100.,   0.,   0.,   0.,  75., 100.,
         75.,   0., 100.,   0.,   0.,   0.,  50., 100., 100.,  75., 100.,
        100., 100., 100.,   0.,   0.,   0., 100., 100.,  50.,  50., 100.,
          0., 100., 100.,   0., 100.,  75., 100., 100., 100., 100., 100.,
        100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100.,
        100., 100., 100., 100.,   0.,   0., 100.,   0.,  75., 100.,   0.,
        100., 100., 100., 100., 100.,  75.,  75.,   0.,  75.,  75.,  25.,
         25.,  25.,  25., 100.,  75.,  75.,  75.,  75.,  75.,  75.,  75.,
         75.,  75.,  75.,  75.,  75., 100., 100., 100., 100., 100., 100.,
        100.,  25.,  25.,  25.,  75., 100., 100., 100.,   0.,  25., 100.,
        100.,   0., 100.,  75.,  75.,  75., 100., 100., 100.,  25., 100.,
        100., 100., 100., 100.,   0.,  25.,  75., 100., 100., 100.,  50.,
         75.,   0.,   0., 100.,   0., 100., 100.,  50.,  75.,  75.,  75.,
        100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100.,
        100.,  50.,  50.,  50.,  50.,  50.,  75.,  75.,  50.,   0.,   0.,
          0.,   0.,   0.,  75.,  75.,  75.,  75.,  75.,  75.,  75.,  75.,
        100., 100., 100., 100., 100., 100., 100.,  25.,  25.,  25.,   0.,
          0.,   0.,   0.,   0.,   0., 100., 100., 100., 100., 100., 100.,
         50.,  50.,  50.,  50.,  50., 100., 100.,  25., 100., 100., 100.,
        100., 100., 100., 100., 100., 100., 100., 100., 100., 100., 100.,
        100., 100.,   0., 100., 100., 100., 100., 100., 100., 100.]),
 'altimeter_setting': array([1014.562  , 1022.6894 , 1016.5939 , 1022.0121 , 1023.36664,
        1024.3826 , 1015.2393 , 1022.3507 , 1022.3507 , 1022.3507 ,
        1022.3507 , 1017.2711 , 1017.2711 , 1023.70526, 1023.70526,
        1023.70526, 1023.70526, 1023.70526, 1023.70526, 1023.70526,
        1023.70526, 1023.70526, 1018.96436, 1006.09607, 1023.36664,
        1023.36664, 1025.0598 , 1017.9484 , 1019.6416 , 1019.6416 ,
        1019.6416 , 1019.6416 , 1014.2234 , 1014.2234 , 1014.2234 ,
        1014.2234 , 1014.2234 , 1014.2234 , 1014.2234 , 1020.3189 ,
        1009.8211 , 1023.70526, 1020.99615, 1020.99615, 1020.99615,
        1024.7212 , 1021.67346, 1019.303  , 1025.0598 , 1022.3507 ,
        1016.25525, 1019.9803 , 1007.112  , 1022.6894 , 1024.3826 ,
        1015.2393 , 1022.6894 , 1006.7733 , 1020.65753, 1023.36664,
        1019.6416 , 1010.83704, 1023.36664, 1023.36664, 1021.33484,
        1021.33484, 1021.33484, 1021.33484, 1021.33484, 1019.9803 ,
        1011.8529 , 1016.5939 , 1022.3507 , 1021.67346, 1023.36664,
        1016.9325 , 1016.9325 , 1023.70526, 1024.044  , 1019.9803 ,
        1021.67346, 1017.9484 , 1023.028  , 1015.91656, 1014.2234 ,
        1019.9803 , 1012.86884, 1020.65753, 1006.7733 , 1019.9803 ,
        1012.86884, 1026.4144 , 1019.6416 , 1018.28705, 1020.3189 ,
        1018.62573, 1017.2711 , 1022.3507 , 1020.99615, 1022.0121 ,
        1004.0642 , 1007.4506 , 1024.3826 , 1022.0121 , 1022.3507 ,
        1016.9325 , 1024.3826 , 1024.3826 , 1024.3826 , 1024.3826 ,
        1024.3826 , 1016.25525, 1016.25525, 1016.25525, 1016.25525,
        1016.25525, 1016.25525, 1016.25525, 1016.25525, 1016.25525,
        1021.33484, 1022.6894 , 1005.41876, 1018.28705, 1012.5302 ,
        1015.57794, 1025.0598 , 1022.0121 , 1024.7212 , 1025.0598 ,
        1025.737  , 1006.7733 , 1019.6416 , 1019.6416 , 1019.6416 ,
        1019.6416 , 1019.6416 , 1006.4347 , 1020.65753, 1023.028  ,
        1016.9325 , 1016.9325 , 1024.3826 , 1024.3826 , 1024.3826 ,
        1024.3826 , 1016.9325 , 1015.2393 , 1015.2393 , 1015.2393 ,
        1015.2393 , 1015.2393 , 1015.2393 , 1015.2393 , 1014.562  ,
        1014.562  , 1014.562  , 1014.562  , 1014.562  , 1006.09607,
        1006.09607, 1006.09607, 1006.09607, 1006.09607, 1006.09607,
        1006.09607, 1018.28705, 1018.28705, 1018.28705, 1006.7733 ,
        1012.5302 , 1019.6416 , 1005.08014,  998.646  , 1015.57794,
        1016.25525,  997.63007, 1018.62573, 1013.88477, 1009.8211 ,
        1009.8211 , 1009.8211 , 1018.96436, 1017.9484 ,  993.9051 ,
        1016.5939 , 1016.25525, 1008.12787, 1008.12787, 1008.12787,
         995.25964, 1016.9325 , 1024.044  , 1008.46655, 1001.6938 ,
        1001.6938 , 1001.6938 , 1002.0324 , 1004.0642 , 1022.0121 ,
         992.21185, 1009.8211 , 1014.562  ,  997.96875, 1007.78925,
        1016.25525, 1008.8052 , 1007.112  , 1018.28705, 1013.88477,
        1013.88477, 1013.88477, 1013.88477, 1013.88477, 1013.88477,
        1014.9007 , 1014.9007 , 1014.9007 , 1019.6416 , 1019.6416 ,
        1019.6416 , 1016.9325 , 1016.9325 , 1016.9325 , 1016.9325 ,
        1016.9325 , 1014.2234 , 1014.2234 , 1016.5939 , 1020.99615,
         997.29144,  997.29144,  997.29144, 1018.96436, 1014.9007 ,
        1014.9007 , 1014.9007 , 1014.9007 , 1014.9007 , 1014.9007 ,
        1017.2711 , 1017.2711 , 1016.25525, 1016.25525, 1016.25525,
        1016.25525, 1016.25525, 1016.25525, 1016.25525, 1015.57794,
        1015.57794, 1015.57794, 1020.99615, 1020.99615, 1020.99615,
        1020.99615, 1020.99615, 1020.99615, 1016.25525, 1016.25525,
        1016.25525, 1016.25525, 1016.25525, 1016.25525, 1017.2711 ,
        1017.2711 , 1017.2711 , 1017.2711 , 1017.2711 , 1018.62573,
        1014.2234 , 1016.9325 , 1016.25525, 1016.25525, 1016.25525,
        1013.20746, 1013.20746, 1013.20746, 1013.20746, 1013.20746,
        1013.20746, 1013.20746, 1013.20746, 1013.20746, 1013.20746,
        1013.20746, 1013.20746, 1013.20746, 1020.65753, 1020.3189 ,
        1020.3189 , 1020.3189 , 1020.3189 , 1020.3189 , 1020.3189 ,
        1020.3189 ])}

Now we need to pull apart the data and perform some modifications, like converting winds to components and convert sky coverage percent to codes (octets) suitable for plotting.

In [7]:
import numpy as np

import metpy.calc as mpcalc
from metpy.units import units

# Since we used the CSV data, this is just a dictionary of arrays
lats = data['latitude']
lons = data['longitude']
tair = data['temperature']
dewp = data['dewpoint']
alt = data['altimeter_setting']

# Convert wind to components
u, v = mpcalc.wind_components(data['wind_speed'] * units.knots, data['wind_direction'] * units.degree)

# Need to handle missing (NaN) and convert to proper code
cloud_cover = 8 * data['sky_coverage'] / 100.
cloud_cover[np.isnan(cloud_cover)] = 10
cloud_cover = cloud_cover.astype(np.int)

# For some reason these come back as bytes instead of strings
stid = np.array([s.tostring().decode() for s in data['station']])
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/ipykernel_launcher.py:22: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.

Create the map using cartopy and MetPy!

One way to create station plots with MetPy is to create an instance of StationPlot and call various plot methods, like plot_parameter, to plot arrays of data at locations relative to the center point.

In addition to plotting values, StationPlot has support for plotting text strings, symbols, and plotting values using custom formatting.

Plotting symbols involves mapping integer values to various custom font glyphs in our custom weather symbols font. MetPy provides mappings for converting WMO codes to their appropriate symbol. The sky_cover function below is one such mapping.

In [8]:
%matplotlib inline

import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt

from metpy.plots import StationPlot, sky_cover

# Set up a plot with map features
fig = plt.figure(figsize=(12, 12))
proj = ccrs.Stereographic(central_longitude=-95, central_latitude=35)
ax = fig.add_subplot(1, 1, 1, projection=proj)
ax.add_feature(cfeature.STATES, edgecolor='black')
ax.coastlines(resolution='50m')
ax.gridlines()

# Create a station plot pointing to an Axes to draw on as well as the location of points
stationplot = StationPlot(ax, lons, lats, transform=ccrs.PlateCarree(),
                          fontsize=12)
stationplot.plot_parameter('NW', tair, color='red')

# Add wind barbs
stationplot.plot_barb(u, v)

# Plot the sky cover symbols in the center. We give it the integer code values that
# should be plotted, as well as a mapping class that can convert the integer values
# to the appropriate font glyph.
stationplot.plot_symbol('C', cloud_cover, sky_cover)
Out[8]:
TextCollection

Notice how there are so many overlapping stations? There's a utility in MetPy to help with that: reduce_point_density. This returns a mask we can apply to data to filter the points.

In [9]:
# Project points so that we're filtering based on the way the stations are laid out on the map
proj = ccrs.Stereographic(central_longitude=-95, central_latitude=35)
xy = proj.transform_points(ccrs.PlateCarree(), lons, lats)

# Reduce point density so that there's only one point within a 200km circle
mask = mpcalc.reduce_point_density(xy, 200000)

Now we just plot with arr[mask] for every arr of data we use in plotting.

In [10]:
# Set up a plot with map features
fig = plt.figure(figsize=(12, 12))
ax = fig.add_subplot(1, 1, 1, projection=proj)
ax.add_feature(cfeature.STATES, edgecolor='black')
ax.coastlines(resolution='50m')
ax.gridlines()

# Create a station plot pointing to an Axes to draw on as well as the location of points
stationplot = StationPlot(ax, lons[mask], lats[mask], transform=ccrs.PlateCarree(),
                          fontsize=12)
stationplot.plot_parameter('NW', tair[mask], color='red')
stationplot.plot_barb(u[mask], v[mask])
stationplot.plot_symbol('C', cloud_cover[mask], sky_cover)
Out[10]:
TextCollection

More examples for MetPy Station Plots:

EXERCISE:
  • Modify the station plot (reproduced below) to include dewpoint, altimeter setting, as well as the station id. The station id can be added using the `plot_text` method on `StationPlot`.
  • Re-mask the data to be a bit more finely spaced, say: 75km
  • Bonus Points: Use the `formatter` argument to `plot_parameter` to only plot the 3 significant digits of altimeter setting. (Tens, ones, tenths)
In [11]:
# Use reduce_point_density

# Set up a plot with map features
fig = plt.figure(figsize=(12, 12))
ax = fig.add_subplot(1, 1, 1, projection=proj)
ax.add_feature(cfeature.STATES, edgecolor='black')
ax.coastlines(resolution='50m')
ax.gridlines()

# Create a station plot pointing to an Axes to draw on as well as the location of points

# Plot dewpoint

# Plot altimeter setting--formatter can take a function that formats values

# Plot station id
Out[11]:
<cartopy.mpl.gridliner.Gridliner at 0x7f5760c16150>
In [12]:
# %load solutions/reduce_density.py


# Cell content replaced by load magic replacement.
# Use reduce_point_density
mask = mpcalc.reduce_point_density(xy, 75000)

# Set up a plot with map features
fig = plt.figure(figsize=(12, 12))
ax = fig.add_subplot(1, 1, 1, projection=proj)
ax.add_feature(cfeature.STATES, edgecolor='black')
ax.coastlines(resolution='50m')
ax.gridlines()

# Create a station plot pointing to an Axes to draw on as well as the location of points
stationplot = StationPlot(ax, lons[mask], lats[mask], transform=ccrs.PlateCarree(),
                          fontsize=12)
stationplot.plot_parameter('NW', tair[mask], color='tab:red')
stationplot.plot_barb(u[mask], v[mask])
stationplot.plot_symbol('C', cloud_cover[mask], sky_cover)

# Plot dewpoint
stationplot.plot_parameter('SW', dewp[mask], color='tab:green')

# Plot altimeter setting
stationplot.plot_parameter('NE', alt[mask], color='tab:blue',
                           formatter=lambda v: str(int(v * 10))[-3:])

# Plot station id
stationplot.plot_text((2, 0), stid[mask])
Out[12]:
TextCollection

Top


3. Time Series request and plot

  • Let's say we want the past days worth of data...
  • ...for Boulder (i.e. the lat/lon)
  • ...for the variables mean sea level pressure, air temperature, wind direction, and wind_speed
In [13]:
from datetime import timedelta

# define the time range we are interested in
end_time = datetime(2017, 9, 12, 0)
start_time = end_time - timedelta(days=2)

# build the query
query = ncss.query()
query.lonlat_point(-80.25, 25.8)
query.time_range(start_time, end_time)
query.variables('altimeter_setting', 'temperature', 'dewpoint',
                'wind_direction', 'wind_speed')
query.accept('csv')
Out[13]:
var=temperature&var=wind_speed&var=wind_direction&var=dewpoint&var=altimeter_setting&time_start=2017-09-10T00%3A00%3A00&time_end=2017-09-12T00%3A00%3A00&longitude=-80.25&latitude=25.8&accept=csv

Let's get the data!

In [14]:
data = ncss.get_data(query)
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/siphon/ncss.py:433: VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.
  converters={'date': lambda s: parse_iso_date(s.decode('utf-8'))})
In [15]:
print(list(data.keys()))
['time', 'station', 'latitude', 'longitude', 'temperature', 'wind_speed', 'wind_direction', 'dewpoint', 'altimeter_setting']

What station did we get?

In [16]:
station_id = data['station'][0].tostring()
print(station_id)
b'KMIA'
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/ipykernel_launcher.py:1: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  """Entry point for launching an IPython kernel.

That indicates that we have a Python bytes object, containing the 0-255 values corresponding to 'K', 'M', 'I', 'A'. We can decode those bytes into a string:

In [17]:
station_id = station_id.decode('ascii')
print(station_id)
KMIA

Let's get the time into datetime objects. We see we have an array with byte strings in it, like station id above.

In [18]:
data['time']
Out[18]:
array([b'2017-09-10T00:13:00Z', b'2017-09-10T00:19:00Z',
       b'2017-09-10T00:19:00Z', b'2017-09-10T00:44:00Z',
       b'2017-09-10T00:50:00Z', b'2017-09-10T00:53:00Z',
       b'2017-09-10T00:56:00Z', b'2017-09-10T01:08:00Z',
       b'2017-09-10T01:26:00Z', b'2017-09-10T01:53:00Z',
       b'2017-09-10T02:53:00Z', b'2017-09-10T03:28:00Z',
       b'2017-09-10T03:40:00Z', b'2017-09-10T03:53:00Z',
       b'2017-09-10T04:53:00Z', b'2017-09-10T05:44:00Z',
       b'2017-09-10T05:53:00Z', b'2017-09-10T06:07:00Z',
       b'2017-09-10T06:53:00Z', b'2017-09-10T07:53:00Z',
       b'2017-09-10T08:21:00Z', b'2017-09-10T08:41:00Z',
       b'2017-09-10T08:53:00Z', b'2017-09-10T09:53:00Z',
       b'2017-09-10T10:28:00Z', b'2017-09-10T10:41:00Z',
       b'2017-09-10T10:53:00Z', b'2017-09-10T11:02:00Z',
       b'2017-09-10T11:16:00Z', b'2017-09-10T11:33:00Z',
       b'2017-09-10T11:53:00Z', b'2017-09-10T12:07:00Z',
       b'2017-09-10T12:16:00Z', b'2017-09-10T12:31:00Z',
       b'2017-09-10T12:53:00Z', b'2017-09-10T13:19:00Z',
       b'2017-09-10T13:27:00Z', b'2017-09-10T13:53:00Z',
       b'2017-09-10T14:53:00Z', b'2017-09-10T15:53:00Z',
       b'2017-09-10T16:53:00Z', b'2017-09-10T17:53:00Z',
       b'2017-09-10T18:53:00Z', b'2017-09-10T19:53:00Z',
       b'2017-09-10T20:53:00Z', b'2017-09-10T21:53:00Z',
       b'2017-09-10T22:53:00Z', b'2017-09-10T23:53:00Z',
       b'2017-09-11T00:53:00Z', b'2017-09-11T01:53:00Z',
       b'2017-09-11T02:53:00Z', b'2017-09-11T03:53:00Z',
       b'2017-09-11T04:53:00Z', b'2017-09-11T05:53:00Z',
       b'2017-09-11T06:53:00Z', b'2017-09-11T07:53:00Z',
       b'2017-09-11T08:53:00Z', b'2017-09-11T09:53:00Z',
       b'2017-09-11T10:53:00Z', b'2017-09-11T11:53:00Z',
       b'2017-09-11T12:53:00Z', b'2017-09-11T13:53:00Z',
       b'2017-09-11T14:53:00Z', b'2017-09-11T15:53:00Z',
       b'2017-09-11T16:53:00Z', b'2017-09-11T17:53:00Z',
       b'2017-09-11T18:01:00Z', b'2017-09-11T18:53:00Z',
       b'2017-09-11T19:53:00Z', b'2017-09-11T19:53:00Z',
       b'2017-09-11T20:53:00Z', b'2017-09-11T20:53:00Z',
       b'2017-09-11T21:53:00Z', b'2017-09-11T22:53:00Z',
       b'2017-09-11T23:53:00Z', b'2017-09-11T23:53:00Z'], dtype='|S20')

So we can use a list comprehension to turn this into a list of date time objects:

In [19]:
time = [datetime.strptime(s.decode('ascii'), '%Y-%m-%dT%H:%M:%SZ') for s in data['time']]

Now for the obligatory time series plot...

In [20]:
from matplotlib.dates import DateFormatter, AutoDateLocator

fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(time, data['wind_speed'], color='tab:blue')

ax.set_title(f'Site: {station_id}      Date: {time[0]:%Y/%m/%d}')
ax.set_xlabel('Hour of day')
ax.set_ylabel('Wind Speed')
ax.grid(True)

# Improve on the default ticking
locator = AutoDateLocator()
hoursFmt = DateFormatter('%H')
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(hoursFmt)
EXERCISE:
  • Pick a different location
  • Plot temperature and dewpoint together on the same plot
In [21]:
# Your code goes here
In [22]:
# %load solutions/time_series.py

# Cell content replaced by load magic replacement.
# define the time range we are interested in
end_time = datetime(2017, 9, 12, 0)
start_time = end_time - timedelta(days=2)

# build the query
query = ncss.query()
query.lonlat_point(-155.1, 19.7)
query.time_range(start_time, end_time)
query.variables('altimeter_setting', 'temperature', 'dewpoint',
                'wind_direction', 'wind_speed')
query.accept('csv')

data = ncss.get_data(query)

station_id = data['station'][0].tostring()
station_id = station_id.decode('ascii')

time = [datetime.strptime(s.decode('ascii'), '%Y-%m-%dT%H:%M:%SZ') for s in data['time']]

fig, ax = plt.subplots(figsize=(10, 6))
ax.plot(time, data['temperature'], color='tab:red')
ax.plot(time, data['dewpoint'], color='tab:green')

ax.set_title(f'Site: {station_id}      Date: {time[0]:%Y/%m/%d}')
ax.set_xlabel('Hour of day')
ax.set_ylabel('Temperature/Dewpoint')
ax.grid(True)

# Improve on the default ticking
locator = AutoDateLocator()
hoursFmt = DateFormatter('%H')
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(hoursFmt)
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/siphon/ncss.py:433: VisibleDeprecationWarning: Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.
  converters={'date': lambda s: parse_iso_date(s.decode('utf-8'))})
/home/travis/miniconda/envs/unidata/lib/python3.7/site-packages/ipykernel_launcher.py:18: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.

Top