1

I have several model data with the following format

postwrf_d01_YYYYMMDD_INIT_f00000.gr2

where INIT = 0000, 0600, 1200, 1800, each consisting of up to several hours of forecast (f00000 to let's say f08400 with a six hourly interval).

Inside this gr2 data are multiple variables.

Now using wgrib2 utility, I can select just the variables I want using the following command

./wgrib2 postwrf_d01_20131107_0000_f00600.gr2 -match ':((U|V)GRD:10 m above ground|PRMSL|(ABSV|HGT|UGRD|VGRD|TMP):(850|700|500) mb):' -grib OUT.gr2

How can I create a bash script from the above wgrib2 command? I want the OUT.gr2 to have the following file formats.

1) d01_YYYYMMDD_ZZZZ_f0HHHH.gr2 2) YYYYMMDD_ZZZZ_f0HHHH.gr2 3) nwp.TC23.YYYYMMDDZZ.f0MMMM.gr2

For example input file : postwrf_d01_20160521_1800_f08400.gr2 outfile shoud be 1) d01_20160521_1800_f08400.gr2
2) 20160521_1800_f08400.gr2 3) nwp.TC23.2016052118.f05040.gr2 ( 84 hr is 5040 min.)

2
  • So you want three output files (identical except for the specified filename) for each input file?
    – BradHards
    May 27, 2016 at 8:16
  • What does your bash script so far look like?
    – PolyGeo
    Oct 14, 2017 at 8:23

0

Browse other questions tagged or ask your own question.