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

Extrapolate landice variable #576

Merged
merged 12 commits into from
Sep 9, 2024

Conversation

trhille
Copy link
Collaborator

@trhille trhille commented Jul 9, 2024

Add a script to extrapolate landice variables into regions of missing or invalid data using nearest-neighbor or inverse-distance weighted methods.

trhille and others added 7 commits February 1, 2021 17:57
Not dependent on exo to mpas conversion script
Depending on which field you want to extrapolate, use grounded or floating
mask to define the values that are kept.
Also do not allow any zero-valued cells in keepMask
Add option to set all cells outside keepCellMask to a specific value
Ensure that very large or infinite values are removed during extrapolation.
The entire masking and extrapolation logic has been moved into a loop
over vertical levels.  It seemed conceivable that the masking criteria
could differ between different levels of the same variable, which is why
the masking operation is also moved inside the vertical level loop.
@xylar
Copy link
Collaborator

xylar commented Jul 9, 2024

@trhille, CI is breaking for reasons unrelated to your script. Someone accidentally released matplotlib 3.9.0 on conda-forge a few days back and did a bunch of upgrading to support it. It turned out they jumped the gun and they moved that release off the main conda-forge channel so now it can't be installed without a lot of extra hassle. I was hoping the actual release would happen but that also doesn't seem to have happened.

Anyway, I'll fix it if it becomes critical before they actually release the new version.

@trhille
Copy link
Collaborator Author

trhille commented Jul 9, 2024

Thanks, @xylar. This script has been lying around on a branch for years, and we decided that it has ended up with enough use cases that we'll merge it, but it's not at all time-sensitive.

If thickness and bedTopography are not in file, define keepMask where
floatingBasalMassBal != 0.
@trhille trhille force-pushed the landice/extrapolate_variable branch from b1c260a to 6ad55be Compare July 9, 2024 21:44
Remove lines that were intended to set the extrapolation method
based on the variable being extrapolated, which contained typos.
These were removed instead of just fixing the typos because it doesn't
make sense to override the method option passed from the command line.
@xylar
Copy link
Collaborator

xylar commented Aug 1, 2024

I'm going to close and re-open to cause CI to restart.

@xylar xylar closed this Aug 1, 2024
@xylar xylar reopened this Aug 1, 2024
Copy link
Member

@matthewhoffman matthewhoffman left a comment

Choose a reason for hiding this comment

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

@trhille , thanks for formalizing this script. I have a few comments - feel free to take or leave. The script works as-is and I don't want to drag this out.

landice/mesh_tools_li/extrapolate_variable.py Outdated Show resolved Hide resolved
landice/mesh_tools_li/extrapolate_variable.py Outdated Show resolved Hide resolved
landice/mesh_tools_li/extrapolate_variable.py Outdated Show resolved Hide resolved
# ensure zero muFriction does not get extrapolated
keepCellMask *= (varValue > 0)
# Get rid of invalid values
keepCellMask *= (varValue < 1.e12)
Copy link
Member

Choose a reason for hiding this comment

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

I think 1e12 seems big enough to avoid clipping any of the relevant fields any under situation. The worst case I can think of is mu for a very plastic bed, but even then I think this feels safe. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's safe, but will add it as a constant at the top of the script as with the densities.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in 8f7ef92

landice/mesh_tools_li/extrapolate_variable.py Outdated Show resolved Hide resolved
trhille and others added 3 commits August 19, 2024 09:33
Co-authored-by: Matt Hoffman <wyeast@gmail.com>
Co-authored-by: Matt Hoffman <wyeast@gmail.com>
Move constants to top of script, change some formatting for PEP8
compliance, and raise an exception if thicknes and/or bedTopography
are missing when extrapolating certain fields.
@matthewhoffman matthewhoffman merged commit e318e03 into MPAS-Dev:master Sep 9, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants