Essentially I would like to know how current direction "DIR C" and wind direction "WDIR" for gribs is computed.

I'm trying to compute some angles from u and v vectors in grib files. My understanding from this link is that:

Positive U component represents wind blowing to (not from) the East (90 degrees). And positive V component is wind to (not from) the North (0 degrees). Is this correct?

In grib files values UGRD & VGRD are stored this way. How does this apply to currents like UOGRD and VOGRD? Is the same convention used as for UGRD and VGRD?

For example, assuming the vectors are defined the same (UGRD and UOGRD) I'm calculating current headings like this from the GRIB data:

$angle = round(atan2($u, $v) * 180 / pi());
if ($angle < 0) {
    $angle = 360 + $angle;

And wind like this:

$angle = round(atan2(-1*$u, -1*$v) * 180 / pi());
if ($angle < 0) {
    $angle = 360 + $angle;

The current output looks like this (using u & v values shown):

u=1  v=1 45° NE
u=-1 v=1 315° NW
u=1 v=-1 135° SE
u=-1 v=-1 225° SW

And wind looks like with the vector being "from" not to:

u=1 v=1 225° SW
u=-1 v=1 135° SE
u=1 v=-1 315° NW
u=-1 v=-1 45° NE

Does this look correct?

Note: This atan2(y,x) function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

  • $\begingroup$ positive U means westerly wind. positive V means southerly wind. $\endgroup$ – gansub Apr 8 '17 at 2:19
  • $\begingroup$ @gansub But my question also is about how u and v are defined for the current layers. $\endgroup$ – user6972 Apr 8 '17 at 4:44
  • $\begingroup$ not my area. Sorry. $\endgroup$ – gansub Apr 8 '17 at 7:02
  • $\begingroup$ I worked upon a very simple coupled ocean-atmosphere model code in a graduate course once, and don't remember there being any difference in definition. Convinced you have the idea right for u and v in the atmosphere (u = 1, v = 1 is wind from the SW). You can always compare current results to earth.nullschool.net which gives both wind and current animations. $\endgroup$ – JeopardyTempest Apr 11 '17 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.