Trouble Converting GRIB to NetCDF - Parameter Table Issue
Added by Roman Attinger over 9 years ago
Hello all
Im currently having some issues correctly converting GRIB files to NetCDF, especially regarding the conversion of the parameter ID from the GRIB files (I am aware that NetCDF has no parameter ID's).
Im attempting to convert using the following command, followed by the dump to see if it worked:
cdo -f nc copy ML20010101_00.grb2 ML20010101_00.nc ncdump -h ML20010101_00.nc
however not all variables have been correctly recognized, the last 3 parameters only show as param214.1.0 - param216.1.0
netcdf ML20010101_00 { dimensions: lon = 360 ; lat = 181 ; height = 1 ; height_2 = 1 ; time = UNLIMITED ; // (1 currently) variables: double lon(lon) ; lon:standard_name = "longitude" ; lon:long_name = "longitude" ; lon:units = "degrees_east" ; lon:axis = "X" ; .... // cut for convenience float clct(time, lat, lon) ; clct:long_name = "Total Cloud Cover" ; clct:units = "%" ; clct:param = "1.6.0" ; float param214.1.0(time, lat, lon) ; float param215.1.0(time, lat, lon) ; float param216.1.0(time, lat, lon) ; // global attributes: :CDI = "Climate Data Interface version 1.6.8 (http://mpimet.mpg.de/cdi)" ; :Conventions = "CF-1.4" ; :history = "Thu Sep 17 21:15:57 2015: cdo -f nc copy ML20010101_00.grb2 ML20010101_00.nc" ; :institution = "Deutscher Wetterdienst" ; :CDO = "Climate Data Operators version 1.6.8 (http://mpimet.mpg.de/cdo)" ; }
I attempted to add the -t ecmwf option, and I also attempted to create my own Parameter table (gribtab) as follows according to the wiki: https://code.zmaw.de/projects/cdo/embedded/index.html#x1-300001.6
1.3.0 PMSL Sea-level Pressure [Pa] 11.0.0 ACCSHFL_S Surface sensible heat ux mean since model start [J m**-2] 10.0.0 ACCLHFL_S Surface latent heat ux mean since model start [J m**-2] 5.5.0 ACCTHB_S Surface net thermal radiation mean since model start [J m**-2] 5.5.0 ACCTHB_T TOA net thermal radiation mean since model start [J m**-2] 9.4.0 ACCSOB_S Surface net solar radiation mean since model start [J m**-2] 9.4.0 ACCSOB_T TOA net solar radiation mean since model start [J m**-2] 7.4.0 DSWRF Top down solar radiation mean since model start [J m**-2] 2.2.0 U_10M U component of wind [m s**-1] 3.2.0 V_10M V component of wind [m s**-1] 0.0.0 T_2M Temperature [K] 52.1.0 TOT_PREC Total Precipitation [kg m**-2] 77.1.0 RAIN_GSP Large scale rain rate (s) [kg m**-2 s**-1] 76.1.0 RAIN_CON Convective rain rate (s) [kg m**-2 s**-1] 56.1.0 SNOW_GSP Large-Scale snowfall rate water equivalent (s) [kg m**-2 s**-1] 55.1.0 SNOW_CON Convective Snowfall rate water equivalent (s) [kg m**-2 s**-1] 0.0.0 T_G Weighted surface temperature [K] 1.6.0 CLCT Total cloud cover [%] 214.1.0 TQV_DIA Total Specific humidity (diagnostic) [Kg/Kg] 215.1.0 TQC_DIA Total Specific cloud water content (diagnostic) [Kg/Kg] 216.1.0 TQI_DIA Total Specific cloud ice content (diagnostic) [Kg/Kg]
However no matter what I enter, CDO simply doesn't want to use my definitions of the parameter ID's and used the default ones as showed above...
These were the commands I tried:
cdo -t gribtab2 -f nc copy ML20010101_00.grb2 ML20010101_00.nc # I also attempted the following: cdo -f nc copy -setpartab,gribtab ML20010101_00.grb2 ML20010101_00.nc
Anybody knows where the error in my code is?
ML20010101_00.grb2 (2.61 MB) ML20010101_00.grb2 |
Replies (6)
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Jaison-Thomas Ambadan over 9 years ago
try using setpartabn Have a look at the example by Uwe: https://code.zmaw.de/boards/53/topics/1764
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Uwe Schulzweida over 9 years ago
Forget the CDO option -t. This option is use only to set GRIB1 parameters (decoded with our internal GRIB library).
GRIB2 files are decoded with the GRIB_API and the parameter are converted automatically. If they are wrong/missing or not available in the GRIB_API then you can use setpartabn to set these parameter. But before you should better try it with the latest GRIB_API version.
I simple converted your file with cdo version 1.6.9 and GRIB_API version 1.13.1 and my result is:
float CLCT(time, lat, lon) ; CLCT:long_name = "Total Cloud Cover" ; CLCT:units = "%" ; CLCT:param = "1.6.0" ; float TQV_DIA(time, lat, lon) ; TQV_DIA:long_name = "Total column integrated water vapour (diagnostic) " ; TQV_DIA:units = "kg m-2" ; TQV_DIA:param = "214.1.0" ; float TQC_DIA(time, lat, lon) ; TQC_DIA:long_name = "Total column integrated cloud water (diagnostic) " ; TQC_DIA:units = "kg m-2" ; TQC_DIA:param = "215.1.0" ; float NCRAIN(time, lat, lon) ; NCRAIN:long_name = "Specific number concentration of rain" ; NCRAIN:units = "kg-1" ; NCRAIN:param = "216.1.0" ; // global attributes: :CDI = "Climate Data Interface version 1.6.9 (http://mpimet.mpg.de/cdi)" ; :Conventions = "CF-1.4" ; :history = "Fri Sep 18 09:16:00 2015: cdo-1.6.9 -f nc copy ML20010101_00.grb2 ML20010101_00.nc" ; :institution = "Deutscher Wetterdienst" ; :CDO = "Climate Data Operators version 1.6.9 (http://mpimet.mpg.de/cdo)" ;
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Roman Attinger over 9 years ago
Great, after the update the conversion worked perfectly! Thanks for the help
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Anna marra over 7 years ago
Good morning,
I do have the same problem in converting GRIB to NetCDF. I use the latest version of grib_api (1.14.4) and cdo, but it does not work to me. I attach the input grib file and the output nc I get when I run
cdo -f nc copy in.grb out.nc
Please, could anyone help me?
Thank you
Anna
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Ralf Mueller over 7 years ago
Hi!
I converted out input file with the latest CDO release
Climate Data Operators version 1.9.2 (http://mpimet.mpg.de/cdo) Compiled: by ram on melian (x86_64-unknown-linux-gnu) Nov 21 2017 16:04:57 CXX Compiler: g++ -g -O3 -std=c++11 -Wall -fopenmp -march=native CXX version : g++ (GCC) 7.2.0 C Compiler: gcc -g -O3 -std=gnu99 -Wall -fopenmp -march=native C version : gcc (GCC) 7.2.0 F77 Compiler: gfortran -g -O2 F77 version : GNU Fortran (GCC) 7.2.0 Features: 15GB Fortran DATA PTHREADS OpenMP45 HDF5 NC4/HDF5 OPeNDAP SZ UDUNITS2 PROJ.4 XML2 MAGICS CURL FFTW3 AVX2 Libraries: HDF5/1.10.1 proj/4.93 xml2/2.9.7 curl/7.56.1 Filetypes: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 CDI library version : 1.9.2 of Nov 21 2017 16:03:52 CGRIBEX library version : 1.9.0 of Sep 29 2017 10:16:02 GRIB_API library version : 2.4.1 NetCDF library version : 4.5.0 of Oct 28 2017 00:21:44 $ HDF5 library version : 1.10.1 SERVICE library version : 1.4.0 of Nov 21 2017 16:03:49 EXTRA library version : 1.4.0 of Nov 21 2017 16:03:48 IEG library version : 1.4.0 of Nov 21 2017 16:03:48 FILE library version : 1.8.3 of Nov 21 2017 16:03:48
with
cdo -f nc copy in.grb in.nc
is the uploaded file ok?
RE: Trouble Converting GRIB to NetCDF - Parameter Table Issue - Added by Ralf Mueller over 7 years ago
I use eccodes
instead of grib_api
for building CDO.