Project

General

Profile

Remapping on generic grid

Added by Paolo Davini almost 8 years ago

Hi all,

I know that CDO does not allow remapping on generic grid. However, I am a bit puzzled because it should be theoretically possible in some specific circumstances (as the one I am experiencing).

I am working with LES simulations, which uses a "generic" grid which is actually regularly space in both x and y direction. It is not a "geo-referenced" grid - which I think is the original sin.
Here below the grid I am using, which is 256x256.

#
# gridID 25
#
gridtype  = generic
gridsize  = 65536
xname     = xt
xunits    = m
yname     = yt
yunits    = m
xsize     = 256
ysize     = 256
xfirst    = -2550
xinc      = 20
yfirst    = -2550
yinc      = 20

Imagine you want to degrade it to a 128x128, with similar domain and doubled xinc,yinc.

#
# gridID 25
#
gridtype  = generic
gridsize  = 16384
xname     = xt
xunits    = m
yname     = yt
yunits    = m
xsize     = 128
ysize     = 128
xfirst    = -2550
xinc      = 40
yfirst    = -2550
yinc      = 40

So I do

cdo remapbil,newgrid.txt filein.nc fileout.nc

As expected, I get an abort with "unsuported grid type". Well, is there a way to do such simple interpolation with CDO? Area weights are all the same and it should be easy to compute them.
I looked in the forum to find any suggestions to circumvent this problem, but I did not end to anything.
Any opinions, even negative, are greatly appreciated. I can attach a sample file if you want.
Thanks!
Paolo

Thanks


Replies (7)

RE: Remapping on generic grid - Added by Uwe Schulzweida almost 8 years ago

Hi Paolo,

You are right, this is theoretically a very simple case for the remapping. Unfortunately the remapping in CDO needs at least some refactoring to support this simple grid because some search routines are only available on the 3D sphere.
But CDO has a 2nd implementation of the bilinear interpolation. This undocumented operator is called intgridbil. I have added support for this grid to this operator. This feature is available in the latest CDO prerelease (https://code.zmaw.de/projects/cdo/files).

Cheers,
Uwe

RE: Remapping on generic grid - Added by Paolo Davini almost 8 years ago

Hi Uwe,

many thanks for the reply. I see the point.

I tried the operator you suggested me, and actually I get a different error, which is somehow encouraging ;-)

cdo intgridbil,grid.txt filein.nc out.nc
cdo intgridbil (Abort): Interpolation of generic data unsupported!

Thus now the problem seems the data, not the grid, which is actually confusing me. Perhaps it can be fixed changing some attributes of the netcdf file, but to me it is not clear how.
I am running with CDO 1.6.8, and I tested also with the 1.6.9 on a local machine, with the same issue. Are they recent enough?
I attach two sample files for sake of reproducibility.

grid.txt (209 Bytes) grid.txt grid
filein.nc (4.27 MB) filein.nc sample input file

RE: Remapping on generic grid - Added by Uwe Schulzweida almost 8 years ago

Hi Paolo,

I have added the support for the "generic" to the operator intgridbil yesterday. To test this feature you need the latest CDO prerelease cdo-current.tar.gz from https://code.zmaw.de/projects/cdo/files.

Cheers,
Uwe

RE: Remapping on generic grid - Added by Paolo Davini almost 8 years ago

Sorry Uwe,

I do not know why I read "latest releases" instead of "latest prerelease". I will try it in the next days and let you know! Thanks for the help!
Cheers,
Paolo

RE: Remapping on generic grid - Added by Paolo Davini almost 8 years ago

Hi Uwe,

Thanks a lot! I tested it this morning and at first glance it is working fast and fine. I will probably do some further comparisons with other softwares soon.
On the left of the attached file you have "original" (256x256 points) and on the right the "interpolated" (128x128).

I found out I have some issues with the vertical interpolation of those grids as well, I will be probably back on this on a separated post!

Best,
Paolo

RE: Remapping on generic grid - Added by Zichong Chen about 7 years ago

Hi Paolo,

I ran into the same problem like you did, and I downloaded your netcdf file and grid text and tried to run it under CDO version 1.8.0. However, I got negative information here:
cdo intgridbil (Abort): Interpolation of generic data unsupported!

Do you have any suggestions bases on your experience? Thanks in advance.

Best,
Zichong

RE: Remapping on generic grid - Added by Paolo Davini about 7 years ago

Hi Zichong,

I have just checked, with cdo 1.8.0 and the test files above it works fine for me. Please note that my grid.txt file is a bit crooked, it should read xinc=40 and yinc=40 otherwise the interpolation is not complete but only on a subdomain.
However it works in both cases. Here below my cdo properties.
Cheers,
Paolo

Climate Data Operators version 1.8.0rc7 (http://mpimet.mpg.de/cdo)
Compiled: by pd2507 on watson (x86_64-unknown-linux-gnu) Feb  9 2017 11:20:07
Compiler: gcc -g -O2 -fopenmp 
 version: gcc (GCC) 6.1.0
Features: DATA PTHREADS OpenMP45 HDF5 NC4/HDF5/threadsafe SZ SSE2
Libraries: HDF5/1.8.15
Filetypes: srv ext ieg grb1 nc1 nc2 nc4 nc4c 
     CDI library version : 1.8.0rc7 of Feb  9 2017 11:18:51
 CGRIBEX library version : 1.7.6 of Dec 20 2016 19:55:24
  NetCDF library version : 4.3.3.1 of Feb  9 2017 03:38:44 $
    HDF5 library version : 1.8.15 threadsafe
 SERVICE library version : 1.4.0 of Feb  9 2017 11:18:31
   EXTRA library version : 1.4.0 of Feb  9 2017 11:18:24
     IEG library version : 1.4.0 of Feb  9 2017 11:18:28
    FILE library version : 1.8.2 of Feb  9 2017 11:18:25
    (1-7/7)