[gradsusr] Mask out and undefined Question

Jeff Duda jeffduda319 at gmail.com
Wed Jan 23 12:05:21 EST 2013


You should find a way to use the maskout function nested within the const
function to do this.  It's hard for me think of an exact way since your
logical statement is compound in nature, but I can give you an example for
a simple logical statement.

If you wanted only to mask out values where the terrain is < 2 km, you
could use a command like
'define var = const(maskout(njet,thgt-2),-u,XX)', for thgt being the array
storing terrain heights in meters and njet stores the number of jet
occurrences.

This command would plot the number of jet occurrences, but in areas where
the terrain height was < 2 km it would plot a constant value of XX, which
can be whatever you want it to be.  I would suggest making it a value that
is not in the range of njet (so something either negative or very large,
i.e., non-zero) so that you could make it show as a different color.  Then,
before plotting var, set a color table that includes the contour value you
set in the definition.

For the other part of the logical statement, you could define a second
field much like the first. Set the undefined value to something other than
XX,  but still negative or very large.
'define var2 = const(maskout(njet,njet),-u,YY)'

Finally, display your final field as 'd 0.5*(var+var2)'.  I think Grads
will take the union of the undefined areas and plot them both in the sum.
The reason for the 0.5 factor is because you are double counting the number
of jet occurrences otherwise.  As far as the coloring goes, you'd have to
set a final color table that includes contours for both XX/2, YY/2, and
(XX+YY)/2 (since some grid points may be masked by both terrain and zero
counts), as well as for the colors of the count occurrences.

Hopefully this helps.  Mess around with this a little and see if you can
get something that works.

Jeff Duda

On Wed, Jan 23, 2013 at 10:01 AM, Dana Doubler <doublerd at msu.edu> wrote:

> Hi there,
>
> We are preparing climatological maps of the frequency and
> characteristics of jet maxima from gridded data.  On these maps we would
> like to "mask out" area with high elevations (>2 km) and also "mask out"
> areas  were no jets were reported in our study period.  We do not want
> the "0" or "missing value" indicators to be considered in the GrADS
> interpolation process.  We are using the command "undef" to define a
> masking value.  Ideally, however, we would like to show on the
> climatological maps the areas that have been masked due to high
> elevation in one color and the areas that have been masked because of no
> jet occurrences in another color.  We haven't been able to figure out
> how to do this.  Is this possible in GrADS?  Thanks in advance for your
> help.
>
> Dana
> _______________________________________________
> gradsusr mailing list
> 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/20130123/0ea860a9/attachment-0003.html 


More information about the gradsusr mailing list