[gradsusr] ineffective IF (-ELSE) STATEMENT of GRADS-2.a8.oga.1 on BOUNDARY MARKS/ EXCLUSION OF BOUNDARY MARKS

Davide Sacchetti davide.sacchetti at arpal.gov.it
Wed Jul 6 04:17:06 EDT 2011


there is a conceputal error, let's understand the meaning of:

  if('bcx'!='xx1' ...

this logaical is always false, because 'bcx' is a string, 'xx1' is a
string and they are different


in your script appears:

  'draw mark 4 'bcx' 'bcy' .1'

then it is clear that bcx is a scalar (it has a value)
...

correct the logical expr in this way:

  if(bcx!=xx1 ...

hoping it helps
bye bye
Davide


On Wed, 2011-07-06 at 09:53 +0200, Morwakoma Matabane wrote:
> I have tried to avoid the page (X,Y) boundary markings by using the
> attached script but the marks always appears. The IF STATEMENT  does
> not appear to do the trick; how do I make sure that the marks at the
> boundaries do not appear but only the interior marks appear?
> 
> For instance,
> 
> 1)      if('bcx'!='xx1'| 'bcx'!='xx2' | 'bcy'!='yy1' | 'bcy'!='yy2')
> 
> 'draw mark 4 'bcx' 'bcy' .1'
> 
> else 
> 
> 'draw mark 0 'bcx' 'bcy' .1'
> 
> Endif                      
> 
> RESULT IN MARKINGS ANYWAY,
> 
>  
> 
>  
> 
> 2)if('bcx'='xx1'| 'bcx'='xx2' | 'bcy'='yy1' | 'bcy'='yy2')
> 
> 'draw mark 0 'bcx' 'bcy' .1'
> 
> else 
> 
> 'draw mark 4 'bcx' 'bcy' .1'
> 
> Endif            
> 
> STILL RESULT IN THE MARKINGS, AND
> 
>           
> 
>  3) if('bcx'>'xx1'| 'bcx'<'xx2' | 'bcy'>'yy1' | 'bcy'<'yy2')
> 
> 'draw mark 4 'bcx' 'bcy' .1'
> 
> Endif
> 
>  
> 
> MARKINGS STILL AT THE BOUNDARIES.
> 
>  
> 
> NOTE: For testing choose boundary points like BCX=XX1,BCY=YY1 or
> BCX=XX1,BCY=YY2 or BCX=XX2, BCY=YY1, or BCX=XX2, BCY=YY2, and
> 
>              interior points like BCX=2.0 and BCY=5.0, and BCX=5.5 and
> BCY=6.8.
> 
>  
> 
> ***************************************************************************************************************
> 
> *Marking.gs
> 
> ******************************************************************************************************************
> 
> 'reinit'
> 
> 'open e.t00z.ctl'
> 
> lat1=-60 ; lat2=0
> 
> lon1=-30 ; lon2=60
> 
> 'set lat 'lat1' 'lat2
> 
> 'set lon 'lon1' 'lon2
> 
> 'set t 2'
> 
> 'set gxout shaded'
> 
> 'd apcp'
> 
> 'cbarn'
> 
> *********************************************************
> 
> * Page boundaries
> 
> ********************************************************
> 
> 'q gxinfo'
> 
> rec1=sublin(result,3)
> 
> xx1=subwrd(rec1,4)
> 
> say 'xx1 is 'xx1
> 
> xx2=subwrd(rec1,6)
> 
> say 'xx2 is 'xx2
> 
>  
> 
> rec2=sublin(result,4)
> 
> yy1=subwrd(rec2,4)
> 
> say 'yy1 is 'yy1
> 
> yy2=subwrd(rec2,6)
> 
> say 'yy2 is 'yy2
> 
> *************************************************************
> 
> prompt "Enter bcx:  "
> 
> pull bcx 
> 
> say 'bcx is 'bcx
> 
>  
> 
> prompt "Enter bcy:  "
> 
> pull bcy
> 
> say 'bcy is 'bcy
> 
>  
> 
> if('bcx'!='xx1'| 'bcx'!='xx2' | 'bcy'!='yy1' | 'bcy'!='yy2')
> 
> 'draw mark 4 'bcx' 'bcy' .1'
> 
> else 
> 
> 'draw mark 0 'bcx' 'bcy' .1'
> 
> endif
> 
>  
> 
> 'set lat 'lat1' 'lat2
> 
> 'set lon 'lon1' 'lon2
> 
>  
> 
>  
> 
> 'printim xx.gif gif -x1400 -y1200 white'
> 
>  
> 
> 'quit'
> 
>  
> 
> Regards
> 
> Morwakoma M Matabane
> 
> Scientist ( South African Weather Service)
> 
>  
> 
> 
> This e-mail is subject to the South African Weather Service e-mail
> legal notice, to view please visit:
> http://www.weathersa.co.za/legal/email.asp -
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-- 
--> Attenzione cambio indirizzo: davide.sacchetti at arpal.gov.it
--
Davide Sacchetti
Centro Funzionale Meteo Idrologico di Protezione Civile della Regione Liguria
ARPAL Unità Tecnica Complessa di livello Regionale
V.le Brigare Partigiane 2 16121 Genova (I)
tel: +39 010 6437535                    fax: +39 010 6437520
mail: davide.sacchetti at arpal.gov.it     web: www.meteoliguria.it





More information about the gradsusr mailing list