[gradsusr] [EXTERNAL] Multiple AND (logical) statements inside an if() in GrADS

Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] jennifer.m.adams at nasa.gov
Tue Feb 16 13:16:08 EST 2021


Please have a look at these doc pages:
http://cola.gmu.edu/grads/gadoc/expressions.html
http://cola.gmu.edu/grads/gadoc/gradfuncif.html

There are examples there that shows how to use logical expressions to create the GrADS defined variable you’re looking for. The use of the if-else-endif clauses inside a script will not do what you’re expecting.
--Jennifer

--
Jennifer Miletta Adams
ADNET Systems, Inc.
NASA/GSFC, Code 610.2
Building 32, Room S159
(301) 614-6070


From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Lyndz <olagueralyndonmark429 at gmail.com>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org>
Date: Saturday, February 13, 2021 at 6:40 AM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: [EXTERNAL] [gradsusr] Multiple AND (logical) statements inside an if() in GrADS

Dear GrADS experts,

I am calculating the heat stress index using the following:


'define temp = t2 - 273.16'

'define tempF = (temp *1.8) +32'

'define tempF = maskout(tempF,tempF-80)'

'define rh = rh2'





'define HI = -42.379 + (2.04901523*tempF) + (10.14333127*rh)-(0.22475541*tempF*rh) - (0.00683783*pow(tempF,2)) - (0.05481717*pow(rh,2)) + (0.00122874*pow(tempF,2)*rh) + (0.00085282*tempF*pow(rh,2)) - (0.00000199*pow(tempF,2)*pow(rh,2))'



if (rh < 13 & tempF >= 80 & tempF <= 112)

  'define HIA = HI'

else

  'define HIA = HI-((13-rh)/4)*sqrt(17-abs(tempF-95)/17)'

endif



if (rh > 85 & tempF >= 80 & tempF <= 87)

  'define HIA = HI + 0.5*(tempF + 61 + ((tempF-68)*1.2) + (rh*0.094))'

endif





This is based on this link:https://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.wpc.ncep.noaa.gov%2Fhtml%2Fheatindex_equation.shtml&data=04%7C01%7Cjennifer.m.adams%40nasa.gov%7Cb30aef35e4164cc8dc4e08d8d01415ba%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C637488132010820543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=C%2Bw4jAyUAySId0IQU3whQd9HOSoHHWPAjzVU8hGXtuI%3D&reserved=0>


Adjustments are added to and subtracted from the HI equation if the temperature falls at a certain range.

Is this the correct way for doing this?
if (rh < 13 & tempF >= 80 & tempF <= 112)
if (rh > 85 & tempF >= 80 & tempF <= 87)


Or maybe there is a better approach for this....

I'll appreciate any comment/suggestion on this.


Sincerely,

Lyndon Mark P. Olaguera, Ph.D.
+63 906 023 9926
Manila Observatory,
Ateneo de Manila University Campus
Loyola Heights, Quezon city
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 30912 bytes
Desc: not available
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20210216/3b9624e7/attachment-0001.bin>


More information about the gradsusr mailing list