Hi everyone!
I’m currently regridding some artificial SST and sea ice datasets from a 1.25 x ~0.94 grid to a 1.875 x 1.25 grid in order to use them as ancillary files for the ESM1.5 AMIP model, and was wondering if anyone had any advice/wisdom on what a good approach might be.
As shown below, the files have some sort of artificial data over land
(fig 1)
It’s been suggested that I mask these out so that they are not used during the regridding, and so I’ve obtained some land-sea masks for both the input and output grids.
I’ve been using xESMF to try and do the regridding, as it seems a bit more beginner friendly and has a bit more documentation than some of the other options I’ve seen. It’s also been suggested I just use bilinear interpolation. I tried a few different methods for masking out the land data, and found the results a bit strange.
1. Prior to regridding, setting all land values to nan, and regridding without supplying any masks to the xe.Regridder call
From what I understand, any output grid points which are next to an nan on the input data will be set to nan. This results in
(Fig 2)
2. Supplying an input binary mask to the input grid in the xe.Regridder call:
This results in the following:
(Fig 3)
The results are almost identical, however the second method actually outputs values at few more cells than the first, specifically on Western coasts, with the extra values shown below.
(Fig 4)
It’s unclear to me how the second method produces data at these extra points. Some old discussions on the xESMF github suggest that when a mask is supplied to the regridder, it’s the same as setting the land values to zero and then interpolating.
This doesn’t seem exactly like what’s happening. If we manually set the land values to zero and regrid, we get soft edges:
(Fig 5)
Worth noting though: The extra values in Fig 4 do equal the values at the same locations Fig 5, so maybe they are a result of interpolating to zero. It’s not clear to me if this is what’s happening, at least visually they don’t look much lower than their neighbours.
In any case, I will need to then extrapolate the values so they cover the whole ocean on the output grid.
I asked about the extra values on the xESMF github, and it was suggested there that the best option is to use the ‘conservative normed’ method instead. An possible issue here is that the conservative normed method might not be able to ensure the outputs are periodic in longitude (currently you can only specify that the grid is periodic when not using the conservative methods)
The options I can think of at the moment are to:
- Regrid without any masks before applying the output grids mask. This would be straightforward but the coastal points will be influenced by the artificial land values.
- Regrid providing the xe.Regridder call with both the input and output masks, and getting it to extrapolate to the missing points. The issue with this would be that the mystery values in Fig 4 would be included, and would affect the extrapolation to some of the coastal points.
- Use the conservative normed method, and not have to worry about nans or 0’s affecting the output, but possibly having discontinuities at the meridian line (maybe this is unlikely to be severe if the input values are periodic anyway)
I’ll try the conservative normed method and see what it looks like, but was wondering if anyone here has any thoughts/recommendations on what could be a good way to do this regridding. Sorry for the long post, but thanks for having a read!
Spencer