Project

General

Profile

How to converting bounds of .nc to grib file?

Added by jyoti lodha almost 6 years ago

Hi
I have a issue that when I am converting my .nc file which is having (depth : 0 m bounds : 0-5 m) to grib it is not converting the grib file to proper format like(depth : 0 bounds : 0-0) where is the mistake, as I have to use (setltype,112 -chparam,-1,11). Please help me where is my mistake.

cdo sinfon /ankit/zaxis11.nc
File format : NetCDF2
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name
1 : unknown GFDL-ESM2M v instant 1 1 12960 1 F32 : mrlsl
Grid coordinates :
1 : lonlat : points=12960 (144x90)
lon : 1.25 to 358.75 by 2.5 degrees_east circular
lat : -89.49438 to 89.49438 degrees_north
available : cellbounds
Vertical coordinates :
1 : depth_below_sea : levels=1
depth : 0 m
bounds : 0-5 m
Time coordinate : 1 step
RefTime = 1861-01-01 00:00:00 Units = days Calendar = 365_day Bounds = true
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
2002-02-15 00:00:00
cdo sinfon: Processed 1 variable over 1 timestep [0.01s 17MB]

// cdo -f grb -setltype,112 -chparam,-1,11 /ankit/zaxis11.nc  /ankit/soilt01.grb

cdo setltype: Started child process "chparam,-1,11 /ankit/zaxis11.nc (pipe1.1)".
cdo(2) chparam: Processed 12960 values from 1 variable over 1 timestep [0.01s]
cdo setltype: Processed 12960 values from 1 variable over 1 timestep [0.01s 17MB]

me@5f15bd19f79c:~$ cdo sinfon /ankit/soilt01.grb
File format : GRIB
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name
1 : unknown unknown v instant 1 1 12960 1 P16 : var11
Grid coordinates :
1 : lonlat : points=12960 (144x90)
lon : 1.25 to 358.75 by 2.5 degrees_east circular
lat : -89.494 to 89.494 by 2.011101 degrees_north
Vertical coordinates :
1 : depth_below_land : levels=1
depth : 0
bounds : 0-0
Time coordinate : 1 step
RefTime = 1861-01-01 00:00:00 Units = days 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
2002-02-15 00:00:00
cdo sinfon: Processed 1 variable over 1 timestep [0.01s 13MB]

Thanking you.

soilt01.grb (25.4 KB) soilt01.grb grb file
zaxis11.nc (61.3 KB) zaxis11.nc .nc file

Replies (7)

RE: How to converting bounds of .nc to grib file? - Added by Uwe Schulzweida almost 6 years ago

GRIB1 has only 2 bytes to store the level value. You can store either the level or the bounds not both. If you want to store the bounds, then each value has only 1 byte (0-255). The units for level type 112 is "cm", the max. value is 255cm. That means the value of 5m can't be stored in GRIB1. Try to store your data in GRIB2 if possible.

RE: How to converting bounds of .nc to grib file? - Added by jyoti lodha almost 6 years ago

Hi
Again my bounds are now not converting in grib. Now my bounds values is (0-0.02 m) which is 20 cm , now also it is not converting properly, Please find me solution, and I only need grb1 file as my other files are in grib1 so mergeing cannot be done if it is in grib2.

jyoti@jyoti-HP-Pavilion-Notebook:~/Documents/ankit/newDocker$ cdo sinfon zxis.nc
File format : netCDF2
-1 : Institut Source Ttype Levels Num Points Num Dtype : Parameter name
1 : unknown GFDL-ESM2M instant 1 1 12960 1 F32 : mrlsl
Grid coordinates :
1 : lonlat : points=12960 (144x90)
lon : 1.25 to 358.75 by 2.5 degrees_east circular
lat : -89.4944 to 89.4944 degrees_north
available : cellbounds
Vertical coordinates :
1 : depth_below_sea : levels=1
depth : 0 m
bounds : 0-0.02 m
Time coordinate : 1 step
RefTime = 1861-01-01 00:00:00 Units = days Calendar = 365_day Bounds = true
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
2001-02-15 00:00:00
cdo sinfon: Processed 1 variable over 1 timestep ( 0.00s )

me@ee0176434213:~$ cdo -f grb copy -setltype,112 -chparam,-1,144 /ankit/axis.nc /ankit/tempre.grb
cdo copy: Started child process "setltype,112 -chparam,-1,144 /ankit/axis.nc (pipe1.1)".cdo(2) setltype: Started child process "chparam,-1,144 /ankit/axis.nc (pipe2.1)".

cdo(3) chparam: Processed 12960 values from 1 variable over 1 timestep [0.02s]
cdo(2) setltype: Processed 12960 values from 1 variable over 1 timestep [0.02s]
cdo copy: Processed 12960 values from 1 variable over 1 timestep [0.02s 18MB]
me@ee0176434213:~$ cdo sinfon /ankit/tempre.grb
File format : GRIB
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name
1 : unknown unknown v instant 1 1 12960 1 P16 : var144
Grid coordinates :
1 : lonlat : points=12960 (144x90)
lon : 1.25 to 358.75 by 2.5 degrees_east circular
lat : -89.494 to 89.494 by 2.011101 degrees_north
Vertical coordinates :
1 : depth_below_land : levels=1
depth : 0
bounds : 0-0
Time coordinate : 1 step
RefTime = 1861-01-01 00:00:00 Units = days 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
2001-02-15 00:00:00

