[gradsusr] If else statement in grads

Jennifer Adams jma at cola.iges.org
Fri Sep 13 08:15:18 EDT 2013


On Sep 12, 2013, at 8:27 PM, Muhammad Yunus Ahmad Mazuki wrote:

> There is no if else statement in GrADS scripts.
This is incorrect. The if/else/endif syntax DOES exist in the *scripting* language, but not as an explicit GrADS function. 

You can use the maskout() and const() functions to create the equivalent
u1 = maskout(u,u-3)
u2 = maskout(u,6-u1)
mask = const(u2,1)
display  u*mask

--Jennifer


> 
> 
> On Thu, Sep 12, 2013 at 4:35 PM, Jayakrishnan P.R <prjayakrishnan at gmail.com> wrote:
> Dear Users,
>              I have to compute the drag coefficient from Large and Pond equation using grads.  My main concern is that does if else statement effective in grads. Otherwise I will have to write a FORTRAN program and write the outputs and read using grads. Kindly clarify this. 
> I have to do like this
> Equation-1
> if 3<=u<=6
> and Equation-2 
> if 6<=u<=26.
> My version of grads is Grads 2.0.1 in Fedora core-18.
> 
> -- 
> Sincerely
> ***********************************************
> Jayakrishnan.P.R
> Teaching Associate (Atmospheric Science)
> Academy of Climate Change Education and Research
> Kerala Agricultural University
> Vellanikkara-680 656
> 
> and also
> 
> Research Fellow (Part Time)
> Department of Atmospheric Sciences
> CUSAT, Cochin-682 016
> Kerala, India.
> Mob: 09496026547
> 
> ***********************************************
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
111 Research Hall, Mail Stop 2B3
George Mason University
4400 University Drive
Fairfax, VA 22030 





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130913/edefefa1/attachment-0003.html 


More information about the gradsusr mailing list