[gradsusr] plot more than 2 constant field in plot

Jeff Duda jeffduda319 at gmail.com
Tue Dec 27 18:43:00 EST 2016


A clever use of the const() and maskout() functions will give you the
desired result. The reason you are only seeing one field in the end is that
every time you run a display command with gxout set as shaded or grfill,
the latter field is covering up the former field anywhere the colors are
not the background value or a transparent color.

An example of how to use the const() and maskout() functions for the t2
field would be:
To limit the field to only values below 298 K...
'define var = const(maskout(t2,298-t2),0,-u)'
The above command would set all areas where t2 > 298 K to 0 and leave all
other areas untouched. You can nest this field within another set of
const(maskout(...)) functions to handle the other end (< 295) and yet
another one for the 1s in the middle. One way to keep this command from
getting ugly is to partition it...
'define part1 = const(maskout(t2,298-t2),0,-u)'
'define part2 = const(maskout(part1,part1-295),0,-u)'
'define part3 = const(part2,1)'
'define var = part3'

Jeff Duda

On Tue, Dec 27, 2016 at 2:24 AM, Nibin Gopi <nibingopi10 at gmail.com> wrote:

> i have do the follwing code for ploting constant field according to some
> condition satisfied. but it only shows one green color plot all over the
> map(i attched the fig)
>
> the code is
>
>
>
> 'open cnt_2014-09-25_d03.ctl'
> 'set t 1'
> 'define var = t2'
> 'define var1=rh2'
> 'define var2=rainc+rainnc'
> i=1
> while(i<=324)
> j=1
> while(j<=324)
> 'q defval var 'i' 'j
> 'q defval var1 'i' 'j
> 'q defval var2 'i' 'j
> val = subwrd(result,3)
> val2=subwrd(result,3)
> val3=subwrd(result,3)
>
> if (val > 295.0 & val < 298 )
>   'set defval var 'i' 'j' '1
> endif
> if (val > 298.0 )
>   'set defval var 'i' 'j' '0
> endif
> if (val1 > 50.0 & val1 < 60.0 )
>   'set defval var1 'i' 'j' '2
> endif
>
> if (val1 > 60 )
>   'set defval var1 'i' 'j' '3
> endif
> if (val2 > 75.0 & val2 < 175.0 )
>   'set defval var2 'i' 'j' '4
> endif
>
> if (val2 > 175.0 )
>   'set defval var2 'i' 'j' '5
> endif
> j=j+2
> endwhile
> i=i+1
> endwhile
> 'set gxout grfill'
> 'set clevs 0 1 2 3 4 5'
> 'set ccols 2 3 10 6 8 15'
> 'd var'
> 'd var1'
> 'd var2'
> 'run cbarn.gs'
> 'printim 1.png white'
> 'quit'
>
>
> please give me some solution
>
>
>
>
> [image: Inline image 1]
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20161227/c1a43cec/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 121556 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20161227/c1a43cec/attachment-0001.png 


More information about the gradsusr mailing list