From da8f2417d125ae8cbf17b6ebd25d9b946582e023 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 19 May 2021 17:48:24 -0600 Subject: [PATCH 1/2] Per #1798, fix up the read_tmpe_dataplane.py script to handle a grid string or dictionary. --- met/data/wrappers/read_tmp_dataplane.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/met/data/wrappers/read_tmp_dataplane.py b/met/data/wrappers/read_tmp_dataplane.py index 09e2530ef0..98bbe728d8 100644 --- a/met/data/wrappers/read_tmp_dataplane.py +++ b/met/data/wrappers/read_tmp_dataplane.py @@ -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 From 6cd8b54a90d554ecfd5f301ea020a20430adf175 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 19 May 2021 18:09:37 -0600 Subject: [PATCH 2/2] Per #1798, add a test to unit_python.xml to exercise this bugfix. --- test/xml/unit_python.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/xml/unit_python.xml b/test/xml/unit_python.xml index 572e2f925d..801fe16b2d 100644 --- a/test/xml/unit_python.xml +++ b/test/xml/unit_python.xml @@ -374,6 +374,26 @@ + + + &MET_BIN;/plot_data_plane + + MET_PYTHON_EXE &MET_PYTHON_EXE; + PYTHON_GRID G212 + + \ + 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 + + + &OUTPUT_DIR;/python/letter_numpy_grid_name_user_python.ps + + + &MET_BIN;/ascii2nc