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

Using interpolate_grid_label() to regrid data #262

Closed
r-ford opened this issue Sep 7, 2022 · 4 comments
Closed

Using interpolate_grid_label() to regrid data #262

r-ford opened this issue Sep 7, 2022 · 4 comments

Comments

@r-ford
Copy link

r-ford commented Sep 7, 2022

I'm trying to put some of the CMIP6 data in the Pangeo Google storage on the same grid in order to take an average across models. I thought that interpolate_grid_label() might do this. In this notebook, I am trying to regrid the MPI data from its gn grid to the CESM's gr grid, but it does not work. Is interpolate_grid_label() meant to do this sort of regridding, or could there just be an error in my code?

@r-ford r-ford changed the title Using `interpolate_grid_label()' to regrid data Using interpolate_grid_label() to regrid data Sep 7, 2022
@jbusecke
Copy link
Owner

jbusecke commented Sep 8, 2022

Hi @r-ford, thanks for using xMIP! The interpolate_grid_label function is a specific use case for general regridding. It will regrid outputs on different grids 'per model', e.g. if you have variable_a on grid_label 'gn' and variable_b on grid_label 'gr' this will attempt to return both variables on the same grid. This will however still leave the grid between different models incompatible (which I think is what you are experiencing here).

I think what you are trying to achieve is actually simpler. I would suggest to use xesmf(which is what we are using here under the hood) to regrid all models to a common lat/lon grid of your choice, and then you should be able to average them together on the new grid.

Let me know if that works for you

@r-ford
Copy link
Author

r-ford commented Sep 9, 2022

Thanks @jbusecke! That makes sense. xesmf seems like my best option, though I've been running into some issues getting results so far (one example is in this other notebook, where the regridded data is all nan). Do you know of any examples on GitHub or elsewhere of someone regridding this CMIP6 data? Also @brian-rose

@jbusecke
Copy link
Owner

There are some common tricks (I think there is a 'masking' or similar argument that might help you here). But generally this case would be a nice demonstration to include either in the xMIP docs or the pangeo gallery.

@r-ford
Copy link
Author

r-ford commented Sep 14, 2022

I was able to regrid the data with xesmf (with the help of this notebook). I plan on writing up a tutorial to add to the Project Pythia CMIP6 Cookbook, which is a slightly modified version of the one in the Pangeo gallery. Thanks again for the help!

@r-ford r-ford closed this as completed Sep 14, 2022
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