From bd7ea14ddf5bdcdcc1652a33a754b4eca6020bb4 Mon Sep 17 00:00:00 2001 From: bikegeek Date: Tue, 5 Mar 2024 22:53:14 +0000 Subject: [PATCH 1/3] issue # 425, make fixes to the contour plot for the Z value to remove the mismatch in dimensions that result in TypeError --- metplotpy/contributed/tc_rmw/plot_cross_section.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) mode change 100644 => 100755 metplotpy/contributed/tc_rmw/plot_cross_section.py diff --git a/metplotpy/contributed/tc_rmw/plot_cross_section.py b/metplotpy/contributed/tc_rmw/plot_cross_section.py old mode 100644 new mode 100755 index ef11ba2c..c8a84404 --- a/metplotpy/contributed/tc_rmw/plot_cross_section.py +++ b/metplotpy/contributed/tc_rmw/plot_cross_section.py @@ -51,17 +51,25 @@ def plot_cross_section(config, data_set, args): field = data_set[config['field']] itime = config['index_time_slice'] - field_azi_mean = np.mean(field, axis=1)[:, :, itime] + # originally, axis=1 but the order of dimensions was modified + # (Github issue:https://github.com/dtcenter/METcalcpy/issues/308) + field_azi_mean = np.mean(field, axis=0)[:, :, itime] + + + # originally, the transpose of the field_azi_mean was used, but this is no + # longer necessary. If the transpose is used, the dimensions are incorrect + # and a TypeError will be raised by the contour plot. scalar_contour = ax.contour(data_set['range'], data_set[config['vertical_coord_name']], - field_azi_mean.transpose(), + field_azi_mean, levels=np.arange(config['contour_level_start'], config['contour_level_end'], config['contour_level_stepsize']), colors=config['contour_line_colors'], linewidths=(config['line_width']) ) + plt.title(config['plot_title']) ax.clabel(scalar_contour, colors=config['contour_label_color'], fmt=config['contour_label_fmt']) ax.set_xlabel(config['x_label']) From 63814409c893fa417954c58a68432cfe5cab3f4c Mon Sep 17 00:00:00 2001 From: bikegeek <3753118+bikegeek@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:15:07 -0600 Subject: [PATCH 2/3] Update tcrmw_cross_section.rst Emphasize the required fields in the input data --- docs/Users_Guide/tcrmw_cross_section.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Users_Guide/tcrmw_cross_section.rst b/docs/Users_Guide/tcrmw_cross_section.rst index 50c575a5..5fc96eaf 100644 --- a/docs/Users_Guide/tcrmw_cross_section.rst +++ b/docs/Users_Guide/tcrmw_cross_section.rst @@ -10,6 +10,7 @@ from the METcalcpy vertical interpolation module, *vertical_interpolation.py*: https://metcalcpy.readthedocs.io/en/develop/Users_Guide/vertical_interpolation.html +**NOTE** Data must have the following **required fields**: **temperature**, **relative humidity**, and **surface pressure**. These are required by the METcalcpy vertical_interpolation module to compute pressure indices. Example ======= From 3714d323e9fec2e24d37de8cbaa2650ad170e19a Mon Sep 17 00:00:00 2001 From: bikegeek <3753118+bikegeek@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:15:44 -0600 Subject: [PATCH 3/3] Update tcrmw_cross_section.rst Add colon after the NOTE --- docs/Users_Guide/tcrmw_cross_section.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Users_Guide/tcrmw_cross_section.rst b/docs/Users_Guide/tcrmw_cross_section.rst index 5fc96eaf..0b3078fc 100644 --- a/docs/Users_Guide/tcrmw_cross_section.rst +++ b/docs/Users_Guide/tcrmw_cross_section.rst @@ -10,7 +10,7 @@ from the METcalcpy vertical interpolation module, *vertical_interpolation.py*: https://metcalcpy.readthedocs.io/en/develop/Users_Guide/vertical_interpolation.html -**NOTE** Data must have the following **required fields**: **temperature**, **relative humidity**, and **surface pressure**. These are required by the METcalcpy vertical_interpolation module to compute pressure indices. +**NOTE**:Data must have the following **required fields**: **temperature**, **relative humidity**, and **surface pressure**. These are required by the METcalcpy vertical_interpolation module to compute pressure indices. Example =======