Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 1798 develop py_grid_string #1800

Merged
merged 2 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 additions & 0 deletions test/xml/unit_python.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,26 @@
</output>
</test>

<!-- Invokes user-python logic to read a grid string -->
<test name="python_numpy_grid_name_user_python">
<exec>&MET_BIN;/plot_data_plane</exec>
<env>
<pair><name>MET_PYTHON_EXE</name> <value>&MET_PYTHON_EXE;</value></pair>
<pair><name>PYTHON_GRID</name> <value>G212</value></pair>
</env>
<param> \
PYTHON_NUMPY \
&OUTPUT_DIR;/python/letter_numpy_grid_name_user_python.ps \
'name = "&MET_BASE;/python/read_ascii_numpy_grid.py &DATA_DIR_PYTHON;/letter.txt LETTER";' \
-plot_range 0.0 255.0 \
-title "Grid Name: 'G212'" \
-v 1
</param>
<output>
<ps>&OUTPUT_DIR;/python/letter_numpy_grid_name_user_python.ps</ps>
</output>
</test>

<!-- Invokes user-python logic to read point data -->
<test name="python_ascii2nc_user_python">
<exec>&MET_BIN;/ascii2nc</exec>
Expand Down