Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kgoebber committed Dec 30, 2019
1 parent e41c53e commit f8b63c0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/metpy/plots/declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,9 +1280,8 @@ class PlotObs(HasTraits):
* fields
* locations (optional)
* time_range (optional)
* formatters (optional)
* formats (optional)
* colors (optional)
* symbol_mapper (optional)
* vector_field (optional)
* vector_field_color (optional)
* reduce_points (optional)
Expand Down Expand Up @@ -1410,14 +1409,21 @@ def name(self):
@property
def obsdata(self):
"""Return the internal cached data."""
time_vars = ['valid', 'time', 'valid_time']
stn_vars = ['station', 'stn']
time_vars = ['valid', 'time', 'valid_time', 'date_time', 'date']
stn_vars = ['station', 'stn', 'station_id', 'stid']
if getattr(self, '_obsdata', None) is None:
for dim_name in list(self.data):
if dim_name in time_vars:
dim_time = dim_name
elif dim_name in stn_vars:
dim_stn = dim_name
dim_times = [time_var for time_var in time_vars if time_var in list(self.data)]
dim_stns = [stn_var for stn_var in stn_vars if stn_var in list(self.data)]
if not dim_times:
raise AttributeError('Time variable not found. Valid variable names are:'
f'{time_vars}')
else:
dim_time = dim_times[0]
if not dim_stns:
raise AttributeError('Station variable not found. Valid variable names are: '
f'{stn_vars}')
else:
dim_stn = dim_stns[0]
if self.level is not None:
level_subset = self.data.pressure == self.level.m
self._obsdata = self.data[level_subset]
Expand Down

0 comments on commit f8b63c0

Please sign in to comment.