One can add several 'modifiers' to a key in square brackets to control number of columns, separator string and format |
One can add several 'modifiers' to a key in square brackets to control number of columns, the separator string and the output format:
[key!c%F'S'] c -> number of columns F -> C-style formatting S -> separator string |
Examples:
[latitude!11] -> print array using 11 columns [latitude','] -> print array with entries separated by a comma [latitude%.5f] -> print real numbers with 5 decimal places [latitude!11%.5f','] -> combination of the above |
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":
% 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:
% 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 appear here based on the labels you select. Click to edit the macro and add or change labels.