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

Flexible interpolation ("regridding") using YAC #546

Draft
wants to merge 61 commits into
base: dev
Choose a base branch
from

Conversation

ckhroulev
Copy link
Member

This PR contains changes needed to implement flexible interpolation. The goal is to reduce the amount of pre-processing needed to run PISM with some publicly available datasets, e.g. bed topography and RCM outputs.

Once this work is finished, users will be able to

  • Conservatively regrid (-regrid_file XXX.nc -regrid_vars YYY,ZZZ) from a file that uses a fine grid (e.g. a BedMachine topography dataset) to a coarser grid used by a simulation. Here conservative interpolation is needed to avoid grid aliasing issues.
  • Conservatively regrid climate forcings. Here conservative interpolation is needed to preserve the amount of mass added to the system due to a forcing.
  • Regrid from a file using a different projection.

The interpolation part of this PR is more-or-less complete. I may need to take care of some corner cases, though.

  • Use PISM's old interpolation code if the source and target grids match: no need to use fancy interpolation on a sphere if no interpolation is needed.
  • Consider supporting global longitude,latitude grids. These are different in at least two ways: a) grid cell boundaries should follow lines of constant longitude and latitude instead of great circles and b) they are cyclic, which requires special treatment.

Most of the remaining work is related to getting projection information from an input file, including the input file used as a basis for PISM's internal 2D grid.

I decided to support input files containing CF-style "grid mapping" variables and added code processing these.

Checklist

  • update documentation
  • update CHANGES.rst
  • add regression tests

It reads valid range information from a file, which is then used to check if data in this
same file falls within this valid range. I don't know why I wrote this code: right now I
think we should warn about valid ranges *we* know about, e.g. minimum of 0 for ice
thickness -- and not others.
This will make it possible to allocate InputInterpolationXXX from within Grid without
messing with shared pointers and worrying about ownership.
This is needed so that PISM's C++ code does not have include YAXT's header files, which
are C-only.
We cannot create more than one grid called "internal".
@ckhroulev ckhroulev self-assigned this Apr 25, 2024
@bueler
Copy link
Member

bueler commented Apr 26, 2024

Amazing! 🎉

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.

None yet

2 participants