X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Aug 2011 12:35 PM by  anon
controlling NaN pixels in ENVI scripting calls
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Aug 2011 12:35 PM
    Is there an easy way, *using ENVI programing calls*, since I am working with imagery already opened with ENVI fids (vs IDL luns) to do this: (if any pixel in image = 0) then (pixel = NaN) ? Where the pixel locations vary, and therefore a mask would not work? I'd like to do something like this in a 'band math' call. Thank you...

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    29 Aug 2011 01:10 PM
    You could do a divide by 0 in band math: (float(b1) * (b1 ne 0)) / (float(b1) ne 0) Or write a function to use WHERE: FUNCTION find_nan, b1 indices = WHERE (b1 eq 0) ; find where there are 0 values b1 = float(b1) ; convert image to floating point if it is not already b1[indices] = !values.f_NaN ;set 0 values to NaN RETURN, b1 END

    Deleted User



    New Member


    Posts:
    New Member


    --
    29 Aug 2011 03:58 PM
    Thank you, MariM; I did not know I could use 'where' in this sense!

    Deleted User



    New Member


    Posts:
    New Member


    --
    02 May 2012 10:08 AM
    Thanks for this! I am working on 5-year time series MODIS data and it saved me from a lot of manual work. I am also still learning how to use IDL.
    You are not authorized to post a reply.