The -wind_dir option takes the zonal and meridional winds,
computes the wind direction and writes it out in grib format. For this option to
work, (1) the zonal and meridional winds must be earth relative (not grid relative
winds) and (2) the meridional wind must follow the corresponding zonal wind for that
level, time and forecast hour. (Condition 2 is the same restriction as for the
-wind_speed option. If the U and V in your grib file do not have
this order, the file must be sorted. However, many NCEP forecast files already
have this order.
The winds need to be earth relative. The -new_grid option
can convert between earth and grid relative winds.
You can save computer time by using the -match option
to restricting the decoding of records to U and V.
Comment: the -wind_speed option can write to the same file as -wind_dir
$ wgrib2 gep19.t00z.pgrb2af180 -wind_dir wind.grb -wind_speed wind.grb -match "(UGRD|VGRD)"
4.1:86046:d=2009060500:UGRD:200 mb:180 hour fcst:ENS=+19
4.2:86046:d=2009060500:VGRD:200 mb:180 hour fcst:ENS=+19
8.1:226831:d=2009060500:UGRD:250 mb:180 hour fcst:ENS=+19
8.2:226831:d=2009060500:VGRD:250 mb:180 hour fcst:ENS=+19
$ wgrib2 wind.grb
1:0:d=2009060500:WDIR:200 mb:180 hour fcst:ENS=+19
2:97922:d=2009060500:WIND:200 mb:180 hour fcst:ENS=+19
3:179554:d=2009060500:WDIR:250 mb:180 hour fcst:ENS=+19
4:277476:d=2009060500:WIND:250 mb:180 hour fcst:ENS=+19
See also: -match,