comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » non-rectangular array subset
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
non-rectangular array subset [message #89446] Fri, 17 October 2014 04:25 Go to next message
jecca.baker is currently offline  jecca.baker
Messages: 12
Registered: October 2014
Junior Member
Hello,

I have an array of global data (MODIS LAI) and need to select data from the Amazon basin only. Is there a way to do this by selecting a number of rectangular regions and concatenating them if the rectangular regions are different sizes? Eg, is it possible to concatenate the following?

0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0

0,0,0,0,0,0
0,0,0,0,0,0

0,0,0
0,0,0

Or for a more sophisticated selection, is there a way to only select data that falls under an amazon basin shapefile?

Any tips would be much appreciated.
Many thanks,
Jess
Re: non-rectangular array subset [message #89447 is a reply to message #89446] Fri, 17 October 2014 04:36 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,

On 17.10.2014 13:25, jecca.baker@gmail.com wrote:
> is there a way to only select data that falls under an amazon basin shapefile?

IDLanROI is a tool designed for this purpose. You'll have to transform
the shape coordinates into your grid coordinates and then use IDLanROI:

http://www.exelisvis.com/docs/IDLanROI.html

Fabien
Re: non-rectangular array subset [message #89448 is a reply to message #89446] Fri, 17 October 2014 04:39 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
I forgot to answer to your first question about concatenation. Once you
have non-regular subsets you have to work with masks and where() to
access your data.

(e.g.: https://www.idlcoyote.com/ip_tips/xroi.html)

On 17.10.2014 13:25, jecca.baker@gmail.com wrote:
> Eg, is it possible to concatenate the following?
Re: non-rectangular array subset [message #89449 is a reply to message #89448] Fri, 17 October 2014 05:22 Go to previous messageGo to next message
jecca.baker is currently offline  jecca.baker
Messages: 12
Registered: October 2014
Junior Member
Hi Fabien.
Thanks for your tips. Could you possibly expand on how to use masks and where for subsetting? My data isn't an image file, rather a large array containing a grid of data every month for several years, so not sure how I would get XROI to work in the way David Fanning uses in the example you posted.
Many thanks!


On Friday, October 17, 2014 12:39:09 PM UTC+1, Fabien wrote:
> I forgot to answer to your first question about concatenation. Once you
>
> have non-regular subsets you have to work with masks and where() to
>
> access your data.
>
>
>
> (e.g.: https://www.idlcoyote.com/ip_tips/xroi.html)
>
>
>
> On 17.10.2014 13:25,
>
>> Eg, is it possible to concatenate the following?
Re: non-rectangular array subset [message #89450 is a reply to message #89449] Fri, 17 October 2014 06:42 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi,

A 2d grid of data is the same as an "image", and third or fourth
dimensions (e.g. time or atmospheric levels) are simply a "pile of images".

Depending on the size of your array you could do some dimension juggling
(https://www.idlcoyote.com/tips/rebin_magic.html, case study 1) or use a
loop over the other dimensions.

Fabien
Re: non-rectangular array subset [message #89452 is a reply to message #89450] Fri, 17 October 2014 14:49 Go to previous message
Chris Anderson is currently offline  Chris Anderson
Messages: 3
Registered: August 2014
Junior Member
Jess,

Subsetting your data using the 'where' function will allow you to subset your data from your image arrays into one-dimensional vectors that can then be concatenated together into a single array. I'm sure this can be done in a cleaner fashion, but one potential example, given two images and some sort of threshold could be:

index1=where(image1 gt threshold,cnt)
if (cnt gt 0) then output_data=image1[index1]

index2=where(image2 gt threshold,cnt)
if (cnt gt 0) then output_data=[output_data,image2[index2]]

Your output_data vector then will contain a one-dimensional array of the values you have subset from your original images. All of your LAI values for the regions you are using will be in one array.

On Friday, October 17, 2014 6:42:07 AM UTC-7, Fabien wrote:
> Hi,
>
>
>
> A 2d grid of data is the same as an "image", and third or fourth
>
> dimensions (e.g. time or atmospheric levels) are simply a "pile of images".
>
>
>
> Depending on the size of your array you could do some dimension juggling
>
> (https://www.idlcoyote.com/tips/rebin_magic.html, case study 1) or use a
>
> loop over the other dimensions.
>
>
>
> Fabien
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Converting days since 0-01-01 to Julian/Gregorian days - how can IDL recognise 0 AD?
Next Topic: File time issue

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:23:02 PDT 2025

Total time taken to generate the page: 0.43366 seconds