Excerpt |
---|
|
One way is to use grib_set with the key "scaleValuesBy". Let's say you have a field in orig.grib whose values you want to multiply by 2.1. First check the original data value statistics |
Step-by-step guide
One way is to use grib_set with the key "scaleValuesBy". Let's say you have a field in orig.grib whose values you want to multiply by 2.1. First check the original data value statistics:
Code Block |
---|
% grib_ls -p min,max,avg orig.grib
min max avg
234.554 312.085 278.977 |
You could have also checked the statistics by "grib_ls -n statistics orig.grib".
Now let's scale all values up by a factor of 2.1:
Code Block |
---|
% grib_set -s scaleValuesBy=2.1 orig.grib out.grib |
And check the new values after the multiplication:
Code Block |
---|
% grib_ls -p min,max,avg out.grib
min max avg
492.563 655.376 585.853 |
For adding or subtracting a constant, you can use the key "offsetValuesBy".
Related articles
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | ~usa |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label in ("kb-how-to-article","eccodes-faqs","grib","calculations","computed","keys","grib_ls") and label = "grib" and type = "page" and space = "UDOC" |
---|
labels | kb-how-to-article |
---|
|