Versions Compared

Key

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

...

Verbose.

grib_copy examples

  1. To copy only the pressure levels from a file

    Code Block
    
    >  grib_copy -w levtype=pl ../data/tigge_pf_ecmwf.grib2 out.grib
    

...


  1. To copy only the fields that are not on pressure levels from a file

    Code Block
    
    >  grib_copy -w levtype!=pl ../data/tigge_pf_ecmwf.grib2 out.grib
    

 


  1. To copy only the first three fields from a file

    Code Block
    
    >  grib_copy -w count=1/2/3 ../data/tigge_pf_ecmwf.grib2 out.grib
    

 


  1. A grib_file with multi field messages can be converted in single field messages with a simple grib_copy.

    Code Block
    
    >  grib_copy multi.grib simple.grib
    

 


  1. Use the square brackets to insert the value of a key in the name of the output file (This is a good way to split a large GRIB file)

    Code Block
    
    >  grib_copy in.grib 'out_[shortName].grib'
    
    Note: we need to quote the name of the output so the shell does not interpret the square brackets

 


  1. To copy fields whose typeOfLevel is either 'surface' or 'meanSea'

    Code Block
    
    >  grib_copy -w typeOfLevel=surface/meanSea orig.grib out.grib
    

...


  1. To copy selected fields and apply sorting (sorted by level in ascending order)

    Code Block
    
    >  grib_copy -w typeOfLevel=heightAboveGround -B'level:i asc' tigge_af_ecmwf.grib2 out.grib
    
    Note: we need to specify the ':i' to get a numerical sort. By default values are sorted as strings so a level of 100 would come before 20!

...