Grib2Config

From Wiki

Contents

1 Description

The GRIB2 config file is used by grib2_decode and grib2_encode to do the translation between the RPN standard file and the GRIB2 records.

Lines with a # in the first column (comment lines) and empty lines are not treated. Only the first line of file has special usage (see File components)

For a dictionary entry to be valid, all elements must be present and on the same line. Anything following on the line is considered as comments.

2 File components

  1. The first line should be #%SG_CONF_002. This is used as the version of GRIB2 config file.
  2. The other lines is a set of columns. The first column should be either the string CONF or a GRIB2 section indicator. The next section  describes columns.
  3. The second line should be the GRIB2 global parameters setting. It has 16 columns. The config file could contain several different global parameters setting lines. Grib2_decode or grib2_encode will select the right one according to their arguments.

3 Section description

The config file sets at least three GRIB2 sections. The global parameters setting that is named section0 lines, the section4 lines and the section5 lines.The version 2 of config file sets also a fourth global line when using common table of grib2. Here is the description of these sections.

3.1   Section0 lines

Each line should have 16 columns.
Col No. Parameter Name Default value Comment
  1 section 00 Section number (should be 0 )
  2 discipline 00 GRIB2 discipline ( code table 0.0)
  3 mastertabl 00 GRIB2 master table (code table 1.0)
  4 localtabl 00 Version num of GRIB2 local table (code 1.1)
  5 sgnf_ref_tim 00 Signicance of reference time (code table 1.2)
  6 prod_status 00 Production status of processed data (code table 1.3)
  7 prod_datatyp 00 Type of prcessed data in GRIB2 message (code table 1.4)
  8 forc_datatyp 00 Force to use the above yype of prcessed data in GRIB2 message (code table 1.4)
  9 pd_tplate 00 Product definition template number (code table 4.0)
10 pd_cat 00 Parameter category (code table 4.1)
11 pd_num 00 Parameter number (code table 4.2)
12 def_typprocess 00 Type of generating process (code table 4.3)
13 pd_ltyp 00 Type of fixed surface (code table 4.5)
14 def_process 00 Generating process
15 def_bg_process 00 Background generating process
16 dr_tplate 40 Data representation template number (code table 5.0). The Config line for template 5.40 should follow in this file when 40 is the value of dr_tplate.


3.2   Variables for Chimical Parameters lines -

Each line should have 5 columns.
Col No. Parameter Name Default value Comment
1 CONF
Should be this string
2 ATMCHIM
Should be this string (in lower or upper case)
3 nn -- Grib2 section number (default = 04. "--" means it is defined for any section for grib2 (0,2,..,8))
4 XX -- Sdt variable name (default = "--". "--" means it is defined for any Sdt variabl)
5 mm 65535 Atmospheric chemical or physical constituent type (code table 4.230). "--" means use missing value (65535)

3.3   Variables for Optical Properties of Aerosol Parameters lines -

Each line should have 15 columns.
Col No. Parameter Name Default value Comment
1 CONF
Should be this string
2 OPAEROSOL
Should be this string (in lower or upper case)
3 nn -- Grib2 section number (default = 04. "--" means it is defined for any section for grib2 (0,2,..,8))
4 XX -- Sdt variable name (default = "--". "--" means it is defined for any Sdt variabl)
5 m2 65535 Aerosol type (Common Code Table C-14)
6 m1 255 Aerosol type (Common Code Table C-14)
7 m1 00 Scale factor of first size
8 m2 00 Scale value of first size in metre
9 m1 00 Scale factor of second size
10 m2 00 Scale value of second size in metre
11 m1 255 Type of interval for first and second wavelength (code table 4.91)
12 m1 00 Scale factor of first wavelength
13 m2 00 Scale value of first wavelength in metre
14 m1 00 Scale factor of second wavelength
15 m2 00 Scale value of second wavelength in metre

3.4   Section4 lines - pd template 4.1

Each line should have 6 columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 01 Product definition template number (should be 1 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 typ_ens_fcst 00 Type of ensemble forecast (code table 4.6)
5 pert_num 00 Pertubation number (should be a number )
6 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)

3.5   Section4 lines - pd template 4.2

Each line should have 6 columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 02 Product definition template number (should be 2 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the sum of the derived forecast (code table 4.7) and the beginning of interval (10000*deriv_fcst + begin_interval)
5 deriv_fcst 00 Derived forecast (code table 4.7)
6 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)

3.6   Section4 lines - pd template 4.5

Each line should have 11 columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 05 Product definition template number (should be 5)
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 fcst_prob_num_5 1 Forecast probability number
6 num_fcst_prob_5 1 Total number of forecast probabilities
7 prob_type_5 1 Probability type (code table 4.9)
8 scal_fact_lo_5 0 Scale factor of lower limit
9 scal_val_lo_5 0 Scale value of lower limit
10 scal_fact_up_5 0 Scale factor of upper limit
11 scal_val_up_5 0 Scale value of upper limit

