[gradsusr] IF statement problem

Jennifer M Adams jadams21 at gmu.edu
Sat Feb 17 09:47:41 EST 2018


The ‘if’ function in the scripting language doesn’t work for evaluating the data in a defined variable in GrADS; it is only for evaluating script variables. As of version 2.1.1.b0, there is an if() function in GrADS and logical operators in the expression syntax for doing this type of calculation. If you are using an older version of GrADS, then the maskout() and const() functions can be used to achieve similar results.
http://cola.gmu.edu/grads/gadoc/gradfuncif.html
http://cola.gmu.edu/grads/gadoc/gradfuncconst.html
http://cola.gmu.edu/grads/gadoc/gradfuncmaskout.html
—Jennifer


On Feb 15, 2018, at 6:45 PM, AMS EmsiWx Bytča <emsiwx at pocasie-bytca.sk<mailto:emsiwx at pocasie-bytca.sk>> wrote:

Dear GrADS users,


I have been on this half a day, but still no success.

Part of my script:

'define oblc = TCDCclm'

if (oblc<10)
obla='J'
endif
if (oblc>=10 & TCDCclm<30)
obla='SJ'
endif
if (oblc>=30 & TCDCclm<60)
obla='P'
endif
if (oblc>=60 & TCDCclm<90)
obla='O'
endif
if (oblc>=90)
obla='Z'
endif

I want to get obla string based on the total cloud cover, but somehow the conditions dont work. I always get the last obla='Z' eventhough the TCDCclm is 34%

Could you please guide me on the right track?


Thank you in advance for your replies.


Marian

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://secure-web.cisco.com/1FXen63CqywdYKxy5unY9GUfI4dpiVxgyxnKPF1xYVDCU7TDbRkBbmrUQIBQGmtrbuNCkCuc-Xk_KnE6MRd7D3nJ6LfyN-pPnRtlyb0gZ2E_03az92IT5vJUJMZ8MejH0GnnVlralkuqCAvqPet3eASPwoQtHqHFqCwp2DjuRLTnwYGHakJ7H8qAdf0AeWLP_mIKPK6oNEd_RctwKpunAHlS7mtSFxjPlOieJlx_TsBVdIRgkAnovlZtWjlBA8KmopzeVKMc0Mz35h4dRbjm2tsJdHQ-8qmr3uBBufekElE0vffM8BOmGbrf5Bf5qcg_QCRe7808ieVZgR2qGpKukgMKCBIwRuYRNAC-HOCnZJhDX8zboNgrhVHJmo6VmbafaLc-Xf9hDpI7fVEkU0VGSKkmG8qEFcf0l9bcmDJ4OtLBDxmZOqfuZ7D1nNTtTBaky/http%3A%2F%2Fgradsusr.org%2Fmailman%2Flistinfo%2Fgradsusr


--
Jennifer Miletta Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
George Mason University



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20180217/2310faee/attachment.html>


More information about the gradsusr mailing list