Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleSolution...

To change the date and time for the GRIB messages in file.grib1 use:

Code Block
% grib_set -s dataDate=20190204,dataTime=12 file.grib1 file_fixed.grib1

 


Using grib_ls confirms that this has been done correctly: 


Code Block
% grib_ls -p centre,shortName,typeOfLevel,level,dataDate,dataTime file_fixed.grib1
    filefile_fixed.grib1
   centre       shortName    typeOfLevel  level        dataDate     dataTime     
   ecmf         z            isobaricInhPa  1000         2019020120190204     012        
   ecmf         t            isobaricInhPa  1000         2019020120190204     012        
   ecmf         z            isobaricInhPa  850          2019020120190204     012        
   ecmf         t            isobaricInhPa  850          2019020120190204     012        
   ecmf         z            isobaricInhPa  700          2019020120190204     012        
   ecmf         t            isobaricInhPa  700          2019020120190204     012        
   ecmf         z            isobaricInhPa  500          2019020120190204     012        
   ecmf         t            isobaricInhPa  500          2019020120190204     012        
   ecmf         z            isobaricInhPa  400          2019020120190204     012        
   ecmf         t            isobaricInhPa  400          2019020120190204     012        
   ecmf         z            isobaricInhPa  300          2019020120190204     012        
   ecmf         t            isobaricInhPa  300          2019020120190204     012        
   12 of 12 grib messages in file_fixed.grib1
 
   12 of 12 total grib messages in 1 files

...

Expand
titleSolution...

If grib_set is used with the -S option, only the changed GRIB message is copied to the output file:

Code Block
 % grib_set -S -w shortName=t,level=500 -s dataDate=20190204,dataTime=12 file.grib1 t500_only.grib1

 


Again, grib_ls can be used to confirm the output is correct:

Code Block
% grib_ls -p centre,shortName,typeOfLevel,level,dataDate,dataTime t500_only.grib1  t500_only.grib1
 
 centre       shortName    typeOfLevel  level        dataDate     dataTime                                                         
  ecmf         t            isobaricInhPa  500          20190204     12           
  1 of 1 grib messages in t500_only.grib1
 
  1 of 1 total grib messages in 1 files

...

3. Use grib_to_netcdf to convert the GRIB messages in file2.grib1 to NetCDF.

...