Project

General

Profile

cdo remapcon,gme25 grib1.grib2 grib1_ico.grib2 not working

Added by Christina Last 6 days ago

Hi All!
Its my first time posting here so be gentle haha.

I am trying to perform a remap from latlon to icosahedral-hexagon using cdo with grib2 files.

I have already selected 1 variable "`2t`" and saved to its own grib2 file.

cdo select,name=2t ERA5_All_Variables_1950.grib2 ERA5_All_Variables_1950_2t.grib2

Then I want to remap:

cdo remapcon,gme25 ERA5_All_Variables_1950_2t.grib2 ERA5_All_Variables_1950_2t_ico.grib2

This runs successfully, but when opening the new grib2 file with `xarraxy` like so:

ds = xr.open_dataset(f"ERA5_All_Variables_1950_2t_ico.grib2", engine="cfgrib")

I get this:

<xarray.Dataset> Size: 27kB
Dimensions:            (values: 6760)
Coordinates:
    time               datetime64[ns] 8B ...
    step               timedelta64[ns] 8B ...
    heightAboveGround  float64 8B ...
    valid_time         datetime64[ns] 8B ...
Dimensions without coordinates: values
Data variables:
    t2m                (values) float32 27kB ...
Attributes:
    GRIB_edition:            2
    GRIB_centre:             ecmf
    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts
    GRIB_subCentre:          0
    Conventions:             CF-1.7
    institution:             European Centre for Medium-Range Weather Forecasts
    history:                 2025-03-19T18:21 GRIB to CDM+CF via cfgrib-0.9.1...

Which does not seem to contain the coordinates (although I think I extracted them using my lovely colleague Julia's post https://code.mpimet.mpg.de/boards/1/topics/14513):
cdo -outputkey,xind,lon,lat ERA5_All_Variables_1950_2t_ico.grib2

On further inspection, the t2m array seems to have `NaN` values:

ds['t2m'].to_numpy()

array([263.66986, 280.7597 ,       nan, ...,       nan,       nan,
             nan], dtype=float32)

Which is unexpected. In summary:
- I want to know if I have properly converted to icosahedral-hexagon?
- The appropriate I can read the icosahedral data into xarray while maintining the correct datastructure.

I have attached `ERA5_All_Variables_1950_2t.grib2` and `ERA5_All_Variables_1950_2t_ico.grib2`, thanks in advance!


Replies (3)

RE: cdo remapcon,gme25 grib1.grib2 grib1_ico.grib2 not working - Added by Christina Last 6 days ago

Also, the output of

cdo -V
Climate Data Operators version 2.1.0 (https://mpimet.mpg.de/cdo)
System: x86_64-conda-linux-gnu
CXX Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1665747148079/_build_env/bin/x86_64-conda-linux-gnu-c++ -std=gnu++17 -fPIC -DPIC -g -O2 -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mila/l/lastc/.conda/envs/env_climatem_conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1665747148079/work=/usr/local/src/conda/cdo-2.1.0 -fdebug-prefix-map=/home/mila/l/lastc/.conda/envs/env_climatem_conda=/usr/local/src/conda-prefix -fopenmp -pthread
CXX version : unknown
C Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1665747148079/_build_env/bin/x86_64-conda-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mila/l/lastc/.conda/envs/env_climatem_conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1665747148079/work=/usr/local/src/conda/cdo-2.1.0 -fdebug-prefix-map=/home/mila/l/lastc/.conda/envs/env_climatem_conda=/usr/local/src/conda-prefix -fopenmp -pthread -pthread
C version : unknown
F77 Compiler: /home/conda/feedstock_root/build_artifacts/cdo_1665747148079/_build_env/bin/x86_64-conda-linux-gnu-gfortran -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/mila/l/lastc/.conda/envs/env_climatem_conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/cdo_1665747148079/work=/usr/local/src/conda/cdo-2.1.0 -fdebug-prefix-map=/home/mila/l/lastc/.conda/envs/env_climatem_conda=/usr/local/src/conda-prefix
F77 version : GNU Fortran (conda-forge gcc 10.4.0-16) 10.4.0
Features: 503GB 40threads c++17 OpenMP45 Fortran pthreads HDF5 NC4/HDF5/threadsafe OPeNDAP udunits2 proj xml2 magics curl fftw3 sse3
Libraries: yac/2.4.2 HDF5/1.12.2 proj/9.1.0 xml2/2.9.14 curl/8.9.1(h7.85.0) magics/4.12.1
CDI data types: SizeType=size_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 nczarr 
     CDI library version : 2.1.0
 cgribex library version : 2.0.2
 ecCodes library version : 2.27.0
  NetCDF library version : 4.8.1 of Oct 31 2022 22:16:44 $
    HDF5 library version : 1.12.2 threadsafe
    exse library version : 1.4.2
    FILE library version : 1.9.1

RE: cdo remapcon,gme25 grib1.grib2 grib1_ico.grib2 not working - Added by Karin Meier-Fleischer 6 days ago

From the documentation: The gme<NI> defines a global icosahedral-hexagonal GME grid. NI specifies the number of intervals on a main triangle side.

NI can be: 24, 48, 96, 192, 384, 768.

See https://www.ecmwf.int/sites/default/files/elibrary/2000/10942-global-icosahedral-hexagonal-grid-point-model-gme-operational-version-and-high-resolution.pdf

Setting NI to 25 causes the missing_values.

cdo -remapcon,gme24 ERA5_All_Variables_1950_2t.grib2 ERA5_All_Variables_1950_2t_ico.grib2

RE: cdo remapcon,gme25 grib1.grib2 grib1_ico.grib2 not working - Added by Uwe Schulzweida 5 days ago

We will add an error message if the coordinates of a global icosahedral-hexagonal GME grid can't be calculated.

    (1-3/3)