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

FIX: A fix for vpt mismatch array error for matplotlib shading. #1381

Merged
merged 4 commits into from
Jan 24, 2023
Merged
Changes from 2 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
10 changes: 10 additions & 0 deletions pyart/graph/radardisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ def plot_vpt(
if time_axis_flag:
self._set_vpt_time_axis(ax, date_time_form=date_time_form, tz=tz)
times = datetimes_from_radar(self._radar)
if edges:
times = _edge_time(times)
x = times.astype("datetime64[ns]")

# mask the data where outside the limits
Expand Down Expand Up @@ -1778,3 +1780,11 @@ def _mask_outside(flag, data, v1, v2):
data = np.ma.masked_invalid(data)
data = np.ma.masked_outside(data, v1, v2)
return data


def _edge_time(times):
"""Appends the last time with the added subtraction of the last two
times in the time array."""
timedelta = times[-1] - times[-2]
edge_time = times[-1] + timedelta
return np.append(times, edge_time)