Re: Question about picking a region

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun Feb 06 2011 - 22:39:23 MST

oops! I misread the question ... thx

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

   x = f->X ; -180 to +180
   x = lonFlip(x) ; reorder to 0 - 360

   latS = -30.0
   latN = 30.0
   lonL = 150.
   lonR = 240.
   y = x(:,{latS:latN},{lonL:lonR})
   printVarSummary(y)

On 2/6/11 9:07 PM, Alessandra Giannini wrote:
>
> Dennis, Eddy,
>
> I think it may be a bit more complicated, but correct me if I am wrong...
>
> Longitudes in the dataset of interest go between -180 and 180 and you need to
> include points between 150 and 180, and between -180 and -120. These two sets
> are not contiguous.
>
> I do something like this - you need to first mask your "lon" vector,
> and then select your x variable on the masked lon values:
>
> masklon = mask(lon,lon.ge.150.and.lon.le.-120,True)
> lonindx = lon(ind(masklon.gt.-999))
>
> and then
>
> y = x(... {lon | lonindx})
>
> Hope this helps!
> best, alessandra
>
>
>
>
>
> ----- Original Message -----
> From: Dennis Shea<shea@ucar.edu>
> To: eddycarl<eddycarl@126.com>
> Cc: ncl-talk<ncl-talk@ucar.edu>
> Sent: Sun, 6 Feb 2011 22:43:37 -0500 (EST)
> Subject: Re: Question about picking a region
>
>
> latS = -30.0
> latN = 30.0
> lonL = -120.0 ;<====
> lonR = 150.0 ;<====
> y = x(:,{latS:latN},{lonL:lonR})
>
> If you are not reshaping you do not need to explicitly
> name the dimensions.
>
>
> On 2/6/11 3:32 PM, eddycarl wrote:
>> Hi there,
>>
>> I have a question about selecting data over a geographical region.
>> Suppose that data x(time,lat,lon) is with
>> lat=(-90.0,90),lon=(-179.5,179.5) at 1x1 degree resolution. If I want to
>> pick a region over the Pacific ocean, such as latitude from 30N to 30S,
>> longitude from 150E to 120W. What I used is
>>
>> latS = -30.0
>> latN = 30.0
>> lonL = 150.0
>> lonR = -120.0
>> y = x(time|:,{lat|latS:latN},{lon|lonL:lonR})
>>
>> However, this will produce an area actually from 120W to 150E, instead
>> of over Pacific. Does anyone know what shall I do to get it right? Thanks!
>>
>> -Eddy
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Feb 6 22:39:29 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 11 2011 - 16:11:42 MST