Project

General

Profile

Interpolation from grib file to unstructured grid with scattered points

Added by Jose Manuel Jimenez Gutiérrez almost 3 years ago

Hello!
I'm trying to interpolate a grib file to another grib with scattered points (locations points) using the option of unstructured grid in a similar way to this post https://code.mpimet.mpg.de/boards/2/topics/11250.
The grid description file is the next:

gridtype  = unstructured
gridsize  = 3
xname     = lon
xlongname = "longitude" 
xunits    = "degrees east" 
yname     = lat
ylongname = "latitude" 
yunits    = "degrees north" 
xvals     = 24.08 24.244 22.842
yvals     = 43.888 43.767 44.415

First, I have performed remapnn

cdo  remapnn,plantilla_coords 20200105_vis_0_68.grb2 20200105_vis_0_68_int.grb2

But when I try to output in the interpolated file the information of coordinates with griddes or sinfo, there is no information of latitude or longitude:

With outputtab I get this output:

cdo outputtab,lat,lon,value,date 20200105_vis_0_68_int.grb2

#   lat    lon    value       date 
     0      0  44549.5  2020-01-07 
     0      0  43035.5  2020-01-07 
     0      0  42958.5  2020-01-07

This trials were performed with this cdo version:

System: x86_64-pc-linux-gnu
CXX Compiler: g++ -std=gnu++11 -g -O2 -fopenmp 
CXX version : g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
C Compiler: gcc -std=gnu99 -g -O2 -fopenmp  
C version : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
F77 Compiler: gfortran -g -O2
F77 version : GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
Features: 62GB 16threads C++11 Fortran DATA PTHREADS OpenMP3 HDF5 NC4/HDF5 OPeNDAP PROJ.4 SSE2
Libraries: HDF5/1.8.12 proj/4.8
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c 
     CDI library version : 1.9.5
 CGRIBEX library version : 1.9.1
GRIB_API library version : 2.12.5
  NetCDF library version : 4.3.3.1 of Dec 10 2015 16:44:18 $
    HDF5 library version : 1.8.12
    EXSE library version : 1.4.0
    FILE library version : 1.8.3

I have downloaded the last version:

Climate Data Operators version 1.9.10 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -std=gnu++11 -g -O2 -fopenmp -pthread
CXX version : g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
C Compiler: gcc -std=gnu99 -g -O2 -fopenmp -pthread -pthread
C version : gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
F77 Compiler: gfortran -g -O2
F77 version : GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
Features: 62GB 16threads C++11 OpenMP3 Fortran PTHREADS SSE2
Libraries:
Filetypes: srv ext ieg grb1 grb2 
     CDI library version : 1.9.10
 cgribex library version : 1.9.5
 ecCodes library version : 2.12.5
    exse library version : 1.4.2
    FILE library version : 1.9.1

Neither is there no information of coordinates and when I perform outputtab I get the next error:

./cdo-vf   outputtab,lat,lon,value,date 20200105_vis_0_68_int.grb2

#   lat    lon    value       date 

cdo-vf    outputtab (Abort): Cell center coordinates missing!

With the updated version I have tried with eccodes flag and the result is the same:

./cdo-vf --eccodes  remapnn,plantilla_coords 20200105_vis_0_68.grb2 20200105_vis_0_68_int.grb2

Furthermore, with grib edition 1 files I cannot perform this remapnn or remapbil operations with unstructured grid. I have to transform the original files with grib_set

grib_set -s edition=2  20200105_vis_0_mergetime.grb 20200105_vis_0_mergetime.grb2

Please, could you help with this issue?I could interpolate every point at each time with another options but I would like to interpolate all the points at the same time.

Many thanks for your work! cdo has helped me a lot of years

plantilla_coords (242 Bytes) plantilla_coords grid description file
20200105_vis_0_68_int.grb2 (148 Bytes) 20200105_vis_0_68_int.grb2 Interpolated file
20200105_vis_0_68.grb2 (150 KB) 20200105_vis_0_68.grb2 Original file transformed to grib2
20200105_vis_0_68.grb (150 KB) 20200105_vis_0_68.grb Original file

Replies (2)

RE: Interpolation from grib file to unstructured grid with scattered points - Added by Uwe Schulzweida almost 3 years ago

Coordinates of an unstructured grid can't be stored in a GRIB record. Therefor you have to add these coordinates every time you need it:

cdo outputtab,lat,lon,value,date -setgrid,plantilla_coords infile.grb

    (1-2/2)