masking float/interger arrays in IDL [message #94427] |
Thu, 18 May 2017 21:39  |
priyamalik484
Messages: 7 Registered: December 2016
|
Junior Member |
|
|
Dear All,
I want to know what is the masked value for float or integer in IDL?
For eg. just to explain with very simple code:
A=[-0.9,0.0,1.0,2.0,3.0,-0.7]
B=[-0.6,2.1,2.3,3.4,0.0,4.1]
C=[0.0,0.0,-0.7,1.7,1.2,0.0]
I have three arrays with same dimension. I want to do addition of these arrays.
However I don't want to include those indices in addition where the value is 0.0 or
its negative.
With "where" command I can get indices but I can not remove them, as then array will become of different dimensions, then I will not be able to do addition.
Any help?? Actually this concept I will further use in Image processing!!!!
PS: It is very easy in python. If you assign a value 9999 to any integer code will consider it as a masked number and will not use it in addition and array dimension will remain intact.
|
|
|
Re: masking float/interger arrays in IDL [message #94428 is a reply to message #94427] |
Fri, 19 May 2017 02:48  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 05/19/2017 06:39 AM, priyamalik484@gmail.com wrote:
> I want to know what is the masked value for float or integer in IDL?
>
> For eg. just to explain with very simple code:
>
> A=[-0.9,0.0,1.0,2.0,3.0,-0.7]
> B=[-0.6,2.1,2.3,3.4,0.0,4.1]
> C=[0.0,0.0,-0.7,1.7,1.2,0.0]
>
> I have three arrays with same dimension. I want to do addition of these arrays.
> However I don't want to include those indices in addition where the value is 0.0 or
> its negative.
> With "where" command I can get indices but I can not remove them, as then array will become of different dimensions, then I will not be able to do addition.
>
> Any help?? Actually this concept I will further use in Image processing!!!!
>
> PS: It is very easy in python. If you assign a value 9999 to any integer code will consider it as a masked number and will not use it in addition and array dimension will remain intact.
a*(a gt 0)+b*(b gt 0)+c*(c gt 0)
|
|
|