Project

General

Profile

Conservative remap from unstructured grid

Added by Rostislav Kouznetsov 2 months ago

I want to get a conservative remapping for rain (ERA5-land) from reduced Gaussian grid to regular lon-lat.
With the attached file I get

$ cdo remapcon,01.grid era5land_gg_2000010100+001-tp.sfc  era5land_gg_2000010100+001-tp-ll.sfc 
cdo    remapcon (Abort): Source grid cell corner coordinates missing!

Which is perfectly reasonable.

Is there any way to feed cdo with the info on grid cell corner coordinates?

Thank you!

cdo is one from Ubuntu 22.04

$ cdo --version
Climate Data Operators version 2.0.4 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -std=gnu++14 -g -O2 -ffile-prefix-map=/build/cdo-hTyRvi/cdo-2.0.4=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -fopenmp -pthread
CXX version : g++ (Ubuntu 11.2.0-16ubuntu1) 11.2.0
C Compiler: gcc -g -O2 -ffile-prefix-map=/build/cdo-hTyRvi/cdo-2.0.4=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC  -fopenmp -pthread -pthread
C version : gcc (Ubuntu 11.2.0-16ubuntu1) 11.2.0
F77 Compiler: f77 -g -O2 -ffile-prefix-map=/build/cdo-hTyRvi/cdo-2.0.4=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong
F77 version : GNU Fortran (Ubuntu 11.2.0-16ubuntu1) 11.2.0
Features: 62GB 24threads C++14 OpenMP45 Fortran PTHREADS HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.10.7 proj/8.2.1 curl/7.81.0 magics/4.10.1
CDI data types: SizeType=size_t  DateType=int64_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 
     CDI library version : 2.0.4
 ecCodes library version : 2.24.2
  NetCDF library version : 4.8.1 of Sep 29 2021 09:36:14 $
    hdf5 library version : library undefined
    exse library version : 1.4.2
    FILE library version : 1.9.1

era5land_gg_2000010100+001-tp.sfc (2.62 MB) era5land_gg_2000010100+001-tp.sfc sample total precipitation from ERA5-land in native grid
01.grid (301 Bytes) 01.grid Desired grid

Replies (7)

RE: Conservative remap from unstructured grid - Added by Uwe Schulzweida 2 months ago

You can use setgridtype,regular to convert the reduced Gaussian grid to a regular Gaussian grid.

cdo -P 8 remapcon,01.grid -setgridtype,regular era5land_gg_2000010100+001-tp.sfc  era5land_gg_2000010100+001-tp-ll.sfc 
Use the regularnn parameter if you prefer a Nearest Neighbor instead of a linear filling of the Gaussian latitudes.

RE: Conservative remap from unstructured grid - Added by Rostislav Kouznetsov 2 months ago

Thank you! That worked. So it is essentially two remappings: reduced gaussian -> regular gaussian -> lon-lat,
and the first step is done by linear or nearest-neighbour method.

If I am not mistaken, the reduced gaussian grid is the one actually used in the original model.

I wonder id there is a way to feed the original grid geometry to cdo, so it could do conservative remapping directly?

RE: Conservative remap from unstructured grid - Added by Uwe Schulzweida 2 months ago

We have not implemented the calculation of cell corners from the coordinates of the reduced Gaussian grid in CDO.

RE: Conservative remap from unstructured grid - Added by Rostislav Kouznetsov 2 months ago

Thank you! So nether cdo can calculate them nor they can be fed to cdo from an external file.

But it is good to know that they can be calculated (i.e they are uniquely defined).
I'll check how that can be done.

RE: Conservative remap from unstructured grid - Added by Uwe Schulzweida 2 months ago

If you have the coordinates, you can create a CDO grid description file for unstructured grids and use the CDO function setgrid to apply them to your data. (See https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-997000D.2)

RE: Conservative remap from unstructured grid - Added by Uwe Schulzweida 2 months ago

cdo remapcon,01.grid -setgrid,<gridfile> era5land_gg_2000010100+001-tp.sfc  era5land_gg_2000010100+001-tp-ll.sfc 

RE: Conservative remap from unstructured grid - Added by Rostislav Kouznetsov 2 months ago

Thank you! That's pretty much what I was after.

And thank you for the great tool and swift support!

    (1-7/7)