Source cell masking in calculating remap weights.
Added by Brendan DeTracey almost 4 years ago
Is is possible to specify source grid masking calculating remapping weights? This would be like the imask variable in a SCRIP style source grid definition. This would allow users to remap grids that have duplicate vertices for some cells such as the output from many current ocean models(tripolar grids). Currently, CDO may not interpolate these grids because they fail grid verification, but the grid points that fail verification are (usually) NaN and should not be used in weight calculations. Either a source grid mask option, and/or a genweight option to ignore all cells with duplicate vertices(with a warning message) would be extremely useful. And it would reduce the number of questions from NEMO users! If this is possible should I create an Issue for the suggestion?
Replies (29)
RE: Source cell masking in calculating remap weights. - Added by Feng Wang over 2 years ago
Hi all,
Sorry to report a few more errors about the process of different model outputs.
I was able to interpolate my data, i.e. siconc_SImon_MIROC-ES2L_historical_r1i1p1f2_gn_185001-201412.nc, using the method provided by Estanislao.
However, it did not work for the following two netcdf files. Could anyone help with it?
My goal: regrid oceanic grids to Gaussian T21 grids using the remapcon (remapcon needs to be used because other variables were interpolated this way).
Thanks.
Cheers,
Feng
Errors when regridding MPI:
cdo remapcon,grid.txt siconc_SImon_MPI-ESM1-2-LR_historical_r1i2000p1f1_gn_185001-186912.nc siconc_SImon_MPI-ESM1-2-LR_historical_r1i2000p1f1_gn_185001-186912_v2.nc
Warning (cdf_set_dimtype): Could not assign all character coordinates to data variable!
cdo remapcon: YAC first order conservative weights from curvilinear (256x220) to gaussian (128x64) grid, with source mask (36791)
cdo remapcon: 6%ERROR: invalid cell
Aborting in file clipping.c, line 1777 ...
Errors when regridding CESM. I know the output of CESM is a bit different but wish one could also provide a solution:cdo remapcon,grid.txt trans1-850AD.cice.h.aice_nh.190001-199912.nc test.nc
Warning (cdf_set_var): Inconsistent variable definition for tarea!
cdo remapcon (Warning): Source grid cell center longitudes out of range (min=0.00727/max=1e+30)!
cdo remapcon (Warning): Source grid cell center latitudes out of range (min=30.6/max=1e+30)!
cdo remapcon: YAC first order conservative weights from curvilinear (320x104) to gaussian (128x64) grid, with source mask (23744)
cdo remapcon: 51%ERROR: invalid cell
Aborting in file clipping.c, line 1777 ...
RE: Source cell masking in calculating remap weights. - Added by Estanislao Gavilan over 2 years ago
Hi Feng,
If the error appears depending on the netcdf file, it could be an issue of cdo. Did you try to use linear interpolation? It seems that the cdo version 2.0.5 has a small bug reporting the precise error with the command remapcon. This error is related with the name of the variables and dimensions. CDO is really peaky about the name of the coordinates. Take a look to this post https://code.mpimet.mpg.de/boards/1/topics/12910
Kind regards,
Estanislao
RE: Source cell masking in calculating remap weights. - Added by Uwe Schulzweida over 2 years ago
The first file contains unusable coordinates in the first and last column. You can remove them with the CDO function sethalo,-1,-1:
cdo remapcon,grid.txt -sethalo,-1,-1 siconc_SImon_MPI-ESM1-2-LR_historical_r1i2000p1f1_gn_185001-186912.nc result.ncThe second file contains missing values in the coordinates. This is not foreseen in the interpolations with CDO. You can remove these missing values with the CDO function reducegrid. To do this, a mask must be created from the existing data:
cdo gtc,0 -setmisstoc,0 -selname,blkmask trans1-850AD.cice.h.aice_nh.190001-199912.nc blkmask.nc cdo reducegrid,blkmask.nc trans1-850AD.cice.h.aice_nh.190001-199912.nc tmpfile cdo remapcon,grid.txt tmpfile result.nc rm tmpfile
RE: Source cell masking in calculating remap weights. - Added by Feng Wang over 2 years ago
Hi Uwe and Estanislao,
Issue solved! Thanks.
Feng
- « Previous
- 1
- 2
- Next »