|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86765 is a reply to message #86764] |
Mon, 02 December 2013 02:35   |
zhangj.sdu
Messages: 6 Registered: December 2013
|
Junior Member |
|
|
On Monday, December 2, 2013 12:55:09 PM UTC+8, Matthew Argall wrote:
> You could try using SMOOTH(array, WIDTH=4, /NAN), then replace NANs in the original array by the result of the smooth. Then use REBIN.
Thanks, Matthew. It doesn't work when the NaNs are on the edge of 4x4 pixels.
When averaging over each 4x4 pixels sub-image, the NaNs within them should be ignored, like MEAN(sub-image, /NaN)
Clark
|
|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86766 is a reply to message #86762] |
Mon, 02 December 2013 02:35   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
Le lundi 2 décembre 2013 02:51:50 UTC+1, zhang...@gmail.com a écrit :
> Hello, everyone:
>
>
>
> I want to resample a 128x20000x32 (sample,line, band) image with missing data into a 32x5000x32 image, using neighborhood averaging over 4x4 pixels.
>
> The REBIN function cannot help, since it has no NaN keyword like MEAN; The "Average Arrays with Missing Data" tip in the "Examples To Illuminate the IDL Way" is for two arrays (http://www.idlcoyote.com/idl_way/smallexamples.html).
>
>
>
> The total amount of images is hundreds of gigabytes. Is there any fast solution to this?
>
>
>
> Thanks.
>
> Clark
resampled_array = mean(mean(reform(array,4,32,4,5000,32,/OVER),DIM=1,/NAN),DIM =2,/NAN)
alx.
|
|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86767 is a reply to message #86766] |
Mon, 02 December 2013 02:39   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
Le lundi 2 décembre 2013 11:35:47 UTC+1, alx a écrit :
> Le lundi 2 décembre 2013 02:51:50 UTC+1, zhang...@gmail.com a écrit :
>
>> Hello, everyone:
>
>>
>
>>
>
>>
>
>> I want to resample a 128x20000x32 (sample,line, band) image with missing data into a 32x5000x32 image, using neighborhood averaging over 4x4 pixels.
>
>>
>
>> The REBIN function cannot help, since it has no NaN keyword like MEAN; The "Average Arrays with Missing Data" tip in the "Examples To Illuminate the IDL Way" is for two arrays (http://www.idlcoyote.com/idl_way/smallexamples.html).
>
>>
>
>>
>
>>
>
>> The total amount of images is hundreds of gigabytes. Is there any fast solution to this?
>
>>
>
>>
>
>>
>
>> Thanks.
>
>>
>
>> Clark
>
>
>
>
>
> resampled_array = mean(mean(reform(array,4,32,4,5000,32,/OVER),DIM=1,/NAN),DIM =2,/NAN)
>
>
>
> alx.
Maybe faster would be:
resampled_array=mean(transpose(reform(array,4,32,4,5000,32,/ OVER),[0,2,1,3]), DIM=1,/NAN)
alx.
|
|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86768 is a reply to message #86767] |
Mon, 02 December 2013 02:44   |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
Le lundi 2 décembre 2013 11:39:19 UTC+1, alx a écrit :
> Le lundi 2 décembre 2013 11:35:47 UTC+1, alx a écrit :
>
>> Le lundi 2 décembre 2013 02:51:50 UTC+1, zhang...@gmail.com a écrit :
>
>>
>
>>> Hello, everyone:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I want to resample a 128x20000x32 (sample,line, band) image with missing data into a 32x5000x32 image, using neighborhood averaging over 4x4 pixels.
>
>>
>
>>>
>
>>
>
>>> The REBIN function cannot help, since it has no NaN keyword like MEAN; The "Average Arrays with Missing Data" tip in the "Examples To Illuminate the IDL Way" is for two arrays (http://www.idlcoyote.com/idl_way/smallexamples.html).
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> The total amount of images is hundreds of gigabytes. Is there any fast solution to this?
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Thanks.
>
>>
>
>>>
>
>>
>
>>> Clark
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> resampled_array = mean(mean(reform(array,4,32,4,5000,32,/OVER),DIM=1,/NAN),DIM =2,/NAN)
>
>>
>
>>
>
>>
>
>> alx.
>
>
>
> Maybe faster would be:
>
> resampled_array=mean(transpose(reform(array,4,32,4,5000,32,/ OVER),[0,2,1,3]), DIM=1,/NAN)
>
>
>
> alx.
Sorry, I forgot a more REFORM !
resampled_array=mean(reform(transpose(reform(array,4,32,4,50 00,32,/OVER),[0,2,1,3]),8,32,5000,32,/OVER),DIM=1,/NAN)
|
|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86769 is a reply to message #86768] |
Mon, 02 December 2013 02:47   |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
>>
>>
>> alx.
>
> Sorry, I forgot a more REFORM !
>
> resampled_array=mean(reform(transpose(reform(array,4,32,4,50 00,32,/OVER),[0,2,1,3]),8,32,5000,32,/OVER),DIM=1,/NAN)
>
... and I think the "8" should be a "16" ( = 4 x 4 ). But you made your
point ;-)
|
|
|
Re: Resample (neighborhood averaging) a 3D array with missing data [message #86779 is a reply to message #86769] |
Mon, 02 December 2013 16:28  |
zhangj.sdu
Messages: 6 Registered: December 2013
|
Junior Member |
|
|
On Monday, December 2, 2013 6:47:58 PM UTC+8, Moritz Fischer wrote:
>>>
>
>>>
>
>>> alx.
>
>>
>
>> Sorry, I forgot a more REFORM !
>
>>
>
>> resampled_array=mean(reform(transpose(reform(array,4,32,4,50 00,32,/OVER),[0,2,1,3]),8,32,5000,32,/OVER),DIM=1,/NAN)
>
>>
>
>
>
>
>
> ... and I think the "8" should be a "16" ( = 4 x 4 ). But you made your
>
> point ;-)
This is exactly what I need. Thanks, ALX, Moritz.
Clark
|
|
|