Project

General

Profile

Convert netcdf to grib2

Added by nikos konstantinou over 4 years ago

Hello

I am trying to convert the attached file copernicus_wind_2019080612 (10u and 10v of wind) to grib2 format.
Unfortunately this is what I get when I try to use ' cdo -f grb2 copy copernicus_wind_2019080612 testncgrb'

"cdo copy/selall : UNCHANGED_RECORD=0
cdo copy/selall : cdiGribDataScanningMode=0; lcopy=0
Segmentation fault (core dumped)"

while when I use the command 'cdo -b 16 -f grb setmissval,0 copernicus_wind_2019080612 testtncgrb'
this is what I get
"ECCODES ERROR : unable to find units to set stepRange=1048356
!!! failed call to grib_set_long( grib_handle* h, "endStep", 1048356) !!!
stream_gribapi.c at line 1814: my_grib_set_long(gh, "endStep", endStep) failed: Unable to set step
"

any help will much appreciated

Thanks in advance!


Replies (3)

RE: Convert netcdf to grib2 - Added by nikos konstantinou over 4 years ago

nikos konstantinou wrote:

Hello

I am trying to convert the attached file (netcdf format) copernicus_wind_2019080612 (10u and 10v of wind) to grib2 format.
Unfortunately this is what I get when I try to use ' cdo -f grb2 copy copernicus_wind_2019080612 testncgrb'

"cdo copy/selall : UNCHANGED_RECORD=0
cdo copy/selall : cdiGribDataScanningMode=0; lcopy=0
Segmentation fault (core dumped)"

while when I use the command 'cdo -b 16 -f grb setmissval,0 copernicus_wind_2019080612 testtncgrb'
this is what I get
"ECCODES ERROR : unable to find units to set stepRange=1048356
!!! failed call to grib_set_long( grib_handle* h, "endStep", 1048356) !!!
stream_gribapi.c at line 1814: my_grib_set_long(gh, "endStep", endStep) failed: Unable to set step
"

any help will much appreciated

Thanks in advance!

RE: Convert netcdf to grib2 - Added by Ralf Mueller over 4 years ago

-f grb is for grib1, try this

% cdo -f grb2 copy copernicus_wind_2019080612 t.grb2                                                                                                                                                                                                                                                 [Fri 2019-08-09|14:06:29]
gribapiEncode     : *** GRIB2 shortName does not correspond to chosen variable name: "v" ("northward_wind").
gribapiEncode     : *** GRIB2 shortName does not correspond to chosen variable name: "u" ("eastward_wind").
cdo    copy: Processed 2 variables over 1 timestep [0.08s 88MB].
% cdo sinfov t.grb2  
   File format : GRIB2
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : unknown  unknown  v instant       1   1    923040   1  F64  : v             
     2 : unknown  unknown  v instant       1   1    923040   1  F64  : u             
   Grid coordinates :
     1 : lonlat                   : points=923040 (1440x641)
                              lon : -180 to 179.75 by 0.25 degrees_east  circular
                              lat : -80 to 80 by 0.25 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :  1 step
     RefTime =  1900-01-01 00:00:00  Units = hours  Calendar = proleptic_gregorian
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2019-08-06 12:00:00
cdo    sinfon: Processed 2 variables over 1 timestep [0.04s 56MB].

RE: Convert netcdf to grib2 - Added by nikos konstantinou over 4 years ago

Thanks a lot

It works

    (1-3/3)