bug/issue with how GrADS plots constant-valued grids

Jennifer Adams jma at COLA.IGES.ORG
Mon Sep 22 14:42:34 EDT 2008


Hi, P. Romero --
It's a very simple patch to use a color defined by the user with the
'set ccolor' command instead of red to draw the grid boxes of
constant values (when 'set datawarn off' is not used). In gagx.c (~
line 3712):

OLD:
        /* use fgrid and red to display the grid, print message to user */
         isav=pcm->gout2a;
         pcm->fgvals[0]=pgr->rmin;
         pcm->fgcols[0]=2;
         pcm->gout2a = 6;

NEW:
        /* use fgrid and red to display the grid, print message to user */
         isav=pcm->gout2a;
         pcm->fgvals[0]=pgr->rmin;
        if (pcm->ccolor>0)
          pcm->fgcols[0]=pcm->ccolor;
        else
          pcm->fgcols[0]=2;
         pcm->gout2a = 6;

I'll put this in for the next release.
Jennifer



On Sep 18, 2008, at 2:51 AM, P.Romero wrote:

> I have an issue with the way grads plots constant-valued grids.
> As an example, lets assume we set up a region within the grid that's
> entirely UNDEFINED, and we setup a clev at 0, and a ccols with a
> color value
> of 3, green.
> set lat 0 10
> set lon 0 100
> set gxout shaded
> set clevs 0
> set ccols 4
>
> and then we try to plot something
>
> d varsfc
>
> As expected, Grads will print the "ENTIRE GRID UNDEFINED" message,
> and plots
> everything in grayscale.
> Now, we when we do this.
>
> set lat 0 10
> set lon 0 100
> set datawarn off
> d varsfc
>
> the grid is still entirely undefined, still plotted in grayscale,
> but with
> no message printed.
> Next, when we do this.
>
> set lat 0 10
> set lon 0 100
> d const(varsfc,0,-u)
>
> We get a RED grid, with a message stating "Constant Field. Value=n"
> Finally, if we do this..
>
> set lat 0 10
> set lon 0 100
> set datawarn off
> d const(varsfc,0,-u)
>
> ... we get NOTHING, Grads basically plots nothing, except for any
> other
> features that were previously defined (axes, labels, map outlines,
> etc.),
> but the data grid is blank. However, in this example, we *should*
> have had a
> plot with all undefined values set to 0 due to the use of the const()
> function, and thus plotted in GREEN. Instead, we get a blank plot.
>
> I believe I can see where exactly in the source code this is
> happening,
> within the gacntr function in the gagx.c source file.
> I'm most likely going to have to customize the source code if
> there's no
> other way around this (I don't see an obvious work-around).
> I wanted to let this be known, in case it's a bug that should be
> fixed.
> Feedback from the developers as to how to make this change in the
> code would
> be appreciated...
>
> Ideally, I guess it would be ok to at least add a flag / option, to
> over-ride this behavior, like 'set constfld on/off' to allow for an
> all-constant-valued field to be plotted normally, with user-defined
> colors/levels/etc., regardless of whether the 'set datawarn off'
> option has
> been set...
>
> P.Romero

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080922/bda62636/attachment.html 


More information about the gradsusr mailing list