Skip to content

Commit

Permalink
Merge pull request #426 from dtcenter/bugfix_425_tcrmw_cross_section
Browse files Browse the repository at this point in the history
issue # 425, make fixes to the contour plot for the Z value to remove…
  • Loading branch information
hankenstein2 authored Mar 20, 2024
2 parents ecf6340 + 3714d32 commit 0251093
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/Users_Guide/tcrmw_cross_section.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======
Expand Down
12 changes: 10 additions & 2 deletions metplotpy/contributed/tc_rmw/plot_cross_section.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 0251093

Please sign in to comment.