...
Excerpt | ||
---|---|---|
| ||
One can add several 'modifiers' to a key in square brackets to control number of columns, separator string and format |
Step-by-step guide
One can add several 'modifiers' to a key in square brackets to control number of columns, the separator string and the output format:
Code Block |
---|
[key!c%F'S'] c -> number of columns F -> C-style formatting S -> separator string |
...
Note: to print all the values on one line, set the number of columns to 0 (zero).
Let's print the "pl" array from an input GRIB message with a reduced Gaussian grid. First create the rules file "pl.filt":
Code Block |
---|
% cat pl.filt
print "[pl!5', ']"; |
This will print the pl array values in 5 columns using ", " as a separator. Now let's apply it:
Code Block |
---|
% grib_filter pl.filt samples/reduced_gg_pl_32_grib2.tmpl
20, 27, 36, 40, 45,
50, 60, 64, 72, 75,
80, 90, 90, 96, 100,
108, 108, 120, 120, 120,
128, 128, 128, 128, 128,
128, 128, 128, 128, 128,
128, 128, 128, 128, 128,
128, 128, 128, 128, 128,
128, 128, 128, 128, 120,
120, 120, 108, 108, 100,
96, 90, 90, 80, 75,
72, 64, 60, 50, 45,
40, 36, 27, 20 |
Related articles
Content by Label | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...