[gradsusr] Using maskout function to apply TWO masks

Roberto Mera RMera at ucsusa.org
Thu Jul 3 12:21:41 EDT 2014


To append the last email. All files are z=1 with only one level.
________________________________
From: gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] on behalf of Roberto Mera [RMera at ucsusa.org]
Sent: Thursday, July 03, 2014 12:16 PM
To: GrADS Users Forum
Subject: Re: [gradsusr] Using maskout function to apply TWO masks

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 [gradsusr-bounces at gradsusr.org] on behalf of Jeff Duda [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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140703/21416282/attachment.html 


More information about the gradsusr mailing list