Re:Re: Bug in vector/barb direction

Masatake E. Hori mehori at CLIMATE.JP
Thu Oct 13 03:56:12 EDT 2005


Thank you very much Kagimoto-san,
your patch have corrected the error on my test script.

I have looked into some other test cases, and so far there
is no side-effects.

I enjoyed reading your patch and finding out why it worked.
A one-line, one-subroutine answer. Elegant!

Again, thank you very much.

# Any chance that this fix will go into the
# future release of GrADS?

---------------------------------------------------------------
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



>Hello Masatake,
>
>   The problem that you have, as you explained, happens
>because two internal parameters, adjtyp and lonref, are
>not set to be correct values for a 2-D plot. As you may
>know, these parameters can be changed only if you make
>a longitude-latitude plot. (see line 1912-1914 in gagx.c
>of GrADS v1.8.sl10). As far as I understand, there is no
>way without modifying the code.
>
>   An easy remedy is to
>
>    (1) create a function to re-initialize the above
>      two parameters,
>    (2) and call the function in gas2d() if 2-D plot does
>      not require the map level scaling.
>
>I created the patch file for the above modification,
>which is attached below. How to apply it is as follows,
>
>  % cd src180
>  % patch -p0 < patch-mproj
>
>After that what you need to do is re-build executable
>files with do_all.sh. I'm sure that the problem that
>you have is solved with the modification using the test
>suite that you provided in the previous message. However
>I'm not sure whether or not this modification IS harmless
>even in other functions. Thus please apply it with your
>own risk.
>
>Best regard
>----
>Takashi Kagimoto
>Frontier Research Center for Global Change/JAMSTEC
>3173-25 Showamachi, Kanazawa-ku, Yokohama, Kanagawa 236-0001, JAPAN
>(tel) +81-45-778-5516 (fax) +81-45-778-5707
>----
>--- gagx.c.orig 2001-10-18 12:00:50.000000000 +0900
>+++ gagx.c      2005-10-13 15:14:07.000000000 +0900
>@@ -1914,6 +1914,7 @@
>     if (imap) gawmap(pcm, 1);   /* Draw map if requested */
>   }
>   else {
>+    init_gxwmap();              /* Initialize internal parameters (2005/10/13 T.Kagimoto) */
>     if (pcm->paflg) {
>       pcm->xsiz1 = pcm->pxmin;
>       pcm->xsiz2 = pcm->pxmax;
>--- gxwmap.c.orig       2001-10-18 12:00:56.000000000 +0900
>+++ gxwmap.c    2005-10-13 15:10:30.000000000 +0900
>@@ -19,6 +19,14 @@
> static int adjtyp = 0;  /* Direction adjustment class */
> static float lonref;    /* Reference longitude for adjustment */
>
>+/* Initialize internal parameters, adjtyp and lonref
>+ *                                                     (2005/10/13 T.Kagimoto)
>+ */
>+void init_gxwmap() {
>+  adjtyp = 0;
>+  lonref = 0.0;
>+}
>+
> void gxdmap (struct mapopt *mopt) {
> float lon[255],lat[255],xx,yy,lnmin,lnmax,ltmin,ltmax,lnfact;
> int num,i,ipen,rc,type,ilon,ilat,rnum,flag;



More information about the gradsusr mailing list