To check out the "Parameter ID" "ShortNames" use the "grib_ls" command
grib_ls cph.grb2
another variant to minimize the output is
grib_ls -p shortName cph.grb2 | sort | uniq -c | sort -r
where "-p shortName" selects just the "shortname" and you will get a sum of how many times each unique "ShortName" appears in the file.
In my example it gave
cph.grb2
shortName count date validityDate validityTime value
2t 442 20220928 20220928 1200 284.783
2t 443 20220928 20220928 1300 284.81
2t 444 20220928 20220928 1400 284.881
2t 445 20220928 20220928 1500 284.972
...VMAX_10M 683 20220928 20220930 1000 6.0198
VMAX_10M 684 20220928 20220930 1100 6.04429
98 of 685 messages in cph.grb2
98 of 685 total messages in 1 files
Input Point: latitude=56.12 longitude=12.60
Grid Point chosen #2 index=8662 latitude=56.12 longitude=12.60 distance=0.00 (Km)
Other grid Points
- 1 - index=8663 latitude=56.12 longitude=12.62 distance=1.24 (Km)
- 2 - index=8662 latitude=56.12 longitude=12.60 distance=0.00 (Km)
- 3 - index=8512 latitude=56.10 longitude=12.62 distance=2.55 (Km)
- 4 - index=8511 latitude=56.10 longitude=12.60 distance=2.22 (Km)
which shows the forecast for wind, m/s, and temperature, Kelvin, some hours ahead.
Wrap up
This was a short intro to the CLI tools but there is a lot more to learn !
Remark
In the above extract example it would have been natural to also extract the wind, but in most grib files the info is not reported as just wind and wind direction. The wind is instead reported as 2 vektors, component "u" and "v", which demands a little mathematics to decode. (Another explaination).
In the above example file the wind vectors are reported as "10u" "10v" which is 10 meter "u" and "v" component. Here you find a post that handles the math to give the wind speed/direction
A way to avoid dealing with the wind vectors is using a GRIB source that have other parameters for wind. If you live in Europe you could use DMI as a source, the Wave Model (WAM), where they use the parameters "wind" and "dwi"(10 meter wind speed and direction).
No comments:
Post a Comment
Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !