-
Notifications
You must be signed in to change notification settings - Fork 1
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
Platform specific nt gradient thresholds #46
Merged
trey-stafford
merged 2 commits into
support-25km-platforms-ecdr
from
platform-specific-nt-gradient-thresholds
Feb 1, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
"""Gradient thresholds for the nasateam weather filter. | ||
""" | ||
from pm_tb_data._types import NORTH, SOUTH | ||
|
||
from pm_icecon.nt._types import NasateamGradientRatioThresholds | ||
from pm_icecon.errors import UnexpectedSatelliteError | ||
|
||
# These thresholds defined specifically for the CDR. These differ from thoes | ||
# defined by Goddard. | ||
# RSS is Remote Sensing Systems. Data from RSS is used for the Final CDR | ||
# (g02202) | ||
CDR_RSS_THRESHOLDS_NORTH = dict( | ||
f17=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
f13=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
f11=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
f08=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
n07=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.07, | ||
# This value ensures the threshold is never met for SMMR. | ||
# TODO: Better way to express this? `None`? | ||
"2219": 9999.9, | ||
} | ||
), | ||
) | ||
|
||
CDR_RSS_THRESHOLDS_SOUTH = dict( | ||
f17=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.057, | ||
"2219": 0.045, | ||
} | ||
), | ||
f13=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
f11=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
f08=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
), | ||
n07=NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.076, | ||
# This value ensures the threshold is never met for SMMR. | ||
# TODO: Better way to express this? `None`? | ||
"2219": 9999.9, | ||
} | ||
), | ||
) | ||
|
||
|
||
def get_cdr_rss_thresholds( | ||
*, hemisphere, platform: str | ||
) -> NasateamGradientRatioThresholds: | ||
"""Get Gradient thresholds for the CDR. | ||
|
||
Note that goddard specific thresholds are defined and used in the `test_nt` | ||
regression test file. | ||
""" | ||
rss_thresholds = { | ||
NORTH: CDR_RSS_THRESHOLDS_NORTH, | ||
SOUTH: CDR_RSS_THRESHOLDS_SOUTH, | ||
}[hemisphere] | ||
if platform not in rss_thresholds.keys(): | ||
raise UnexpectedSatelliteError( | ||
f"No {hemisphere[0].upper()}H thresholds defined for {platform=}." | ||
) | ||
platform = platform.lower() | ||
|
||
return rss_thresholds[platform] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,25 @@ | |
from pm_icecon.tests.regression import CDR_TESTDATA_DIR | ||
from pm_icecon.interpolation import spatial_interp_tbs | ||
from pm_icecon.nt.compute_nt_ic import goddard_nasateam | ||
from pm_icecon.nt.params.goddard_rss import ( | ||
RSS_F17_NORTH_GRADIENT_THRESHOLDS, | ||
RSS_F17_SOUTH_GRADIENT_THRESHOLDS, | ||
) | ||
from pm_icecon.nt.tiepoints import get_tiepoints | ||
from pm_icecon.util import get_ps25_grid_shape | ||
from pm_icecon.nt._types import NasateamGradientRatioThresholds | ||
|
||
|
||
RSS_GODDARD_F17_NORTH_GRADIENT_THRESHOLDS = NasateamGradientRatioThresholds( | ||
{ | ||
"3719": 0.050, | ||
"2219": 0.045, | ||
} | ||
) | ||
|
||
|
||
RSS_GODDARD_F17_SOUTH_GRADIENT_THRESHOLDS = NasateamGradientRatioThresholds( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These values from Goddard differ from the values we use for the CDR. Regression tests fail if we use the CDR values. |
||
{ | ||
"3719": 0.053, | ||
"2219": 0.045, | ||
} | ||
) | ||
|
||
|
||
def _get_ps25_sst_mask( | ||
|
@@ -110,9 +123,9 @@ def _get_minic(*, hemisphere: Hemisphere): | |
minic=_get_minic(hemisphere=hemisphere), | ||
invalid_ice_mask=invalid_ice_mask, | ||
gradient_thresholds=( | ||
RSS_F17_NORTH_GRADIENT_THRESHOLDS | ||
RSS_GODDARD_F17_NORTH_GRADIENT_THRESHOLDS | ||
if hemisphere == "north" | ||
else RSS_F17_SOUTH_GRADIENT_THRESHOLDS | ||
else RSS_GODDARD_F17_SOUTH_GRADIENT_THRESHOLDS | ||
), | ||
tiepoints=get_tiepoints(satellite="17_final", hemisphere=hemisphere), | ||
) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These gradient thresholds are specific to the CDR, so I added a note here and made the variable and function names explicit.