Skip to content

Commit

Permalink
add the option of plotting original track to plot_selected_percentile…
Browse files Browse the repository at this point in the history
…s function
  • Loading branch information
FariborzDaneshvar-NOAA authored and SorooshMani-NOAA committed Aug 7, 2024
1 parent 1c4b5d7 commit 6bf3d80
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion ensembleperturbation/plotting/surrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from matplotlib.colors import Normalize
from matplotlib.figure import Figure
import numpy
from stormevents.nhc import VortexTrack
import xarray

from ensembleperturbation.plotting.geometry import plot_points, plot_surface
Expand Down Expand Up @@ -455,7 +456,10 @@ def plot_selected_validations(


def plot_selected_percentiles(
node_percentiles: xarray.Dataset, perc_list: list, output_directory: PathLike
node_percentiles: xarray.Dataset,
perc_list: list,
output_directory: PathLike,
storm: str = None,
):
percentiles = node_percentiles.quantiles

Expand Down Expand Up @@ -515,6 +519,20 @@ def plot_selected_percentiles(
map_axis.set_xlim(xlim)
map_axis.set_ylim(ylim)

if storm is not None:
if not isinstance(storm, VortexTrack):
try:
storm = VortexTrack.from_file(storm)
except FileNotFoundError:
storm = VortexTrack(storm)

map_axis.plot(
storm.data['longitude'], storm.data['latitude'], 'k--', label=storm.name,
)

if storm.name is not None:
map_axis.legend(fontsize=6)

pyplot.subplots_adjust(wspace=0.02, right=0.96)
cax = pyplot.axes([0.95, 0.55, 0.015, 0.3])
cbar = figure.colorbar(im, extend='both', cax=cax)
Expand Down

0 comments on commit 6bf3d80

Please sign in to comment.