Skip to content

Commit

Permalink
adding option for the penny et al (2023) rmw regression fill without …
Browse files Browse the repository at this point in the history
…the moving mean smoother
  • Loading branch information
WPringle committed Jan 22, 2025
1 parent d505a90 commit daea5f7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions stormevents/nhc/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class RMWFillMethod(Enum):
none = None
persistent = auto()
regression_penny_2023 = auto()
regression_penny_2023_no_smoothing = auto()


# Bias correction values for the Rmax forecast
Expand Down
5 changes: 4 additions & 1 deletion stormevents/nhc/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,10 @@ def movingmean(dff):
"radius_of_maximum_winds"
]

elif rmw_fill == RMWFillMethod.regression_penny_2023:
elif (
rmw_fill == RMWFillMethod.regression_penny_2023
or rmw_fill == RMWFillMethod.regression_penny_2023_no_smoothing
):
# fill OFCL maximum wind radius based on regression method from
# Penny et al. (2023). https://doi.org/10.1175/WAF-D-22-0209.1
isotach_radii = forecast[
Expand Down
19 changes: 18 additions & 1 deletion tests/test_nhc.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,24 @@ def test_rmw_fill_method_regression_penny_2023():
rmw = data.loc[data.track_start_time == data.track_start_time.unique()[i_uq_row]][
"radius_of_maximum_winds"
]
assert len(rmw.unique()) > 1
assert len(rmw.unique()) == 11


def test_rmw_fill_method_regression_penny_2023_no_smoothing():
tr_florence2018 = VortexTrack.from_storm_name(
"Florence",
2018,
file_deck="a",
advisories=["OFCL"],
rmw_fill=RMWFillMethod.regression_penny_2023_no_smoothing,
)
assert tr_florence2018.rmw_fill == RMWFillMethod.regression_penny_2023_no_smoothing
data = tr_florence2018.data
i_uq_row = 40
rmw = data.loc[data.track_start_time == data.track_start_time.unique()[i_uq_row]][
"radius_of_maximum_winds"
]
assert len(rmw.unique()) == 10


def test_rmw_fill_method_setvalue_invalid():
Expand Down

0 comments on commit daea5f7

Please sign in to comment.