Project

General

Profile

Some reggridding methods do not work for some of my files.

Added by lionel constantin almost 2 years ago

I want to do remapping from a curvilinear grid to a unstructured grid using different regridding methods.

Some of the methods work but some don't:
Working:
  • genbil
  • genbic
  • gennn
  • gendis
Not working:
  • gencon
  • genlaf
  • gencon2 (this one does not give error but takes ages to compute and gives invalid results)

I run this command (just change the method name)

cdo gencon,grid_unstructured.nc curvi_grid.nc test_w.nc

Error message

cdo gencon: YAC first order conservative weights from curvilinear (900x840) to unstructured (21344) grid
cdo gencon: 0%ERROR: invalid cell

Aborting in file ../../../../../src/lib/yac/clipping.c, line 1305 ...

I don't know what is wrong, maybe something depending on the file structure ?
Also it seems that the two methods with this error are using yac, while the others are not ?

I tryed on two different computers, same issue:

CSCS, daint:

Climate Data Operators version 1.9.10 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: CC -O3 -fno-math-errno -fopenmp -fPIC -pthread
CXX version : unknown
C Compiler: cc -O3 -fno-math-errno -fopenmp -fPIC -pthread -pthread
C version : unknown
F77 Compiler: ftn -O3 -fno-math-errno -fopenmp -fPIC
F77 version : unknown
Features: 251GB 20threads C++14 OpenMP45 Fortran PTHREADS HDF5 NC4/HDF5 SZ UDUNITS2 PROJ CURL AVX2
Libraries: HDF5/1.12.0 proj/8.1.1 curl/7.80.0
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.10
cgribex library version : 1.9.5
ecCodes library version : 2.23.0
NetCDF library version : 4.7.4 of Apr 20 2021 21:25:59 $
hdf5 library version : 1.12.0
exse library version : 1.4.2
FILE library version : 1.9.1

Ubuntu20.04 on WSL2: (btw I cannot update to newer versions using apt, if someone could try for me on the latest version ?)

Climate Data Operators version 1.9.9rc1 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fopenmp
CXX version : g++ (Ubuntu 9.2.1-28ubuntu1) 9.2.1 20200203
C Compiler: gcc -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp
C version : gcc (Ubuntu 9.2.1-28ubuntu1) 9.2.1 20200203
F77 Compiler: f77 -g -O2 -fdebug-prefix-map=/build/cdo-51aH2m/cdo-1.9.9~rc1=. -fstack-protector-strong
F77 version : unknown
Features: 24GB 8threads C++14 Fortran DATA PTHREADS OpenMP HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.10.4 proj/6.3.0 curl/7.68.0(h7.66.0)
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.9rc1
ecCodes library version : 2.16.0
NetCDF library version : 4.7.3 of Jan 23 2020 04:18:16 $
hdf5 library version : library undefined
exse library version : 1.4.1
FILE library version : 1.8.3

grid_unstructured.nc (1.47 MB) grid_unstructured.nc The grid to wich I want to interpolate
curvi_grid.nc (34.6 MB) curvi_grid.nc The input file (with the grid from which I interpolate)

Replies (6)

RE: Some reggridding methods do not work for some of my files. - Added by Uwe Schulzweida almost 2 years ago

The description of the coordinate bounds do not follow the NetCDF CF Convention. Here is the definition of your grid cell bounds:

dimensions:
    nlon = 840 ;
    nlat = 900 ;
    nlon_1 = 841 ;
    nlat_1 = 901 ;
variables:
    double clon(nlon, nlat) ;
        clon:bounds = "clon_bnds" ;
    double clat(nlon, nlat) ;
        clat:bounds = "clat_bnds" ;
    double clon_bnds(nlon_1, nlat_1) ;
    double clat_bnds(nlon_1, nlat_1) ;
The standard conform way is:
dimensions:
    nlon = 840 ;
    nlat = 900 ;
    nv = 4 ;
variables:
    double clon(nlon, nlat) ;
        clon:bounds = "clon_bnds" ;
    double clat(nlon, nlat) ;
        clat:bounds = "clat_bnds" ;
    double clon_bnds(nlon, nlat, nv) ;
    double clat_bnds(nlon, nlat, nv) ;
This error is unfortunately not caught correctly. Therefore it comes to a misbehavior and it is worked with wrong cell corners.
In the next CDO version an error message will be issued.
Because the coordinate bounds are not available in CDO you cannot use remapcon, remaplaf and remapcon2.

RE: Some reggridding methods do not work for some of my files. - Added by lionel constantin almost 2 years ago

Oh yes, I understand the problem,

Thanks for your help !

RE: Some reggridding methods do not work for some of my files. - Added by Anne Moree 11 months ago

Hello,

I get a similar error message when trying cdo remaplaf,global_1 on the attached file:

cdo remaplaf,global_1 testremaplaf1.nc testremaplaf2.nc
cdo    remaplaf: YAC largest area fraction weights from curvilinear (362x292) to lonlat (360x180) grid, with source mask (65544)
cdo    remaplaf:   6%ERROR: invalid cell 
Aborting in file clipping.c, line 1766 ...

variable tos has coordinates described, which have bounds described, so what could be going wrong?

Thank you in advance for thinking along!

Best wishes,

Anne

RE: Some reggridding methods do not work for some of my files. - Added by Ralf Mueller 11 months ago

Hi Anne!

I have no problems performing the interpolation:

% cdo  -remaplaf,global_1 testremaplaf1.nc testremaplaf2.nc                                                                          [Tue 2023-05-30|10:22:12]
cdo    remaplaf: YAC largest area fraction weights from curvilinear (362x292) to lonlat (360x180) grid, with source mask (65544)
cdo    remaplaf: Processed 105704 values from 1 variable over 1 timestep [1.27s 103MB]

I use cdo-2.2.0. Which version do you use?

cheers
ralf

RE: Some reggridding methods do not work for some of my files. - Added by Anne Moree 11 months ago

Hi Ralf,

You are right it is a version issue; I am using 2.0.5.
I will ask our system admin to update to 2.2.0! I tested it locally that this fixes the error.
Thanks again,

Anne

RE: Some reggridding methods do not work for some of my files. - Added by Ralf Mueller 11 months ago

you can get the latest release on a linux system with conda (using the `conda-forge` channel) without admins

    (1-6/6)