Convert grb2 to grb1
Added by Alessio Spassiani almost 11 years ago
Hi,
I am trying to convert CFSR grib2 data downloaded from the NOMADS website to grib1 format using the CDO operator 'copy'.
The command I use is as follows:
cdo -f grb copy pgbhnl.gdas.$year$month$day$hour.grb2 cfsr.$year$month$day$hour.grb
however I get the following error:
cdo copy: Open failed on >pgbhnl.gdas.2008070418.grb2<
Unsupported file structure
I have used this operator successful with CFSv2 data which is also in grib2.
The data files I am having issues with are too large to attach but one can be downloaded from the link below.
http://nomads.ncdc.noaa.gov/modeldata/cmd_pgbh/2008/200807/20080704/pgbhnl.gdas.2008070418.grb2
Any help would be greatly appreciated, even if there is another alternative to convert these file from grib2 to grib1.
Thank you in advance,
Alessio
Replies (4)
RE: Convert grb2 to grb1 - Added by Ralf Mueller almost 11 years ago
I get the same error with
m@thingol:~/Downloads]cdo -V [22:22:49|14-05-05] Climate Data Operators version 1.6.3 (http://code.zmaw.de/projects/cdo) Compiled: by ram on thingol (x86_64-unknown-linux-gnu) Mar 3 2014 13:49:07 Compiler: gcc -g -O3 -std=gnu99 -Wall -fopenmp -march=native version: gcc (GCC) 4.8.2 20140206 (prerelease) Features: PTHREADS OpenMP NC4 OPeNDAP SZ Z UDUNITS2 Libraries: Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c CDI library version : 1.6.3 of Mar 3 2014 13:48:52 CGRIBEX library version : 1.6.3 of Jan 8 2014 19:55:18 GRIB_API library version : 1.10.0 netCDF library version : 4.3.1.1 of Mar 12 2014 13:06:59 $ HDF5 library version : 1.8.11 SERVICE library version : 1.3.1 of Mar 3 2014 13:48:47 EXTRA library version : 1.3.1 of Mar 3 2014 13:48:46 IEG library version : 1.3.1 of Mar 3 2014 13:48:46 FILE library version : 1.8.2 of Mar 3 2014 13:48:46
I also tried ncl_convert2nc
from the ncl
package. It prints some errors like
Is the JPEG2000 driver available?dec_jpeg2000: Unable to open JPEG2000 image within GRIB file. ERROR 4: `/vsimem/work415.jpc' not recognised as a supported file format.but creates a results netcdf file. Might help.
BTW, I'm not sure, if every grib2 file can be converted to grib1.
regards
ralf
RE: Convert grb2 to grb1 - Added by Ralf Mueller almost 11 years ago
here is the resulting file structure
[ram@thingol:~/Downloads]cdo sinfov pgbhnl.gdas.2008070418.nc [22:31:27|14-05-05] File format: netCDF -1 : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name 1 : unknown unknown constant 1 1 259920 1 F32 : TMP_P0_L6_GLL0 2 : unknown unknown constant 1 1 259920 1 F32 : TMP_P0_L7_GLL0 3 : unknown unknown constant 37 2 259920 1 F32 : TMP_P0_L100_GLL0 4 : unknown unknown constant 4 3 259920 1 F32 : TMP_P0_L102_GLL0 5 : unknown unknown constant 1 1 259920 1 F32 : TMP_P0_L104_GLL0 6 : unknown unknown constant 1 1 259920 1 F32 : TMP_P0_2L108_GLL0 7 : unknown unknown constant 2 4 259920 1 F32 : TMP_P0_L109_GLL0 8 : unknown unknown constant 1 1 259920 1 F32 : POT_P0_L104_GLL0 9 : unknown unknown constant 1 1 259920 1 F32 : DPT_P0_2L108_GLL0 10 : unknown unknown constant 37 2 259920 1 F32 : SPFH_P0_L100_GLL0 11 : unknown unknown constant 1 1 259920 1 F32 : SPFH_P0_2L108_GLL0 12 : unknown unknown constant 1 1 259920 1 F32 : RH_P0_L4_GLL0 13 : unknown unknown constant 37 2 259920 1 F32 : RH_P0_L100_GLL0 14 : unknown unknown constant 4 5 259920 1 F32 : RH_P0_2L104_GLL0 15 : unknown unknown constant 1 1 259920 1 F32 : RH_P0_L104_GLL0 16 : unknown unknown constant 1 1 259920 1 F32 : RH_P0_2L108_GLL0 17 : unknown unknown constant 1 1 259920 1 F32 : RH_P0_L200_GLL0 18 : unknown unknown constant 1 1 259920 1 F32 : RH_P0_L204_GLL0 19 : unknown unknown constant 1 1 259920 1 F32 : PWAT_P0_2L108_GLL0 20 : unknown unknown constant 1 1 259920 1 F32 : PWAT_P0_L200_GLL0 21 : unknown unknown constant 32 6 259920 1 F32 : CLWMR_P0_L100_GLL0 22 : unknown unknown constant 1 1 259920 1 F32 : UGRD_P0_L6_GLL0 23 : unknown unknown constant 1 1 259920 1 F32 : UGRD_P0_L7_GLL0 24 : unknown unknown constant 37 2 259920 1 F32 : UGRD_P0_L100_GLL0 25 : unknown unknown constant 4 3 259920 1 F32 : UGRD_P0_L102_GLL0 26 : unknown unknown constant 1 1 259920 1 F32 : UGRD_P0_L104_GLL0 27 : unknown unknown constant 1 1 259920 1 F32 : UGRD_P0_2L108_GLL0 28 : unknown unknown constant 2 4 259920 1 F32 : UGRD_P0_L109_GLL0 29 : unknown unknown constant 1 1 259920 1 F32 : VGRD_P0_L6_GLL0 30 : unknown unknown constant 1 1 259920 1 F32 : VGRD_P0_L7_GLL0 31 : unknown unknown constant 37 2 259920 1 F32 : VGRD_P0_L100_GLL0 32 : unknown unknown constant 4 3 259920 1 F32 : VGRD_P0_L102_GLL0 33 : unknown unknown constant 1 1 259920 1 F32 : VGRD_P0_L104_GLL0 34 : unknown unknown constant 1 1 259920 1 F32 : VGRD_P0_2L108_GLL0 35 : unknown unknown constant 2 4 259920 1 F32 : VGRD_P0_L109_GLL0 36 : unknown unknown constant 37 2 259920 1 F32 : STRM_P0_L100_GLL0 37 : unknown unknown constant 37 2 259920 1 F32 : VPOT_P0_L100_GLL0 38 : unknown unknown constant 37 2 259920 1 F32 : VVEL_P0_L100_GLL0 39 : unknown unknown constant 1 1 259920 1 F32 : VVEL_P0_L104_GLL0 40 : unknown unknown constant 37 2 259920 1 F32 : ABSV_P0_L100_GLL0 41 : unknown unknown constant 1 1 259920 1 F32 : VWSH_P0_L7_GLL0 42 : unknown unknown constant 2 4 259920 1 F32 : VWSH_P0_L109_GLL0 43 : unknown unknown constant 1 1 259920 1 F32 : USTM_P0_2L103_GLL0 44 : unknown unknown constant 1 1 259920 1 F32 : VSTM_P0_2L103_GLL0 45 : unknown unknown constant 1 1 259920 1 F32 : PRES_P0_L1_GLL0 46 : unknown unknown constant 1 1 259920 1 F32 : PRES_P0_L6_GLL0 47 : unknown unknown constant 1 1 259920 1 F32 : PRES_P0_L7_GLL0 48 : unknown unknown constant 1 1 259920 1 F32 : PRES_P0_L101_GLL0 49 : unknown unknown constant 2 4 259920 1 F32 : PRES_P0_L109_GLL0 50 : unknown unknown constant 1 1 259920 1 F32 : PRMSL_P0_L101_GLL0 51 : unknown unknown constant 1 1 259920 1 F32 : HGT_P0_L1_GLL0 52 : unknown unknown constant 1 1 259920 1 F32 : HGT_P0_L4_GLL0 53 : unknown unknown constant 1 1 259920 1 F32 : HGT_P0_L6_GLL0 54 : unknown unknown constant 1 1 259920 1 F32 : HGT_P0_L7_GLL0 55 : unknown unknown constant 37 2 259920 1 F32 : HGT_P0_L100_GLL0 56 : unknown unknown constant 2 4 259920 1 F32 : HGT_P0_L109_GLL0 57 : unknown unknown constant 1 1 259920 1 F32 : HGT_P0_L204_GLL0 58 : unknown unknown constant 2 7 259920 1 F32 : GPA_P0_L100_GLL0 59 : unknown unknown constant 1 1 259920 1 F32 : 5WAVH_P0_L100_GLL0 60 : unknown unknown constant 1 1 259920 1 F32 : 5WAVA_P0_L100_GLL0 61 : unknown unknown constant 1 1 259920 1 F32 : CWAT_P0_L200_GLL0 62 : unknown unknown constant 1 1 259920 1 F32 : PLI_P0_2L108_GLL0 63 : unknown unknown constant 1 1 259920 1 F32 : CAPE_P0_L1_GLL0 64 : unknown unknown constant 3 8 259920 1 F32 : CAPE_P0_2L108_GLL0 65 : unknown unknown constant 1 1 259920 1 F32 : CIN_P0_L1_GLL0 66 : unknown unknown constant 3 8 259920 1 F32 : CIN_P0_2L108_GLL0 67 : unknown unknown constant 2 9 259920 1 F32 : HLCY_P0_2L103_GLL0 68 : unknown unknown constant 1 1 259920 1 F32 : LFTX_P0_L1_GLL0 69 : unknown unknown constant 1 1 259920 1 F32 : 4LFTX_P0_L1_GLL0 70 : unknown unknown constant 1 1 259920 1 F32 : TOZNE_P0_L200_GLL0 71 : unknown unknown constant 37 2 259920 1 F32 : O3MR_P0_L100_GLL0 72 : unknown unknown constant 1 1 2 2 F32 : lv_HTGL7_l1 73 : unknown unknown constant 1 1 2 2 F32 : lv_HTGL7_l0 74 : unknown unknown constant 1 1 3 3 F32 : lv_SPDL6_l1 75 : unknown unknown constant 1 1 3 3 F32 : lv_SPDL6_l0 76 : unknown unknown constant 1 1 4 4 F32 : lv_SIGL3_l1 77 : unknown unknown constant 1 1 4 4 F32 : lv_SIGL3_l0 Grid coordinates : 1 : lonlat > size : dim = 259920 nx = 720 ny = 361 lon_0 : first = 0 last = 359.5 inc = 0.5 degrees_east circular lat_0 : first = 90 last = -90 inc = -0.5 degrees_north 2 : generic > size : dim = 2 nx = 2 ny = 0 3 : generic > size : dim = 3 nx = 3 ny = 0 4 : generic > size : dim = 4 nx = 4 ny = 0 Vertical coordinates : 1 : surface : 0 2 : pressure Pa : 100 200 300 500 700 1000 2000 3000 5000 7000 10000 12500 15000 17500 20000 22500 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 77500 80000 82500 85000 87500 90000 92500 95000 97500 100000 3 : generic m : 1829 2743 3658 4572 4 : generic K m2 kg-1 s- : -1.99999999e-06 1.99999999e-06 5 : generic level : 1 2 3 4 6 : pressure Pa : 1000 2000 3000 5000 7000 10000 12500 15000 17500 20000 22500 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 77500 80000 82500 85000 87500 90000 92500 95000 97500 100000 7 : pressure Pa : 50000 100000 8 : generic level : 1 2 3 9 : generic level : 1 2 cdo sinfon: Processed 77 variables ( 0.00s )
RE: Convert grb2 to grb1 - Added by Alessio Spassiani almost 11 years ago
Thanks for the response Ralf.
I ended up downloading the CFSR data from CISL Research Data Archive which doesn't give me the error I was getting before.
I however noticed that when I do change the format from grib2 to grib1 certain variables aren't carried over and new ones are created in the process.
This is the control file for the data originally in grib2.
dset ^./cfsr.%y4%m2%d2.grb2 index ^./cfsr.20080703.grb2.idx undef 9.999E+20 title ./cfsr.20080703.grb2 * produced by g2ctl v0.0.8.8 * command line options: -0 ./cfsr.%y4%m2%d2.grb2 * griddef=1:0:(720 x 361):grid_template=0:winds(N/S): lat-lon grid:(720 x 361) units 1e-06 input WE:NS output WE:SN res 48 lat 90.000000 to -90.000000 by 0.500000 lon 0.000000 to 359.500000 by 0.500000 #points=259920:winds(N/S) dtype grib2 options template ydef 361 linear -90.000000 0.5 xdef 720 linear 0.000000 0.500000 tdef 3449 linear 00Z03jul2008 6hr * PROFILE hPa zdef 37 levels 100000 97500 95000 92500 90000 87500 85000 82500 80000 77500 75000 70000 65000 60000 55000 50000 45000 40000 35000 30000 25000 22500 20000 17500 15000 12500 10000 7000 5000 3000 2000 1000 700 500 300 200 100 options pascals vars 6 HGTprs 37,100 0,3,5 ** (1000 975 950 925 900.. 7 5 3 2 1) Geopotential Height [gpm] PRESmsl 0,101,0 0,3,0 ** mean sea level Pressure [Pa] PRMSLmsl 0,101,0 0,3,1 ** mean sea level Pressure Reduced to MSL [Pa] TMPprs 37,100 0,0,0 ** (1000 975 950 925 900.. 7 5 3 2 1) Temperature [K] UGRDprs 37,100 0,2,2 ** (1000 975 950 925 900.. 7 5 3 2 1) U-Component of Wind [m/s] VGRDprs 37,100 0,2,3 ** (1000 975 950 925 900.. 7 5 3 2 1) V-Component of Wind [m/s] ENDVARS
And here is the control file after converting to grib1.
dset ^./cfsr.%y4%m2%d2.grb index ^./cfsr.20080703.grb.idx undef 9.999E+20 title ./cfsr.20080703.grb * produced by grib2ctl v0.9.12.6 dtype grib 255 options template options yrev ydef 361 linear -90.000000 0.5 xdef 720 linear 0.000000 0.500000 tdef 3449 linear 00Z03jul2008 6hr * z has 37 levels, for prs zdef 37 levels 1000 975 950 925 900 875 850 825 800 775 750 700 650 600 550 500 450 400 350 300 250 225 200 175 150 125 100 70 50 30 20 10 7 5 3 2 1 vars 5 ICAHTprs 37 5,100,0 ** (profile) ICAO Standard Atmosphere Reference Height [M] PRESmsl 0 1,102,0 ** mean-sea level Pressure [Pa] PRMSLprs 37 2,100,0 ** (profile) Pressure reduced to MSL [Pa] var0prs 37 0,100,0 ** (profile) undefined var0msl 0 0,102,0 ** mean-sea level undefined ENDVARS
Do you have any thoughts as to why that is.
Thanks for the help,
Alessio
cfsr_08_10.ctl (1.25 KB) cfsr_08_10.ctl | Control file of the data in grib2 | ||
cfsr_08_10_grb.ctl (751 Bytes) cfsr_08_10_grb.ctl | Control file of the data converted to grib1 |
RE: Convert grb2 to grb1 - Added by Ralf Mueller almost 11 years ago
As I said: grib2 is a developing standard,so there will be variables defined in grib2 but not in grib1. See this note from grib homepage.