Project

General

Profile

help!conveting binary data to grib data

Added by B.F. Jiao over 7 years ago

hello,
I have a binary file associated with a ctl file.For a variety of reasons,it has to be transformed to grb format with 'cdo -f grb import_binary file.ctl file.grb'.It works normally and generates file.grb.I still have some questions about it:
1).When I use ncl_filedump to check the info of the file.grb,a warning massage,warning:NclGRIB: Unrecognized parameter table (center 0, subcenter 0, table 255), defaulting to NCEP operational table: variable names and units may be incorrect,is produced.How to fix it?
2).An operator named setparam seems to be needed to change the name of variables.There are two variables in the file,crain for combined analysis rain and gsamp for gauge sampling.I don't know the exact setting to change the names of them.
3)this is a part of variables info:
float PRES_GDS0_99 ( g0_lat_0, g0_lon_1 )
center : unknown
long_name : Pressure
units : Pa
_FillValue : 1e+20
level_indicator : 99
gds_grid_type : 0
parameter_table_version : 255
parameter_number : 1
forecast_time : 0
forecast_time_units : hours
initial_time : 08/01/2014 (00:00)
I guess the value of center is related to the first question

Any help is greatly appreciated thank you

-Jiao B.F.


Replies (1)

RE: help!conveting binary data to grib data - Added by Uwe Schulzweida over 7 years ago

Here are the first few lines from "cdo sinfo file.grb":

   File format : GRIB
    -1 : Institut Source   Steptype Levels Num    Points Num Dtype : Parameter ID
     1 : unknown  unknown  instant       1   1    308000   1  P16  : 1             
     2 : unknown  unknown  instant       1   1    308000   1  P16  : 2             
The first variable has the parameter ID 1 and the second variable the ID 2. These IDs where automatically generates by CDO if no other information is available.
You can change these IDs with the CDO operator chparam. Here is an example which changes the ID 1 to 88.199 and ID 2 to 150.199:
cdo chparam,1,88.199,150.199 file.grb result.grb
The first number XX in XX.YY is the code number and YY the table number. 88.199 means code number 88 in parameter table 199. GRIB does not store the variable name. In GRIB the variable name must be derived from the code number and the corresponding table. That mean the GRIB interpreter/decoder needs to know the parameter table in order to assign the correct variable name.

Cheers,
Uwe

    (1-1/1)