Skip to content

Commit

Permalink
Per #1798, fix up the read_tmpe_dataplane.py script to handle a grid …
Browse files Browse the repository at this point in the history
…string or dictionary. (#1799)
  • Loading branch information
JohnHalleyGotway authored May 20, 2021
1 parent 3becf7e commit cba7377
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions met/data/wrappers/read_tmp_dataplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@
ds = nc.Dataset(netcdf_filename, 'r')
met_data = ds['met_data'][:]
met_attrs = {}

# grid is defined as a dictionary or string
grid = {}
for attr, attr_val in ds.__dict__.items():
if 'grid' in attr:
if 'grid.' in attr:
grid_attr = attr.split('.')[1]
grid[grid_attr] = attr_val
else:
met_attrs[attr] = attr_val
met_attrs['grid'] = grid

if grid:
met_attrs['grid'] = grid

met_attrs['name'] = met_attrs['name_str']
del met_attrs['name_str']
met_info['met_data'] = met_data
Expand Down

0 comments on commit cba7377

Please sign in to comment.