3.7   Section4 lines - pd template 4.6

Each line should have 5 columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 06 Product definition template number (should be 6 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 typ_ens_fcst 00 Type of ensemble forecast (code table 4.6)
5 percentile_val 50 Percentile value

3.8   Section4 lines - pd template 4.8

Each line should have 6 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 08 Product definition template number (should be 8 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 num_tim_int 1 Number of time range specifications describing
6 num_mis_val 0 Total number of data values missing in statitical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 0 statistical process used to calculate the processd field (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field.
.... (num_tim_int times ) ....

3.9   Section4 lines - pd template 4.9

Each line should have 13 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 9 Product definition template number (should be 9 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 num_tim_int 1 Number of time range specifications describing...
6 fcst_prob_num 1 Forecast probability number
7 num_fcst_prob 1 Total number of forecast probabilities
8 prob_type 1 Probability type (code table 4.9)
9 scal_fact_lo 0 Scale factor of lower limit
10 scal_val_lo 0 Scale value of lower limit
11 scal_fact_up 0 Scale factor of upper limit
12 scal_val_up 0 Scale value of upper limit
13 num_mis_val 0 Total number of data values missing in statitical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 0 statistical process used to calculate the processd field (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field .
.... (num_tim_int times)

3.10   Section4 lines - pd template 4.10

Each line should have 7 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 10 Product definition template number (should be 10 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 percentil_va 1 percentile value (100% to 0% )
6 num_tim_int 1 Number of time range specifications describing..
7 num_mis_val 1 Total number of data values missing in statitical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 0 statistical process used to calculate the processd field (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field .
.... (num_tim_int times)

3.11   Section4 lines - pd template 4.11

Each line should have 9 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 11 Product definition template number (should be 11)
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 typ_ens_fcst 00 Type of ensemble forecast (code table 4.6)
6 pert_num 00 Pertubation number (should be a number )
7 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)
8 num_tim_int 1 Number of time range specifications describing..
9 num_mis_val 0 Total number of data values missing in statitical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 00 statistical process used to calculate the processd field (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field.
...(num_tim_int times )

3.12   Section4 lines - pd template 4.12

Each line should have 8 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tpla 12 Product definition template number (should be 12 )
3 var_nam -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the sum of the derived forecast (code table 4.7) and the beginning of interval 100*deriv_fcst + begin_interval
5 deriv_fcst 00 derived forecast (code table 4.7)
6 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)
7 num_tim_int 1 Number of time range specifications describing..
8 num_mis_val 0 Total number of data values missing in statistical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc_ 00 Type of statistical processing (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field.
...(num_tim_int times )

3.13   Section4 lines - pd template 4.31

Each line should have 6 + 5*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 31 Product definition template number (should be 31 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the channel number of satellite (0 = do not set )
5 num_const_sp_band 1 Number of contibuting spectral bsnds(NB)
6 Channel_num 0 channel number of the satellite
repeat the rows bellow num_cont_sp_band times ...
+1 _SAT_SER_B 0 Satellite series of band nb (code table defined by originating/generating centre)
+2 _SAT_NUM_B 0 Satellite number of band nb (code table difined by originating/generating centre)
+3 _INST_TYP_B 0 Instrument type of band nb (code table difined by originating/generating centre)
+4 _SCAL_FACT_WAV_NUM_B 0 Scale factor of central wave number of band nb
+5 _SCAL_VAL_WAV_NUM_B 1 Scale value of central wave number of band nb
.... ( num_cont_sp_band times ) ....

3.14   Section4 lines - pd template 4.41

Each line should have 6 columns.
Col No. Parameter Name Default value Comment
1 section 4 Section number (should be 4 )
2 pd_tplate 41 Product definition template number (should be 41 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 typ_ens_fcst 00 Type of ensemble forecast (code table 4.6)
5 pert_num 00 Perturbation number (should be a number )
6 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)

3.15 Section4 lines - pd template 4.42

Each line should have 6 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 42 Product definition template number (should be 42 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 num_tim_int 1 Number of time range specifications describing..
6 num_mis_val 0 Total number of data values missing in statistical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 00 type of statistical processing(code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field .
...(num_tim_int times )

3.16 Section4 lines - pd template 4.43

Each line should have 9 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 43 Product definition template number (should be 43 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 typ_ens_fcst 00 Type of ensemble forecast (code table 4.6)
6 pert_num 00 Pertubation number (should be a number )
7 num_fcst_ens 21 Number of forecasts in ensemble (should be a number)
8 num_tim_int 1 Number of time range specifications describing..
9 num_mis_val 0 Total number of data values missing in statistical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 00 Type of statistical processing (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field .
... (num_tim_int times)

3.17 Section4 lines - pd template 4.61

Each line should have 10 + 6*n columns.
Col No. Parameter Name Default value Comment
1 section 04 Section number (should be 4 )
2 pd_tplate 61 Product definition template number (should be 61 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 std_ip3 1 Set std ip3 to the beginning of interval (0 = do not set )
5 Date_model 00000000000000 Date of model version (AAAAMMDDhhmmss)
6 Typ_enses_fcst 00 Type of ensemble forecast (code table 4.6)
7 pert_num 00 Pertubation number (should be a number )
8 num_fcst_ens 00 Number of forecasts in ensemble (should be a number)
9 num_tim_int 1 Number of time range specifications describing..
10 num_mis_val 0 Total number of data values missing in statistical process
repeat the rows bellow num_tim_int times ...
+1 stat_proc 00 Type of statistical processing (code table 4.10)
+2 typ_tim_inc 1 Type of time increment between succ. field... (code table 4.11)
+3 ind_unit_tim 1 Indicator of unit of time ...(code table 4.4)
+4 len_tim_rang 6 Length of time range over which stat...
+5 ind_tim_rang_inc 1 Indicator of unit of time ...(code table 4.4)
+6 tim_inc 0 Time increment between succ. field .
... (num_tim_int times)

3.18 Section5 lines - dr template 5.40

Each line should have 5 columns.
Col No. Parameter Name Default value Comment
1 section 5 Section number (should be 5 )
2 dr_tplate 40 Data representation template number (should be 40 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 jpg_typ_comp 00 Type of compression used (code table 5.40)
5 jpg_tag_comp 255 Target compression ratio M:1 ...

3.19 Section5 lines - dr template 5.41

Each line should have 4 columns.
Col No. Parameter Name Default value Comment
1 section 5 Section number (should be 5 )
2 dr_tplate 41 Data representation template number (should be 41 )
3 var_name -- Std var name (may be -- or should be listed in grib2 dict)
4 png_nbit_pack 24 The depth of image

4 Example of grib2config file

#  1   2    3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21
# config for analysis/forecast
   0  00   04  00  00  00  02  01  00  00  00  02  00  45  45  40
# config for ensemble
   0  00   04  00  01  04  02  01  01  00  00  04  00  45  45  40
#  
   4  01   --  00  00  21
   4  08   T7  01  --  00  03  02  --  --  --  --  --  --  --  --  --  --  --
   4  08   T8  01  --  00  02  02  --  --  --  --  --  --  --  --  --  --  --
   4  08   NT  01  --  00  00  02  --  --  --  --  --  --  --  --  --  --  --
#
#  4  08   TN  01  --  00  00  02  --  --  --  --  --  --  --  --  --  --  --
#  4  08   GR  01  --  00  00  02  --  --  --  --  --  --  --  --  --  --  --
#  4  08   RA  01  --  00  00  02  --  --  --  --  --  --  --  --  --  --  --
#  4  08   ZR  01  --  00  00  02  --  --  --  --  --  --  --  --  --  --  --

   4  05   UP  01  --  --  --   0   0   3  17491
   4  05   UP  01  --  --  --   0   0   3  25722
   4  05   UP  01  --  --  --   0   0   3  32924
#
   4  08   RN  01  --  00  01  02  --  --  --  -- 
   4  08   SN  01  --  00  01  02  --  --  --  -- 
   4  08   PE  01  --  00  01  02  --  --  --  -- 
   4  08   FR  01  --  00  01  02  --  --  --  -- 
   4  08   PR  01  --  00  01  02  --  --  --  -- 
   4  08   PC  01  --  00  01  02  --  --  --  -- 
#
   4  09   UP  01  --  --  --  --   0   0   3  17491  --  01  00  01  02  --  --  --  -- 
   4  09   UP  01  --  --  --  --   0   0   3  25722  --  01  00  01  02  --  --  --  -- 
   4  09   UP  01  --  --  --  --   0   0   3  32924  --  01  00  01  02  --  --  --  -- 
#
   4  11   T7  01  --  00  21  01  --  03  02  --  --  --  --
   4  11   T8  01  --  00  21  01  --  02  02  --  --  --  --
   4  11   NT  01  --  00  21  01  --  00  02  --  --  --  --
#
#  4  11   TN  01  --  00  21  01  --  00  02  --  --  --  --
#  4  11   GR  01  --  00  21  01  --  00  02  --  --  --  --
#  4  11   RA  01  --  00  21  01  --  00  02  --  --  --  --
#  4  11   ZR  01  --  00  21  01  --  00  02  --  --  --  --
#
   4  11   RN  01  --  00  21  01  --  01  02  01  --  255 00
   4  11   SN  01  --  00  21  01  --  01  02  01  --  255 00
   4  11   PE  01  --  00  21  01  --  01  02  01  --  255 00
   4  11   FR  01  --  00  21  01  --  01  02  01  --  255 00
   4  11   PR  01  --  00  21  01  --  01  02  01  --  255 00
   4  11   PC  01  --  00  21  01  --  01  02  01  --  255 00
#