zxis.nc (61.3 KB) zxis.nc zaxis
tempre.grb (25.4 KB) tempre.grb grb file

RE: How to converting bounds of .nc to grib file? - Added by Uwe Schulzweida almost 6 years ago

The CDO operator setltype set the GRIB level type but doesn't take care of the units. With "setltype,112" you change the level type to depth_below_land which has the default units "cm" in GRIB but the levels are still in "m". So the units will be simple overwritten which results in 0.02cm.
Please try it with the CDO operator setzaxis:

cat > myzaxis << EOR
zaxistype = depth_below_land
size      = 1
name      = depth
units     = "m" 
lbounds   = 0 
ubounds   = 0.02
EOR

cdo -f grb setzaxis,myzaxis infile outfile

RE: How to converting bounds of .nc to grib file? - Added by jyoti lodha almost 6 years ago

Hi

Thanks a lot. I am able to now convert it into grb by using setzaxis command.  Thanks a lot.

RE: How to converting bounds of .nc to grib file? - Added by jyoti lodha almost 6 years ago

Hi
After successfully converting it into grb, when I am merging it , is giving me one Waring ((cgribexScanTimestep1): Record 5 (id=144 lev1=0 lev2=200) timestep 1: Inconsistent verification time!),

I  am not able to understand it, what it actually  warning means.

me@f31abd9ab9db:~$ cdo merge /ankit/merge_soiltemp.grb /ankit/mrlsl_merge.grb /ankit/month_merge.grb
cdo merge: Processed 2 variables over 2 timesteps [0.02s 13MB]

me@f31abd9ab9db:~$ cdo sinfon /ankit/month.grb
Warning (cgribexScanTimestep1): Record 5 (id=144 lev1=0 lev2=200) timestep 1: Inconsistent verification time!
File format : GRIB
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter name
1 : unknown unknown v instant 4 1 12960 1 P16 : var11
2 : unknown unknown v instant 4 2 12960 1 P16 : var144
Grid coordinates :
1 : lonlat : points=12960 (144x90)
lon : 1.25 to 358.75 by 2.5 degrees_east circular
lat : -89.494 to 89.494 by 2.011101 degrees_north
Vertical coordinates :
1 : depth_below_land : levels=4
depth : 1 to 160
bounds : 0-2 to 140-180
2 : depth_below_land : levels=4
depth : 100 to 214
bounds : 0-200 to 220-208
Time coordinate : 1 step
RefTime = 1861-01-01 00:00:00 Units = days 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
2001-02-15 00:00:00

Will this warning will affect further when I will split my data and use further for WRF model.

RE: How to converting bounds of .nc to grib file? - Added by Uwe Schulzweida almost 6 years ago

The 2 input files have a different timestamp 2002-02-15T00:00:00 vs 2001-02-15T00:00:00. Here is the result of info for both files:

cdo info mrlsl_merge.grb
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2002-02-15 00:00:00     100    12960       0 :      0.0000    0.026542     0.17920 : 144           
     2 : 2002-02-15 00:00:00     214    12960       0 :      0.0000    0.015966     0.11200 : 144           
     3 : 2002-02-15 00:00:00      88    12960       0 :      0.0000    0.016754     0.11705 : 144           
     4 : 2002-02-15 00:00:00     128    12960       0 :      0.0000    0.027915     0.19967 : 144   

cdo info merge_soiltemp.grb
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2001-02-15 00:00:00       1    12960    9313 :      241.92      277.44      311.57 : 11            
     2 : 2001-02-15 00:00:00    17.5    12960    9313 :      243.07      277.69      310.94 : 11            
     3 : 2001-02-15 00:00:00      70    12960    9313 :      245.50      278.82      310.29 : 11            
     4 : 2001-02-15 00:00:00     160    12960    9313 :      247.04      280.67      309.76 : 11      
If you merge these files the GRIB records will not changed. That means both variable have still a different timestamp. CDOs internal data model needs both variables on the same timestamp. So it used the first available timestamp and gives this warning message if the timestamp changes. The result of info only looks like that these variables have the same timestamp, but this is not true:
cdo info month_merge.grb
Warning (cgribexScanTimestep1): Record  5 (id=144 lev1=0 lev2=200) timestep 1: Inconsistent verification time!
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2001-02-15 00:00:00       1    12960    9313 :      241.92      277.44      311.57 : 11            
     2 : 2001-02-15 00:00:00    17.5    12960    9313 :      243.07      277.69      310.94 : 11            
     3 : 2001-02-15 00:00:00      70    12960    9313 :      245.50      278.82      310.29 : 11            
     4 : 2001-02-15 00:00:00     160    12960    9313 :      247.04      280.67      309.76 : 11            
     5 : 2001-02-15 00:00:00     100    12960       0 :      0.0000    0.026542     0.17920 : 144           
     6 : 2001-02-15 00:00:00     214    12960       0 :      0.0000    0.015966     0.11200 : 144           
     7 : 2001-02-15 00:00:00      88    12960       0 :      0.0000    0.016754     0.11705 : 144           
     8 : 2001-02-15 00:00:00     128    12960       0 :      0.0000    0.027915     0.19967 : 144  

RE: How to converting bounds of .nc to grib file? - Added by jyoti lodha almost 6 years ago

Hi
Thanks a lot,I made a very silly mistake . I understood. Thanks:) :)

    (1-7/7)