[gradsusr] Contour levels are not strictly increasing

Jim Weber Jim.Weber at FOXTV.COM
Wed Feb 20 13:35:47 EST 2019


Thanks Jennifer!!  That did the trick!  Not understanding what the error message was really referring to put me at a real disadvantage to ever figuring it out.  Your help is very much appreciated!

Jim

Date: Wed, 20 Feb 2019 01:28:38 +0000
From: Jennifer M Adams <jadams21 at gmu.edu>
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] Contour levels are not strictly increasing
Message-ID: <F852182E-A95C-4998-AD00-B95A773579C7 at gmu.edu>
Content-Type: text/plain; charset="utf-8"

Hi, Jim ?
The problem is with your format of "%3.1f? which may not be adequate to uniquely represent each level if your delta is small. Your format should have a few extra columns on either side of the decimal, perhaps ?%8.4f? would be good enough. 
Try adding the line 
    say levs
after the while loop that calculates the contour levels ? that should reveal when the levels are identical and give you a hint as to how to adjust the formatting. 
?Jennifer


> On Feb 19, 2019, at 4:02 PM, Jim Weber <Jim.Weber at FOXTV.COM> wrote:
> 
> Hi,
>  
> I have a script which I have inherited that worked until all the https changes with NOAA.  That forced me to upgrade to a version of grads that could connect to a https server. Once I did this and corrected this problem I developed another issue. When my scripts run I get the following error.
>  
> Warning: Contour levels are not strictly increasing
>          This may lead to errors or undesired results
>  
> I have narrowed it down to these two lines that if I remove them I do 
> not get the error (but also do not get the contours with as many 
> levels)
>  
> 'set ccols 'cols
> 'set clevs 'levs
>  
> Further up in the script it has a while loop to set all the colors and also to set the cols and levs(see below). Does anyone have a suggestion on what is wrong that the above commands generate this error and how I might correct this?
>  
> * set the contour levels
> nlevs=239
> l=1
> levs=''
> val=min
> delta=(max-min)/nlevs
> while(l<=nlevs)
> val=min + l*delta
> fmt="%3.1f"
> fval = math_format(fmt,val)
> levs=levs' 'fval
> l=l+1
> endwhile
>  
> * set the contour colors
> c=255
> cols=''
> while (c>15)
>   cols=cols' 'c
>   c=c-1
> endwhile
>  
> * define the colors
> delta=4
> base=15
> c=16
> blksz=60
> while (c<=255)
>  
> * block 1: Red to Yellow
>   rval=255 
>   bval=base 
>   i=0
>   while (i<blksz)
>     gval=base + (i*delta)
>     'set rgb 'c' 'rval' 'gval' 'bval
>     i=i+1
>     c=c+1
>   endwhile
>  
> * block 2: Yellow to Green
>   gval=255
>   bval=base
>   i=0
>   while (i<blksz)
>     rval=255 - (i*delta)
>     'set rgb 'c' 'rval' 'gval' 'bval
>     i=i+1
>     c=c+1
>   endwhile
>  
> * block 3: Green to Cyan
>   rval=base
>   gval=255
>   i=0
>   while (i<blksz)
>     bval=base + (i*delta)
>     'set rgb 'c' 'rval' 'gval' 'bval
>     i=i+1
>     c=c+1
>   endwhile
>  
> * block 4: Cyan to Blue
>   rval=base
>   bval=220
>   i=0
>   while (i<blksz)
>     gval=255 - (i*delta)
>     'set rgb 'c' 'rval' 'gval' 'bval
>     i=i+1
>     c=c+1
>   endwhile
>  
>  
> Jim Weber
> jim.weber at foxtv.com
**********************



More information about the gradsusr mailing list