-
Notifications
You must be signed in to change notification settings - Fork 124
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
Shift cyclostrophic argument to model_kwargs in from_tracks #936
base: develop
Are you sure you want to change the base?
Conversation
This CLIMADA-project/climada_petals@cfba26b should fix the test error for climada petal. |
Has anyone reviewed this? |
Not that I know, feel free to do it :) |
Ok, thanks! I will see if I can do it soon. Next time please assign someone to the PR to review, or ask us to assign someone. |
Thank you Sam! 👍 a few remarks:
I will break the line 244 in trop_cyclone.py to avoid the pylint warning: "line to long". Along the same lines, I will update the test to cover the Nice that you fixed the compatibility with petals! Other than that, looks good to me! |
@@ -100,7 +100,6 @@ def compute_angular_windspeeds( | |||
mask_centr_close: np.ndarray, | |||
model: int, | |||
model_kwargs: Optional[dict] = None, | |||
cyclostrophic: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proper way to deal with this is probably to mark the argument as deprecated rather than removing it right away. So we can keep it compatible.
If it is provided despite its deprecation insert it in model_kwargs
, e.g., like this:
if cyclostrophic is not None:
warnings.warn("yada yada", DeprecationWarning)
model_kwargs["cyclostrophic"] = cyclostrophic
changelog.md should mention this, because either a signature has changed or an argument got deprecated. |
DeprecationWarning, | ||
) | ||
model_kwargs["cyclostrophic"] = cyclostrophic | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proper way to deal with this is probably to mark the argument as deprecated rather than removing it right away. So we can keep it compatible. If it is provided despite its deprecation insert it in
model_kwargs
, e.g., like this:if cyclostrophic is not None: warnings.warn("yada yada", DeprecationWarning) model_kwargs["cyclostrophic"] = cyclostrophic
Like this @emanuel-schmid ? see also the other edits
Changes proposed in this PR:
from_tracks
from_tracks
compute_angular_windspeeds
and_compute_windfields
such that it uses the value in model_kwarg.LOGGER.debug
toLOGGER.warning
in_compute_angular_windspeeds_h10
to inform user thatcyclostrophic=False
is ignored in this caseThis last point is subject to debate, raising an error is also possible. The question then is, should it be raised rather in the top-level (i.e., in
from_tracks
) or low-level (i.e., in_compute_angular_windspeeds_h10
)--
This PR fixes #897
PR Author Checklist
develop
)PR Reviewer Checklist