Bug in vector/barb direction

Masatake E. Hori mehori at CLIMATE.JP
Thu Oct 13 01:18:29 EDT 2005


Hello, GrADS users.

Since my previous mail (on Sep.20), I narrowed the source of the bug,
but I cannot find a way to eliminate it.

I believe this is a pretty serious bug. Any help is welcome
in debugging this.

Short summary of the bug:
  Once a northern/southern hemisphere stereographic figure
  is drawn, subsequently, the direction of vectors/barb in a
  2-dimensional latitude/height cross section becomes bogus.

Example script and data:
  You can download the minimal test script and data (190KB) from,

    http://air.geo.tsukuba.ac.jp/~eddie/grads-bugtest.tar.gz

  And a figure describing this bug can be found at:

    http://air.geo.tsukuba.ac.jp/~eddie/test-run.png

Description of the bug:
  In the example, figures are drawn in the order of,
  (1) upper left, (2) lower left, (3) upper right, (4) lower right.
  Commands that created the (1) and (2) is completely the same
  to (3) and (4) , however, direction of vectors in fig (1) and (3)
  is different (figure (1) is correct).

  Reviewing the source code,  I suspected that the value of 'adjtyp'
  and 'lonref' variable used in gxwmap.c is not set free after a nps/sps
  figure is drawn.

  After a nps/sps figure is drawn, 'adjtyp' stays at the value of 1,
  which causes the direction of the vector to be adjusted by an angle
  of 'lonref'.

  'adjtyp' should be 0 for a latitude/height section, but at at the time
  when the third figure is drawn, I found that the value is still set to 1.

  This causes an error in the direction of the vector/barb because the
  gxaarw() routine will assume that the figure is polar stereographic
  and now returns a non-zero adjustment angle which is then used in
  gavect() routine to draw the bector/barbs.

  When a vector field for a single pressure level is drawn instead of a
  latitude/height plane, the bug did not occur.

  I couldn't figure out why such difference occured, but I suspect that
  there is something wrong with the latitude/height cross section.

  I have tested this script on GrADS 1.8b9 and 1.9sl13 for both Linux
  and Mac OS X with the same results.


Because my knowledge of the GrADS source code is limited,
I am not sure what is the correct way of eliminating this bug.

I think this is a serious bug for people who make latitude/height
cross sections regularly, and any help is welcome.

Thanks!

---------------------------------------------------------------
Masatake E. Hori (mehori at climate.jp / mhori at mri-jma.go.jp)
Atmospheric Environment and Applied Meteorology Research Dept.
Meteorological Research Institute, Japan Meteorological Agency



More information about the gradsusr mailing list