Re: color bar for sub region

From: David Ian Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed, 30 May 2007 12:38:52 -0600

Hi John,

Just to add a bit to what Mary said:

If the coordinates of your data can be expressed using 1D arrays
(e.g. a cylindrical-equidistant projection)
then there are ScalarField (sf) and VectorField (vf) resources that can
be used to specify a subset using
coordinate array values to the plotting functions. These are

sfXCStartSubsetV
sfXCEndSubsetV
sfYCStartSubsetV
sfYCEndSubsetV

or for VectorPlots the same names with 'vf' instead of 'sf' at the
beginning.

If the coordinates of the data are 2d (e.g. data on a lambert-conformal
projection), then the only way
to indicate a subset is to use the indexes of the corners. In this
case you would need to examine the
coordinate variables in the data file to determine the appropriate
indexes or just use trial and error.

You can either just extract the desired subset from the file variable
using Python subscripting
(you would need to apply the same subsetting to the coordinate
variables) or there are
ScalarField and VectorField resources that subset using index values
as well. These are:

sfXCStartIndex
sfXCEndIndex
sfYCStartIndex
sfYCEndIndex

('vf' prefix for VectorField)

The advantage of using these resources is that the coordinate arrays
and the data array will all be subsetted together.

When you subset using any of the above methods the plot's color bar
will be keyed only to the data in the subset.

(Unlike when you simply crop the map using the mpLimitMode resources.)
  -dave

On May 30, 2007, at 11:55 AM, Ertl, John C CIV 63134 wrote:

> Mary,
>  
> Thanks for all the help.
>  
> John Ertl
> Meteorologist
>  
> FNMOC
> 7 Grace Hopper Ave.
> Monterey, CA 93943
> (831) 656-5704
> john.ertl_at_navy.mil
>
> From: Mary Haley [mailto:haley_at_ucar.edu]
> Sent: Wed 5/30/2007 10:51 AM
> To: Ertl, John C CIV 63134
> Cc: Clare Fred; David Ian Brown
> Subject: Re: color bar for sub region
>
>
> Hi John,
>
> I'm trying to get through my email, and I don't mean to ignore this
> one. I will post an answer soon to pyngl-talk, but the basic gist is
> that you need to subset the data itself. Unfortunately, PyNIO doesn't
> have a mechanism for subsetting the data via coordinate values yet
> (like NCL does), so you have to do this the "hard" way, probably like
> using a "where" statement, or something similar.  
>
> I hope to get back to you soon, unless Fred or Dave have some quick
> answers here.
>
> --Mary
>
> On May 25, 2007, at 3:12 PM, Ertl, John C CIV 63134 wrote:
>
>> All,
>>  
>> I have a script that takes a global grid and will give me an image of
>> a sub region of that grid but the color bar that is shown covers
>> values for the entire global grid.  Is there a way to have the color
>> bar cover only the values in the sub region?
>>  
>> I am using mplimit Mode to limit the plotted area.  Is there better
>> way...can PyNGL make a true sub region that can then be plotted?
>>  
>>  
>>         resources.mpLimitMode = "LatLon"       # Limit the map view.
>>         resources.mpMinLonF   = subMinLon
>>         resources.mpMaxLonF   = subMaxLon
>>         resources.mpMinLatF   = subMinLat
>>         resources.mpMaxLatF   = subMaxLat
>>         resources.mpPerimOn   = True           # Turn on map
>> perimeter.
>> Thanks,
>>  
>> John Ertl
>> Meteorologist
>>  
>> FNMOC
>> 7 Grace Hopper Ave.
>> Monterey, CA 93943
>> (831) 656-5704
>> john.ertl_at_navy.mil
>>
>>  
>> _______________________________________________
>> pyngl-talk mailing list
>> pyngl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Wed May 30 2007 - 12:38:52 MDT

This archive was generated by hypermail 2.2.0 : Wed May 30 2007 - 16:42:34 MDT