Project

General

Profile

cdo -f grb2 copy convert from NC to grib2

Added by Yong Sun almost 5 years ago

Dear Sir or Madam,

First I benefit a lot from CDO over the past few years. Thanks very much to your development on so nice software.

Recently I tried to convert NC format to grib as suggested by CDO user-guide and take one model simulation output for example:

1. cdo -f grb copy precip.nc precip_NC_to_grib1.grb (no any problem for the NC to grib1)
2. cdo -f grb copy precip.nc precip_NC_to_grib2.grb (precip_NC_to_grib2.grb can be generated with warning listed as following).

GRIB_API ERROR : concept: no match for cfName=precipitation_flux
!!! grib_set_string( grib_handle* h, "cfName", "precipitation_flux") !!!
Warning (gribapiDefParam) : grib_api: No match for cfName=precipitation_flux
GRIB_API ERROR : concept: no match for shortName=pr
!!! grib_set_string( grib_handle* h, "shortName", "pr") !!!
Warning (gribapiDefParam) : grib_api: No match for shortName=pr
cdo copy: Processed 663552 values from 1 variable over 12 timesteps ( 0.08s )

PS. the cdo version is 1.8.0rc2 and installed with suggested configurations
./configure --prefix=/data/ysun/soft/cdo-1.8.0 --enable-netcdf4 --enable-zlib --with-netcdf=/opt/netcdf43/ifort --with-hdf5=/opt/hdf5/1.8.14/ifort/ - -with-grib_api=/usr/share/grib_api

grib_api version is grib_api-1.12.3

Test NC file is attached. I am looking forward to hearing your suggestion when you are earliest free.

Thanks again.

Have a nice day

Yong

precip_NC_to_grib1.grb (1.27 MB) precip_NC_to_grib1.grb cdo -f grb copy precip.nc precip_NC_to_grib1.grb
precip_NC_to_grib2.grb (2.53 MB) precip_NC_to_grib2.grb cdo -f grb copy precip.nc precip_NC_to_grib2.grb
precip.nc (6.58 MB) precip.nc

Replies (2)

RE: cdo -f grb2 copy convert from NC to grib2 - Added by Yong Sun almost 5 years ago

typoo error correction: 2. cdo -f grb2 copy precip.nc precip_NC_to_grib2.grb (precip_NC_to_grib2.grb can be generated with warning listed as following).

RE: cdo -f grb2 copy convert from NC to grib2 - Added by Ralf Mueller almost 5 years ago

hi!
you have to change the netcdf shortname or standard_name attribute to something that the grib2 standard understands: https://apps.ecmwf.int/codes/grib/param-db/?filter=grib2

cheers
ralf

    (1-2/2)