[gradsusr] If Statements for Gridded Model Data Open GrADS

Stephen McMillan smcmillan at planalytics.com
Wed Jun 22 11:08:57 EDT 2016


Hi Matt,

In addition to Bernd's suggestion, also check out the "if" function, which
should have come with your opengrads package as part of the following
extension function set:

http://opengrads.org/doc/udxt/libbjt/

The "if" function syntax:
*if*(*EXPR1,OP,EXPR2,TRUE_EXPR,FALSE_EXPR*)

This function compares *EXPR1* and *EXPR2*, where 5 arguments are expected.
if their relation is true, *TRUE_EXP* is returned, otherwise expression
*FALSE_EXPR* is returned.
*OP*

One of the following: ==, =, >, <, >=, <=, !=
*EXPR2, TRUE_EXPR, FALSE_EXPR*

These can be a expression, constant or -u.


I have found this function to be very useful and much easier to handle than
using maskout and const, although there are probably cases where the latter
is more appropriate or advisable.

Stephen McMillan

On Wed, Jun 22, 2016 at 9:24 AM, Baker, Matt (Quebec - Atlantic) <
matt.baker at amecfw.com> wrote:

> Hi all,
>
>
>
> I have a question regarding Open GrADS.
>
>
>
> I’m trying to use *if statements* for scalar model data (eg. GFS and NAM)
> over a grid and I’m wondering if it’s possible to do this. As an example,
> I’m using if statements for these parameters: surface based CAPE, LI, and
> 500 mb relative humidity to create an index to plot on a map. So far GrADS
> isn’t showing that this is working, however, I can plot the model data
> individually so I don’t think it’s a case of missing data.
>
>
>
> Here’s some of the code for the NAM model. Note that I define the variable
> NAMHail to equal 0 at the start of the function.
>
>
>
>    if (modelNumberNAM>0)
>
>         set_maps(_map,_hasNegativeNAM)
>
>         'set grads off'
>
>         'set grid off'
>
>         'set gxout contour'
>
>         'set ccolor 0'
>
>         'set clopts -1 1 0.15'
>
>         'set cint 1'
>
>         'set cthick 6'
>
>         'set clab on'
>
>         'set csmooth on'
>
>
>
>         'NAMcape = CAPEsfc.'modelNumberNAM
>
>         if (NAMcape > 1500 & NAMcape < 2200)
>
>             'NAMHail = NAMHail + 1'
>
>         endif
>
>         if (NAMcape > 2199 & NAMcape < 3100)
>
>             'NAMHail = NAMHail + 2'
>
>         endif
>
>         if (NAMcape > 3099)
>
>             'NAMHail = NAMHail + 3'
>
>         endif
>
>
>
>         'set lev 500'
>
>         'NAMrh500=RHprs.'modelNumberNAM
>
>         if (NAMrh500 < 35)
>
>             'NAMHail = NAMHail + 3'
>
>         endif
>
>         if (NAMrh500 > 35 & NAMrh500 < 44)
>
>             'NAMHail = NAMHail + 1'
>
>         endif
>
>
>
>     endif
>
>
>
>     'set gxout contour'
>
>     'set ccolor 0'
>
>     'set clopts -1 1 0.15'
>
>     'set cint 200'
>
>     'set cthick 6'
>
>     'set clab on'
>
>     'set csmooth on'
>
>
>
>     'd NAMcape'
>
>
>
> Thanks!
>
>
>
> *Matt Baker*
>
> Meteorologist, Met-Ocean Services, Amec Foster Wheeler Environment &
> Infrastructure
>
> 133 Crosbie Road, PO Box 13216, St. John’s, NL A1B 4A5, Canada
>
> *matt.baker at amecfw.com <matt.baker at amecfw.com>**­­*      amecfw.com
>
> ISO 9001:2008 Quality Management System (St. John's)
>
>
>
> This message is the property of Amec Foster Wheeler plc and/or its
> subsidiaries and/or affiliates and is intended only for the named
> recipient(s). Its contents (including any attachments) may be confidential,
> legally privileged or otherwise protected from disclosure by law.
> Unauthorised use, copying, distribution or disclosure of any of it may be
> unlawful and is strictly prohibited. We assume no responsibility to persons
> other than the intended named recipient(s) and do not accept liability for
> any errors or omissions which are a result of email transmission. If you
> have received this message in error, please notify us immediately by reply
> email to the sender and confirm that the original message and any
> attachments and copies have been destroyed and deleted from your system.
> This disclaimer applies to any and all messages originating from us and set
> out above. If you do not wish to receive future unsolicited commercial
> electronic messages from us, *please forward this email to:
> unsubscribe at amecfw.com and include “Unsubscribe” in the subject line*. If
> applicable, you will continue to receive invoices, project communications
> and similar factual, non-commercial electronic communications.
>
> Please click http://amecfw.com/email-disclaimer for notices and company
> information in relation to emails originating in the UK, Italy or France.
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160622/0e7c87ca/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 116062214244800553.jpg
Type: image/jpeg
Size: 5711 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20160622/0e7c87ca/attachment.jpg 


More information about the gradsusr mailing list