[gradsusr] Plotting mixed precipitation from rain and snow

Jeff Duda jeffduda319 at gmail.com
Fri Oct 20 14:02:46 EDT 2017


Okay, then you'll have to use the const and maskout functions instead of
if. The maskout function basically acts as an IF statement by plotting data
only at points where the mask is nonnegative (i.e., where a condition is
true). Grid points where the mask is negative are turned into "undef" data.
The const function can take "undef" data and turn it into something else,
such as a fixed number like 0 or 1. So you will find yourself nesting
maskout() within const(). But I recommend playing around with doing that to
figure out how you want to get the result you seek. Another helpful hint is
that when it comes to comparing fields that may have undef values, the
simple sum operator acts as an intersection operator, too. So if you add
two fields that have undef values at different locations, your result field
will be undefined at grid points where either summand field is undefined
also.

So I'll get you started. If you want to plot the field rain+snow where rain
> 0.005, the following command will suffice:

'd maskout(rain+snow,rain-0.005)'

What you'll find useful as you go through this is continuing to nest
applications of const(maskout()) around this initial expression. I think
you will end up with const(maskout(const(maskout()))), but there are
multiple ways to do this.

Good luck. If you have further questions please ask.

Jeff

On Fri, Oct 20, 2017 at 12:37 PM, Thomas Robinson <ter at hawaii.edu> wrote:

> I believe the version is 2.1.a2.oga.1.  At least that's what it says at
> the top of the grads display window.  I'm stuck with the version on the
> computer I'm using.
>
> On Fri, Oct 20, 2017 at 12:19 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> Thomas,
>> If you are using version 2.1.1.b0 or later, use the if() function.
>> Otherwise you will need to creatively use the const() and maskout() fields.
>> But let's start with the first part...which version are you using?
>>
>> Jeff Duda
>>
>> On Fri, Oct 20, 2017 at 9:52 AM, Thomas Robinson <ter at hawaii.edu> wrote:
>>
>>> We have model output fields rain and snow.  I want to plot the mixed
>>> precipitation if the rain > 0.005 and snow > 0.005.  Something like this
>>>
>>> if (rain > 0.005 && snow > 0.005); d rain+snow
>>>
>>> Is there a way to do this without looping through each point?  Can I
>>> create a variable 'mix' and put individual values in a loop if looping is
>>> necessary?
>>>
>>> -Tom
>>>
>>> --
>>> Tom Robinson
>>> PhD Candidate - Department of Atmospheric Science
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>>
>>
>>
>> --
>> Jeff Duda
>> Post-doctoral research fellow
>> University of Oklahoma School of Meteorology
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Tom Robinson
> PhD Candidate - Department of Atmospheric Science
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>


-- 
Jeff Duda
Post-doctoral research fellow
University of Oklahoma School of Meteorology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20171020/28ea11d0/attachment.html 


More information about the gradsusr mailing list