Regridding data onto the ACCESS-CM2 ocean/MOM grid

Background: I am going to be running some pacemaker style experiments where tropical Pacific SST is restored towards observational climatology in the ACCESS-CM2 model.
I have the observational climatology I am going to use but I need to convert this to the model grid so that the dataset can be read by the model

I am wondering if someone has already done something like this using xESMF to regrid from a regular 1x1 grid to the ocean grid in ACCESS/MOM before?

I have a function that converts from the ocean grid to regular 1x1 but not the other way around…

If anyone can help with this, please let me know!

1 Like

This COSIMA recipe covers regridding ACCESS-OM2 output

https://cosima-recipes.readthedocs.io/en/latest/DocumentedExamples/Regridding.html

but also links to this notebook (by @aekiss) that has some functions for regridding from various products to the MOM grids

https://nbviewer.org/github/aekiss/ice_analysis/blob/main/ice_maps.ipynb#Regridders

Hopefully there is something there you can adapt for your purposes.

It might be worth adding an issue to the COSIMA Recipes repo to extend the regridding example to include the case of regridding to the ACCESS-OM2 grids.

1 Like

Thanks for that Aidan.
It ended up being simpler than I thought, especially since it is a climatology so relatively small file. I think the format of the input file I need is not as complicated as I originally thought too…
This is what I did:

import xesmf as xe
import xarray as xr
#load in model grid example and climatology we want to regrid
clim = xr.open_dataset("/path/to/climatology.nc")
model = xr.open_dataset("/path/to/model_grid_example.nc")
#define input and output grids
grid_in = {'lon': clim.longitude.values, 'lat': clim.latitude.values}
grid_out = {'lon': model.GRID_X_T.values, 'lat': model.GRID_Y_T.values}
#create regridder
RG = xe.Regridder(grid_in, grid_out, 'bilinear')
#regrid
regridded_clim = RG(clim)
#now clean metadata and add attributes of original grid file
regridded_clim = regridded_clim.rename({"lon": "GRID_X_T", "lat": "GRID_Y_T", "month": "TIME"})
regridded_clim = regridded_clim.expand_dims(dim =  {"DEPTH1_1":model.DEPTH1_1})
regridded_clim = regridded_clim.assign_coords({"GRID_X_T": model.GRID_X_T, "GRID_Y_T": model.GRID_Y_T, "TIME":model.TIME, "DEPTH1_1":model.DEPTH1_1})

and here is what the model coordinates look like and the original dateset
Model:


Climatology:

1 Like

Nice! Thanks for sharing your solution. Feel free to mark your own answer as the solution so it is easier to find.

1 Like

Aloha @Aidan & @sebmckenna

Genuine question here - not a loaded question that I’m confident about the answer to. But is the bilinear approach for data with masks (land masks) and missing data (land) suitable to avoid issues in some coastal grid cells?

See some ongoing discussion here: Clarification on xESMF treatment of masks and missing values · Issue #256 · pangeo-data/xESMF · GitHub

My apologies if I’ve misunderstood the problem, the approach, or if it’s just my ignorance here. Thanks.

I think a conservative approach will be better and not coarsen data around coastlines

I looked at what happens to the coastlines in the bilinear regridding and its not ideal… (I’m regridding HadISST to be used for SST restoring) While the SST data itself is 1x1 deg like the model it is coarser around certain coastlines e.g. Indonesian seas. But the coarseness around coastlines does appear to increase when regridding bilinearly.

For example: raw and regridded HadISST plotted here to show coarsening at coastlines

I was also interested to know if the regridded SST has complete coverage over the original model grid - it does not, see below. (This is both due to SST resolution and the regridding performed).

image

I am now trying to re-grid using the conservative method in xesmf, so will update when I am able to do that

1 Like

@Thomas-Moore
For what its worth, the conservative regridding conserves coastlines much better, with the remaining differences I think due to where the observation data is.

I have used the conservative regrid method on HadISST data to go to the grid that ACCESS-CM2 uses for SST restoring.

The 2 plots below show the difference in the land sea masking for bilinear and conservative methods against the source grid. Here red indicates source grid is land and regridded HadISST is water and blue is the opposite. Clearly conservative is doing a lot better at keeping data round coastlines… (only differences now would be due to data extent to begin with)

image image

2 Likes

Thanks @sebmckenna for that effort and your perspective. My limited experience is that this can catch folks out if they are unaware of it and more so if the “mask” value is something other than NaN. This has come up as users invariably want to try to address questions about small scale regions of community / industry interest near where people live (land) with coarse GCM’s. ( all the obvious caveats should apply!).

Would you agree that the main thing holding folks back from defaulting to conservative_normed is sometimes the lack of required grid information for the specific SOURCE / OUTPUT grids? That bilinear is “easier” but only because it’s not clear where the grid information required can be found / generated?

In all my “free time” I’d love to work on a demo notebook that walks through this in more detail as, for my taste, the xESMF docs don’t go into enough on this topic?