Project

General

Profile

Conversion of netcdf file to grib

Added by jyoti lodha over 6 years ago

Hi
As my data contain 21 levels of pressure and has gaussian Grid coordinates . I want to convert it into grib file. As it is showing me following error.

cdo -f grb setltype,100 -chparam,-1,11 temp4.nc temp4.grb
cdo setltype: Started child process "chparam,-1,11 temp4.nc (pipe1.1)".
GRIB_API ERROR : Key "P1": Trying to encode a negative value of -2147483648 for key of type unsigned

GRIB_API ERROR : unable to set P1=-2147483648 as long (Encoding invalid)
!!! failed call to grib_set_long( grib_handle* h, "endStep", -2147483648) !!!
stream_gribapi.c at line 1778: my_grib_set_long(gh, "endStep", endStep) failed: Encoding invalid

Climate Data Operators version 1.7.0 (http://mpimet.mpg.de/cdo)
Compiler: gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp
version: gcc (Ubuntu 5.3.1-9ubuntu2) 5.3.1 20160220
Features: DATA PTHREADS OpenMP4 HDF5 NC4/HDF5/threadsafe OPeNDAP SZ Z UDUNITS2 PROJ.4 MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.8.16 proj/4.92 curl/7.47.0
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c
CDI library version : 1.7.0
GRIB_API library version : 1.14.4
netCDF library version : 4.4.0 of Mar 29 2016 11:41:40 $
HDF5 library version : 1.8.16
SERVICE library version : 1.4.0
EXTRA library version : 1.4.0
IEG library version : 1.4.0
FILE library version : 1.8.2


Replies (11)

RE: Conversion of netcdf file to grib - Added by Karin Meier-Fleischer over 6 years ago

Hi jyoti,

could you please update cdo to the current version 1.9.3.

-Karin

RE: Conversion of netcdf file to grib - Added by jyoti lodha over 6 years ago

Still I am getting the same error. Plese find me some solution.

Have a look on my file temp4, and convert it
DC2-DEV91:Documents admin$ cdo -f grb setltype,100 -chparam,-1,11 temp4.nc temp4.grb
cdo setltype: Started child process "chparam,-1,11 temp4.nc (pipe1.1)".
ECCODES ERROR : unable to find units to set stepRange=4578552000
!!! failed call to grib_set_long( grib_handle* h, "endStep", 4578552000) !!!
stream_gribapi.c at line 1814: my_grib_set_long(gh, "endStep", endStep) failed: Unable to set step

DC2-DEV91:dxp-infra-content-management-service-adaptor admin$ cdo -V
Climate Data Operators version 1.9.3 (http://mpimet.mpg.de/cdo)
Compiled: by root on DC2-DEV91 (x86_64-apple-darwin16.7.0) Apr 25 2018 08:17:02
CXX Compiler: /usr/bin/clang++ -std=gnu++11 -pipe -Os -stdlib=libc++ -arch x86_64 -D_THREAD_SAFE -pthread
CXX version : unknown
C Compiler: /usr/bin/clang -pipe -Os -arch x86_64 -D_THREAD_SAFE -pthread
C version : unknown
F77 Compiler: -pipe -Os
F77 version : ./configure: line 21772: -V: command not found
Features: 16GB C++11 DATA PTHREADS HDF5 NC4/HDF5 OPeNDAP UDUNITS2 PROJ.4 CURL FFTW3 SSE4_1
Libraries: HDF5/1.10.2 proj/5.01 curl/7.59.0
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.3 of Apr 25 2018 08:16:31
GRIB_API library version : 2.7.0
NetCDF library version : 4.4.1.1 of Nov 25 2017 11:19:57 $
HDF5 library version : 1.10.2
EXSE library version : 1.4.0 of Apr 25 2018 08:16:29
FILE library version : 1.8.3 of Apr 25 2018 08:16:28

temp4.nc (15.8 MB) temp4.nc temp4

RE: Conversion of netcdf file to grib - Added by Uwe Schulzweida over 6 years ago

Thanks for this report! We will fix this bug in the next CDO release.

RE: Conversion of netcdf file to grib - Added by Ralf Mueller over 6 years ago

I can convert this with the CDO version comming with the docker image: docker

cdo -f grb setltype,100 -chparam,-1,11 temp4.nc temp4Docker.grb
cdo setltype: Started child process "chparam,-1,11 temp4.nc (pipe1.1)".
cdo(2) chparam: Processed 4128768 values from 1 variable over 6 timesteps [0.10s]
cdo setltype: Processed 4128768 values from 1 variable over 6 timesteps [0.10s 17MB]

you might have a look into the file to be sure it's like it should be

hth
ralf

RE: Conversion of netcdf file to grib - Added by jyoti lodha over 6 years ago

Hi
Thaks a lot ,for solving my issues. But when I go through the link of docker- I could'nt find the installtion process, only the running process is disscused.

Can u please suggest me how to install docker in my mac laptop.

RE: Conversion of netcdf file to grib - Added by Henri Laurent about 6 years ago

Hi,

I am having the same issue.
Running CDO V 1.9.3 under Ubuntu 18.04.
This version is the latest I can get using:
sudo apt-get install cdo

cdo -V
Climate Data Operators version 1.9.3 (http://mpimet.mpg.de/cdo)
CXX Compiler: g++ -g -O2 -fdebug-prefix-map=/build/cdo-g3Qjnd/cdo-1.9.3+dfsg.1=. -fstack-protector-strong -Wformat -Werror=format-security -fopenmp
CXX version : g++ (Ubuntu 7.3.0-1ubuntu1) 7.3.0
C Compiler: gcc -g -O2 -fdebug-prefix-map=/build/cdo-g3Qjnd/cdo-1.9.3+dfsg.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp
C version : gcc (Ubuntu 7.3.0-1ubuntu1) 7.3.0
F77 Compiler: f77 -g -O2 -fdebug-prefix-map=/build/cdo-g3Qjnd/cdo-1.9.3+dfsg.1=. -fstack-protector-strong
F77 version : unknown
Features: 7GB C++14 Fortran DATA PTHREADS OpenMP45 HDF5 NC4/HDF5/threadsafe OPeNDAP SZ UDUNITS2 PROJ.4 MAGICS CURL FFTW3 SSE2
Libraries: HDF5/1.10.0 proj/4.93 curl/7.58.0
Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.3
GRIB_API library version : 2.6.0
NetCDF library version : 4.6.0 of Feb 9 2018 19:21:24 $
HDF5 library version : library undefined
EXSE library version : 1.4.0
FILE library version : 1.8.3

Getting the following error message :

cdo -f grb -t table.txt copy final.nc grib.grb
ECCODES ERROR : unable to find units to set stepRange=1542371400 !!!
failed call to grib_set_long( grib_handle* h, "endStep", 1542371400) !!!
stream_gribapi.c at line 1814: my_grib_set_long(gh, "endStep", endStep) failed: Unable to set step

Can you suggest any solution to this?

Thanks,

Henri

RE: Conversion of netcdf file to grib - Added by Henri Laurent about 6 years ago

To complete my earlier post, here are the 2 files used as inputs.

Henri

RE: Conversion of netcdf file to grib - Added by Henri Laurent about 6 years ago

And another remark: this script used to work with an older version of cdo (V1.5.6.1) running under Ubuntu 13.10 (saucy)

cdo -V
Climate Data Operators version 1.5.6.1 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pthread
version: gcc (Ubuntu/Linaro 4.7.2-12ubuntu2) 4.7.2
with: PTHREADS Z JASPER PROJ.4
Compiled: by buildd on allspice (x86_64-unknown-linux-gnu) Dec 6 2012 12:47:21
CDI library version : 1.5.6 of Dec 6 2012 12:47:14
CGRIBEX library version : 1.5.3 of Jun 14 2012 13:22:45
GRIB_API library version : 1.9.16
netCDF library version : 4.1.3 of Sep 17 2013 11:49:01 $
HDF5 library version : 1.8.11
SERVICE library version : 1.3.0 of Dec 6 2012 12:46:59
EXTRA library version : 1.3.0 of Dec 6 2012 12:46:54
IEG library version : 1.3.0 of Dec 6 2012 12:46:57
FILE library version : 1.8.0 of Dec 6 2012 12:46:55

RE: Conversion of netcdf file to grib - Added by Ralf Mueller about 6 years ago

hi!

I tested 1.9.5 on linux (manual build), 1.9.5 from conda and 1.9.5 from the Docker image - all binaries run your command without any issue.

the 1.9.3 binary uses eccodes for grib1, whereas the 1.5.6.1 version uses the internal cgribex library. You should contact the maintainer of the cdo package on your distro (or whoever build it that way).

for the debian package: http://packages.debian.org/de/sid/cdo

hth
rakf

RE: Conversion of netcdf file to grib - Added by Uwe Schulzweida about 6 years ago

The ecCodes grib1 error will be solved in the next CDO release.

Cheers,
Uwe

    (1-11/11)