sub-hourly, grib_copy, grib_filter InstructionsFor 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 that won't work: | Code Block |
|---|
| language | bash |
|---|
| title | 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. | Code Block |
|---|
| language | bash |
|---|
| title | Correct way to filter sub-hourly messages |
|---|
| echo "set stepUnits = 's'; if (endStep > 59) {write;}" | grib_filter -o out.grib2 - in.grib |
|