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.
|