X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 12 Mar 2007 06:09 PM by  anon
Replacing NaNs
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
12 Mar 2007 06:09 PM
    Commonly I get image data from external sources that contain NaN's as missing value codes. Does anybody know how I can globally replace these NaN's in an image with a real number?. Thanks for the helo, Alf Western Australia

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Mar 2007 06:09 PM
    There are two approaches you can take within ENVI: 1) Load one of your images to a display and go to Basic Tools->Masking->Build Mask. After selecting the display as input, go to Options->Mask NaN Values and select your image as input. Choose an output filename and save the mask. Then go to Basic Tools->Masking->Apply Mask and select your image as input. At the bottom of the file selection dialog, click on Select Mask Band and choose the mask you just created. In the next window, choose the value you want to substitute for NaN and supply an output filename for the result. 2) Go to Basic Tools->Band Math and enter the following expression: finite(b1). Choose the band you want to operate on (or map the variable to an entire input file for multiband input) and choose an output filename. The result is an image where NaN values are set to 0 and everything else is set to 1 (a mask). Follow the same Apply Mask steps as in option #1, using the Band Math result as your mask, to replace those values with another number.
    You are not authorized to post a reply.