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

interpolation method #7

Open
wwieder opened this issue Dec 18, 2024 · 4 comments
Open

interpolation method #7

wwieder opened this issue Dec 18, 2024 · 4 comments

Comments

@wwieder
Copy link

wwieder commented Dec 18, 2024

Hey, sorry to ping you out of the blue with this comment, but Rosie shared your repo. The work here looks good! Very encouraging.

I wanted to ask about the interpolation method being used? I'll note that I'm not an expert on such matters, but the CLM diagnostics package uses area-conservative regridding to go from the ne30 to f09 grids, whereas it looks like currently this is set up to do bilinear interpolation. Not sure what's right, but I wanted to start a discussion.

regridder_obsdata = xe.Regridder(ds, ds_out_gpp, 'bilinear', periodic=True)

@maritsandstad
Copy link
Collaborator

Thanks for commenting. Yes, it uses bilinear for the moment. There was no deep thought that went into that, but sometimes the requirements for area conserving are a bit stricter, so first order this was going to just work quickly and easily so plots can be reviewed. Happy to test out area conserving as well, I agree that it's probably more correct, but I find (being no expert in anything) that often for things like this, where absolute precision might not be the primary goal, bilinear is good enough.

@maritsandstad
Copy link
Collaborator

@wwieder I've now updated to use conservative_normed which seemed to me the most appropriate alternative, to retain the area conservation, but avoid coastal artefacts which can be a problem with conservative regridding, particularly for land only data. Testing with this seems alright to me, but I don't really have great intuition on what the data should look like, so I can't guarantee, anyways it's really easy to change, and it can even be made a dynamical option, but I doubt that would be worth it for most use cases...

@maritsandstad
Copy link
Collaborator

New update, so I had a bug, and actually the conservative_normed requires weight values on boundaries that I don't have, so it's going to be bilinear for now...

@wwieder
Copy link
Author

wwieder commented Jan 31, 2025

Hi Marit,

I ended up taking your code and doing a deep dive into the 'best' way to conserve fluxes and make nice maps.
The results are being integrated into our CUPiD workflow (through a branch of the ADF, atmosphere diagnostic package being developed at NCAR. You can see the PR here https://github.com/wwieder/ADF/tree/clm-test.

Notably, I'm relying heavily on your script, which you'll recognize here https://github.com/wwieder/ADF/blob/clm-test/scripts/regridding/regrid_se_to_fv.py.

I also spend a long time looking at coastlines and regional sums using this notebook https://github.com/wwieder/ADF/blob/clm-test/scripts/regridding/regrid_conservative.ipynb.

The short end of the story is that I'm:

  • weighting source fluxes by landfrac,
  • using conservative regridding (and a weight file created accordingly)
  • dividing the regridded flux by the regridded landfrac (note this results in chubby coastlines on the destination grid)
  • calculating regional or global fluxes (using regridded landfrac and destination area)
  • mapping after applying the destination grid landmask.

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

No branches or pull requests

2 participants