Project

General

Profile

conservative regridding considering destination grid mask

Added by Moritz Kreuzer over 5 years ago

Dear all,

for model coupling I want to do conservative regridding of data from on grid to another and vice versa. In the following I refer these grids as A and B.

grid A:
  • belongs to ocean model MOM5
  • logically rectangular lat/lon
  • coarse ( box: ~2.25° x 3°)
grid B:
  • belongs to ice sheet model PISM (Antarctic region)
  • cartesian x/y grid with stereographic polar projection
  • fine ( box: ~ 4x4km)

Currently I use cdo for creation of remap weights and SCRIP to do the actual regridding. (I can't use SCRIP for weight generation as SCRIP can't handle the grid specification of my nc-files [see attached below]).

My problem occurs during (conservative) regridding from fine to coarse grid (grid B->A), where data gets regridded to non-existing ocean cells. Thus conservation on the "real" ocean cells is not given. This happens as apparently CDO considers only the source grid mask during weight creation but not the destination grid mask. This would be necessary to make sure that mapping of the source grid cells is only allowed to destination grid cells which are masked as ocean. In the documentation I couldn't find any hint to make this work.

Does CDO has capabilities to achieve this?

Any hint or also recommendations of other tools are warmly welcome.

Thanks,
Moritz

Appendix:

input files:
mom_example_data_pure.nc (grid A - masked input data)
PICO_mask2 (grid B - including mask)

commands for weight generation:
cdo -b F64 -f nc4c gencon,PICO_mask2.nc mom_example_data_pure.nc regrid_weights.MOM_to_PISM.pico_mask2.nc
cdo -b F64 -f nc4c gencon,mom_example_data_pure.nc PICO_mask2.nc regrid_weights.PISM_to_MOM.pico_mask2.nc

regrid_weights.MOM_to_PISM.pico_mask2.nc
regrid_weights.PISM_to_MOM.pico_mask2.nc

-> both files: src_grid_imask (values: 0 & 1) ; dst_grid_imask (values: only 1s (!) )

regridding output:
out_MOM_to_PISM_conserv.pico_mask2.nc
out_PISM_to_MOM_conserv.pico_mask2.nc

grid_frac_compare.png
This screenshot shows the comparison of grid_frac variable (grid A) for first and second regridding step. In the left picture the ocean mask is clear on the bottom (either 0 or 1) which is the region around Antarctica. In the right picture also "non-ocean cells" (Antarctic land cells in this case) have an attributed grid fraction which means grid cells from the fine grid are mapped onto these cells. This ruins conservation on the "real" ocean cells.


Replies (1)

RE: conservative regridding considering destination grid mask - Added by Uwe Schulzweida over 5 years ago

A target grid mask is not supported for the conservative remapping but for all other remapping methods (remapbil, remapbic, remapnn, remapdis).
Here is an example on how to add the mask to the grid and store the result:

cdo griddes -setgridmask,maskfile  infile > mygrid
The CDO operator setgridmask (not documented, yet) adds a mask to the grid information read from infile. maskfile is a datafile which contains one field with the mask. The size of the mask must be the same as the grid. griddes stores the result to a standard CDO grid description file named mygrid.
Then you can use this grid file as parameter for the remapping:
cdo remapbil,mygrid infile outfile

In the next CDO release 1.9.6 the conservative remapping with remapcon will be replace by a new implementation. The "old" implementation will be renamed to remapscon. The new implementation is more stable and works more reliable. This new implementation supports also the target grid mask.
A prerelease for testing is available in the download area.

Cheers,
Uwe

    (1-1/1)