I have a stack of MODIS images consisting of 400+ bands. A stack of NaN masks is created corresponding to each layer of the MODIS stack. I wonder if there is a way to apply the mask layers in bulk in ENVI on the MODIS stack instead of selecting just one mask layer to apply each time manually? If ENVI is limited, is there a way to bulk apply in other softwares/programs? I have access to ArcGIS, Matlab and R.

enter image description here

1 Answer 1


If you have ENVI-IDL license, use it. There is well-known documentation of its usage

Otherwise, you can use any other software with a simple task. For example, in R:


MODIS <- stack('path/to/modis stack.extension')
Masks <- stack('path/to/mask stack.extension')

MODIS_masked <- mapply(FUN = function(x,mask) mask(x = x, mask = mask),x = as.list(MODIS), mask = as.list(Masks))
MODIS_masked <- stack(MODIS_masked)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.