I am working with MODIS Terra imagery (MOD13Q1). I am currently trying to compute the autocorrelation structure of the pixels in an MODIS NDVI raster. The problem is that I have clipped the original MODIS raster to focus on certain regions of interest (ROI). This means the MODIS raster has lots of missing data pixels in between my ROIs. I imported the MODIS raster as a netCDF file, then transformed it to a double matrix:


%ndvi data
ndvi = double(ncread('j193dzpad.nc', 'NDVI'));
NDVI = ndvi/10000;

%apply no data values
nodata = min(min(NDVI(:,:,1)));
NDVI(NDVI==nodata) = NaN;}

In my case, the minimum pixel value in the MODIS raster is the no data value.

The problem is that when I try to loop through the rows of the MODIS matrix (say to compute my directional autocorrelation values), MATLAB returns NaN.

It's easy to remove the NaN values from the matrix, but doesn't this alter the shape of the matrix?

In my case, I want to maintain the spatial integrity of the data, so I cannot remove the NaN pixels.

Any thoughts on how to work with NaN matrices where one does not want to remove NaN values?

Should I convert my original GeoTiff to another format?

closed as too broad by PolyGeo Jun 16 '18 at 0:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It's impossible to answer this question, because each function applied to the matrix don't (and can't) deal with NaNs in the same way. The question is why would you delete some values. – obchardon Feb 26 '18 at 14:35

use geotiffread function to read Geotiff files with spatial references


you can assign a value (away from data range ex.-99999) instead to the NaN. Else, use interpolation techniques to fill the no data pixel.If you have time series data, you can use TIMESAT or SPIRIT software for filling no data pixels. Another method is use other source(LANDSAT) with MODIS.

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