To copy only those messages for parameter T from the GRIB file tz_an_pl.grib1 use grib_copy with the -w option to specify a shortName=t: No Format |
---|
$> grib_copy -w shortName=t tz_an_pl.grib1 t_an_pl.grib1 |
Similarly to copy only those messages for parameter Z, use: No Format |
---|
$> grib_copy -w shortName=z tz_an_pl.grib1 z_an_pl.grib1 |
Or, more simply, and because the file contains only parameters T and Z, one can use: No Format |
---|
$> grib_copy tz_an_pl.grib1 "[shortName]_an_pl.grib1" |
Using grib_ls of the two files confirms that the contents are correct. For example: No Format |
---|
$> grib_ls -p centre,paramId,typeOfLevel,level,date,dataType,time,shortName t_an_pl.grib1
t_an_pl.grib1
centre paramId typeOfLevel level date dataType time shortName
ecmf 130 isobaricInhPa 1000 20170219 an 1200 t
ecmf 130 isobaricInhPa 850 20170219 an 1200 t
ecmf 130 isobaricInhPa 700 20170219 an 1200 t
ecmf 130 isobaricInhPa 500 20170219 an 1200 t
ecmf 130 isobaricInhPa 400 20170219 an 1200 t
ecmf 130 isobaricInhPa 300 20170219 an 1200 t
6 of 6 messages in t_an_pl.grib1
6 of 6 total messages in 1 files |
You can take this further and split the file tz_an_pl.grib1 into separate files for each parameter/pressure level combination with: No Format |
---|
$> grib_copy tz_an_pl.grib1 "[shortName]_[level].grib[edition]"
$> ls ?_*.grib1
t_1000.grib1 t_400.grib1 t_700.grib1 z_1000.grib1 z_400.grib1 z_700.grib1
t_300.grib1 t_500.grib1 t_850.grib1 z_300.grib1 z_500.grib1 z_850.grib1 |
Each file contains one message only, e.g.: No Format |
---|
$> grib_ls -p centre,paramId,typeOfLevel,level,date,dataType,time,shortName t_1000.grib1
t_1000.grib1
centre paramId typeOfLevel level date dataType time shortName
ecmf 130 isobaricInhPa 1000 20170219 an 1200 t
1 of 1 messages in t_1000.grib1
1 of 1 total messages in 1 files |
|