[ncl-talk] How to pick out the grids in a chosen area from a polar stereographic projection dataset?

林祥 xianglin72 at icloud.com
Mon Aug 22 20:53:33 MDT 2016


Hey Cioni,

    Thanks for your reply.   The longitude and latitude array is 2-dimensional, so I rewrite the following scripts

   lon1d = ndtooned(longitude)
   lat1d  = ndtooned(latitude)
   x1d    = ndtooned(x)

   box_id = ind(lon1d.ge.min_lon .AND. lon1d.le.max_lon .AND. lat1d.ge.min_lat .AND. lat1d.le.max_lat)
  ;box_id = ind(lat1d.ge.min_lat .AND. lat1d.le.max_lat)   ; the result is same as the above line

   xlat    = lat1d(box_id)
   xlon   = lon1d(box_id)
   xbox   =   x1d(box_id)

 No I have picked out the data in the chosen area. But I am puzzled by plotting the contouring map for xbox.
Should I have to deal with the array of xbox like the separated station datas?

Thanks


Lin




> 在 2016年8月23日,00:12,Guido Cioni <guidocioni at gmail.com> 写道:
> 
> Hey Lin,
> when dealing with non-monotonic arrays I usually employ the ind function, so I don’t understand why is not working for you…
> 
> If you have, say, lon and lat arrays (this assume to have them 1-Dimensional, otherwise it gets fishy…).
> 
> min_lon= -50.
> max_lon= -70.
> min_lat= -180.
> max_lat= -180.
> box_lon= ind(lon.ge.min_lon .AND. lon.le.max_lon)
> box_lat= ind(lat.ge.min_lat .AND. lat.le.max_lat)
> 
> should give you exactly all the indices inside the user-prescribed area. Then you can subset using
> 
> var_box=var(:,box_lat,box_lon)
> 
> Please be reminded that box_values will have different dimensions, since it is a subset of the original variable.
> Cheers,
> 
> Guido Cioni
> http://guidocioni.altervista.org <http://guidocioni.altervista.org/> 
> 
>> On 22 Aug 2016, at 01:13, 林祥 <xianglin72 at icloud.com <mailto:xianglin72 at icloud.com>> wrote:
>> 
>> <latitude.csv>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160823/9fe0235f/attachment.html 


More information about the ncl-talk mailing list