You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Step-by-step guide

Say you want to copy the first 3 messages. This can be done with:

% grib_copy -w count=1/2/3 in.grib out.grib

But it is better to write a rules file and use grib_filter:

my.filter
if (count < 4) {
  print "Copying message number [count]";
  write;
}

Then run this as follows:

% grib_filter -o out.grib my.filter in.grib

Of course you can make the IF condition more complicated:

if (count == 3 || count == 13) {
  write;  # Write out message 3 and 13 only
}
if (count % 2 == 0) {
  write;  # Write out even-numbered messages, e.g., 2, 4, 6 etc
}



  • No labels