This section shows how to correctly filter the sub-hourly messages when using the step keys

sub-hourly, grib_copy, grib_filter

Instructions

For sub-hourly data, the step values can use different units (e.g., seconds, minutes, hours). This can cause problems when applying grib_copy to GRIB files whose messages use different stepUnits, because grib_copy compares only the numeric value, not the units. As a result, something like this won't work:

grib_copy doesn't support sub-hourly
grib_copy -w endStep=59 in.grib out.grib

Here is one way to do it in the grib_filter. You can set a new step unit (e.g., seconds) and then use a condition in the if statement to filter the messages you need. In that condition, you can assume all steps are in seconds.

Correct way to filter sub-hourly messages
echo "set stepUnits = 's'; if (endStep > 59) {write;}" | grib_filter -o out.grib2 - in.grib