2

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:

{clear;

%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?

1
  • 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
    Commented Feb 26, 2018 at 14:35

1 Answer 1

1

use geotiffread function to read Geotiff files with spatial references

http://in.mathworks.com/help/map/ref/geotiffread.html

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.