示例#1
0
    def append_fields(self, names, arr, dtypes=None, units=None,
        descriptions=None):
        # This makes the names now a list of tuples of names and titles,
        # so that the dtype constructor can use them
        self.units.update(zip(names, units))

        names = zip(descriptions, names)
        self._data = append_fields(self._data, names, arr, dtypes)
示例#2
0
    def append_fields(self,
                      names,
                      arr,
                      dtypes=None,
                      units=None,
                      descriptions=None):
        # This makes the names now a list of tuples of names and titles,
        # so that the dtype constructor can use them
        self.units.update(zip(names, units))

        names = zip(descriptions, names)
        self._data = append_fields(self._data, names, arr, dtypes)
示例#3
0
                   h_convergence)
from metpy import remote_mesonet_data
from metpy.constants import C2F
from metpy.cbook import append_fields
from metpy.vis import station_plot
from metpy.tools.oban import gaussian_filter

# TODO: Find a way to fix the bad convergence values at the edge of the
# masked data
data = read_mesonet_data('data/200905082110.mdf',
                         fields=('STID', 'TIME', 'TAIR', 'RELH', 'WSPD',
                                 'WDIR'))

#Calculate dewpoint in F from relative humidity and temperature
dewpt = C2F(dewpoint(data['TAIR'], data['RELH'] / 100.))
data = append_fields(data, ('dewpoint', ), (dewpt, ))

#Convert temperature and dewpoint to Farenheit
data['TAIR'] = C2F(data['TAIR'])

u, v = get_wind_components(data['WSPD'], data['WDIR'])
data = append_fields(data, ('u', 'v'), (u, v))

fig = plt.figure(figsize=(20, 12))
ax = fig.add_subplot(1, 1, 1)
m = Basemap(lon_0=-99,
            lat_0=35,
            lat_ts=35,
            resolution='i',
            projection='stere',
            urcrnrlat=37.,
示例#4
0
from metpy import (read_mesonet_data, dewpoint, get_wind_components,
    h_convergence)
from metpy import remote_mesonet_data
from metpy.constants import C2F
from metpy.cbook import append_fields
from metpy.vis import station_plot
from metpy.tools.oban import gaussian_filter

# TODO: Find a way to fix the bad convergence values at the edge of the
# masked data
data = read_mesonet_data('data/200905082110.mdf',
    fields=('STID', 'TIME', 'TAIR', 'RELH', 'WSPD', 'WDIR'))

#Calculate dewpoint in F from relative humidity and temperature
dewpt = C2F(dewpoint(data['TAIR'], data['RELH']/100.))
data = append_fields(data, ('dewpoint',), (dewpt,))

#Convert temperature and dewpoint to Farenheit
data['TAIR'] = C2F(data['TAIR'])

u,v = get_wind_components(data['WSPD'], data['WDIR'])
data = append_fields(data, ('u', 'v'), (u, v))

fig = plt.figure(figsize=(20,12))
ax = fig.add_subplot(1,1,1)
m = Basemap(lon_0=-99, lat_0=35, lat_ts=35, resolution='i',
    projection='stere', urcrnrlat=37., urcrnrlon=-94.25, llcrnrlat=33.7,
    llcrnrlon=-103., ax=ax)
m.bluemarble()

#Objectively analyze wind components