[gradsusr] Using maskout function to apply TWO masks

Roberto Mera RMera at ucsusa.org
Thu Jul 3 12:40:51 EDT 2014


Yes! that worked! Thanks!
________________________________
From: gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] on behalf of Jeff Duda [jeffduda319 at gmail.com]
Sent: Thursday, July 03, 2014 12:35 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] Using maskout function to apply TWO masks

I just used 'hgtsfc' as an example of the topography field.  Most models have this field.  For your purposes, change it to 'ht'.  Also, swap the sign of the mask field to get the logical negation to become the mask.  Remember, the maskout function masks areas where the mask field is non-positive.  So if you want a part of a field to remain after masking, make sure it's in a region where the mask will be positive.  If a point is at 1000 m alititude, you want the mask to be nonpositive at that point, so something involving 1000, 700, and subtraction needs to result in a negative value.  700 - 1000 would do that, so that's 700 - ht for your mask.

Jeff Duda


On Thu, Jul 3, 2014 at 11:16 AM, Roberto Mera <RMera at ucsusa.org<mailto:RMera at ucsusa.org>> wrote:
Jeff,

Thanks for the help. I'm a little confused about this part:

maskout(temperature,hgtsfc+700 - height)

What is hgtsfc. Is that a defined variable?

The temperature and topography variables are in different files so all I need is to create a mask about 700m. My ocean mask works.

The name of the variable in the topography file is ht. I was trying this:

msk700=(ht/ht,ht-700) but it masked out everything below 700 m.

Thoughts?

Robert
________________________________
From: gradsusr-bounces at gradsusr.org<mailto:gradsusr-bounces at gradsusr.org> [gradsusr-bounces at gradsusr.org<mailto:gradsusr-bounces at gradsusr.org>] on behalf of Jeff Duda [jeffduda319 at gmail.com<mailto:jeffduda319 at gmail.com>]
Sent: Tuesday, June 03, 2014 5:09 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] Using maskout function to apply TWO masks

The const() and maskout() are powerful functions suited just for this purpose.

'define oceanmaskedtemperature = maskout(temperature,landseamask)' will get your your ocean mask
'set lev 1000 900'
'define 700mmaskedtemperature = maskout(temperature,hgtsfc+700 - height)' will maskout the grid above 700 m.  Note you need to define this in a 3D environment, hence the 'set lev' command preceeding it. Finally,
'd 0.5*(oceanmaskedtemperature + 700mmaskedtemperature)' will give you the field you seek.  Adding grids that have undefined values is the same thing as taking the intersection of sets.  The 0.5 factor is used because the temperature values will get added together where both fields have non-missing values.  But those values will be the same, so divide by 2 to restore the original values.

Jeff Duda


On Tue, Jun 3, 2014 at 3:14 PM, Roberto Mera <RMera at ucsusa.org<mailto:RMera at ucsusa.org>> wrote:
Grads crew:

I would like to get the area average for the temperature for the California Central Valley. I would also like to mask out the ocean so I don’t get those temperatures when I take the average. Right now I have a script that masks out the ocean and I have also adapted it for other purposes.

My question is this: How do I apply two masks?

I want to mask out the ocean and also, say >700 m altitude.

Right now my script loops through ensemble members and calculates the time average within each ensemble member and it gives me a number for the area average:

*mskgrd=maskout(ht/ht,ht-0.1) ****this masks out the ocean
count = 1
while (count < 18)
'set e 'count
'areal=aave(maskout(ave(field88,t=1,t=6),mskgrd(t=1)),x=147,x=250,y=94.1815,y=182.057)'
'd areal'
areal=subwrd(result,4)
say areal
if (rc != 0) ; break ; endif
count = count +1
endwhile

Robert




_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr




--
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org<mailto:gradsusr at gradsusr.org>
http://gradsusr.org/mailman/listinfo/gradsusr




--
Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140703/caf64b4f/attachment.html 


More information about the gradsusr mailing list