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

Feature/rmax psurgev29 #154

Merged
merged 48 commits into from
Aug 8, 2024
Merged

Feature/rmax psurgev29 #154

merged 48 commits into from
Aug 8, 2024

Conversation

SorooshMani-NOAA
Copy link
Collaborator

@SorooshMani-NOAA SorooshMani-NOAA commented Aug 7, 2024

Rebased #139 after CI fix.

WPringle added 30 commits August 7, 2024 12:25
…s the other variables and renaming legacy method for RMW to RadiustoMaximumWindsPersistent
…ate between the two RadiusOfMaximumWind options
…on changed Vmax, Rmax, and track using the GAHM profile
…ximumSustainedWindSpeed class and including a lower_bound to prevent low and negative values
…ranslation_speed output from the radial Vmax function to be used in Vr calculation
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 37.58389% with 93 lines in your changes missing coverage. Please review.

Project coverage is 20.96%. Comparing base (43e3f4b) to head (69c1ebb).
Report is 2 commits behind head on main.

Files Patch % Lines
ensembleperturbation/perturbation/atcf.py 26.82% 90 Missing ⚠️
ensembleperturbation/utilities.py 33.33% 2 Missing ⚠️
ensembleperturbation/parsing/adcirc.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
+ Coverage   20.82%   20.96%   +0.13%     
==========================================
  Files          28       28              
  Lines        3846     3983     +137     
==========================================
+ Hits          801      835      +34     
- Misses       3045     3148     +103     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@WPringle WPringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests went through on my machine locally, and producing same results as in my fork, so LGTM!

"cross_track": NaN,
"along_track": NaN,
"max_sustained_wind_speed": NaN,
"radius_of_maximum_winds_persistent": NaN,
"weight": 1.0
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to distinguish original (NaN) with a perturbed track with a 0.0 perturbation value. These should usually be equivalent but the isotach perturbation method can change isotachs from the original to match with GAHM profile.

@@ -2,6 +2,6 @@
"cross_track": -1.2815515655446004,
"along_track": 0.5244005127080407,
"max_sustained_wind_speed": 1.2815515655446004,
"radius_of_maximum_winds": -0.4,
"radius_of_maximum_winds_persistent": -0.4,
"weight": 1.0
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to distinguish between the RMW forecast with Gaussian distribution errors and the persistent RMW assumption (same as initial value all the way through to the end of forecast) with Uniform distribution errors

AlongTrack,
MaximumSustainedWindSpeed,
RadiusOfMaximumWindsPersistent,
]

perturbations = perturb_tracks(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing file in this test uses the persistent RMW assumption. Need to add option to get out a persistent RMW forecast from StormEvents.

CrossTrack,
AlongTrack,
MaximumSustainedWindSpeed,
RadiusOfMaximumWinds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This online advisory test will get the track with RMW forecast from StormEvents

@@ -340,15 +365,118 @@ def __init__(self):
unit=units.knot,
)

def radial_Vmax_at_BL(self, dataframe: DataFrame) -> Quantity:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New function in Vmax class to get the radial Vmax after subtracting the translation speed and taking value up to the top of the BL

B = self.find_parameter_from_GAHM_profile(
Vr_old, Vmax_old, f_old, Roinv_old, B=B_ini, isotach_rad=isotach_rad, Rrat=Rrat
)
# correct where B is nan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible B is NaN because no solution can be found connecting from Vmax at RMW to Vr at r, or if no initial isotach is given. In this case we just replace B with the initial guess. This means we can potentially find solutions for the perturbed isotach (non-zero) even if no initial isotach is given, which can occur e.g. if the perturbation increases Vmax.

invalid = numpy.isnan(Rrat)
Rrat[invalid] = Vr_new[invalid] / Vmax_new[invalid]
Rrat[abs(Rrat - 1.0) < 1e-3] = 0.999 # ensure not exactly 1
Rrat[Vr_new > Vmax_new] = numpy.nan # if Vr is stronger than Vmax then ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isotach is not compatible with the perturbed Vmax value, which likely occurs if the perturbed Vmax is decreased from the original value.

Rrat = Rmax_new / isotach_rad
# correct where Rrat is nan
invalid = numpy.isnan(Rrat)
Rrat[invalid] = Vr_new[invalid] / Vmax_new[invalid]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If isotach_rad is zero (NaN) then the guess for Rrat will be NaN so this correction allows for a non-zero guess and non-zero solution to be potentially be found for the pertubed isotach radius.

# enter if it is not the original unperturbed file
if any(~numpy.isnan(list(perturbation.values()))):
# Compute potential changes in the central pressure in accordance with Holland B relationship
dataframe[CentralPressure.name] = self.compute_pc_from_Vmax(dataframe)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the central pressure change in accordance with Vmax change outside of variable perturbation loop where it was called after Vmax was perturbated. It is possible the small change in trajectory can affect the radial Vmax and hence the central pressure, so this change will mean the function call is not dependent on order of perturbation (Vmax before or after along_track and cross_track perturbations).

# Compute potential changes in the central pressure in accordance with Holland B relationship
dataframe[CentralPressure.name] = self.compute_pc_from_Vmax(dataframe)

# Compute potential changes to r34/50,64 radii at all quadrants in accordance with the GAHM profile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Called outside of variable perturbation loop as changes to any of Vmax, RMW and trajectory can affect how the isotach radii are perturbed.

@SorooshMani-NOAA SorooshMani-NOAA marked this pull request as ready for review August 8, 2024 20:41
@WPringle
Copy link
Contributor

WPringle commented Aug 8, 2024

Why was merged again?

@SorooshMani-NOAA
Copy link
Collaborator Author

SorooshMani-NOAA commented Aug 8, 2024

Why was merged again?

I guess your question is about the email you got about the other similar PR (#139) which I closed. The other merge was your own branch on your fork, I just rebased that one based on the latest ensemble perturbation and then pushed it to the main repo (since I couldn't push to your fork). Then I created this new PR for the branch on main repo to be merged (see #139 (comment))

Do you see any issues?

@WPringle
Copy link
Contributor

WPringle commented Aug 8, 2024

No, should be good..

@SorooshMani-NOAA SorooshMani-NOAA merged commit 2cd962e into main Aug 8, 2024
10 checks passed
@SorooshMani-NOAA SorooshMani-NOAA deleted the feature/rmax_Psurgev29 branch August 8, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants