I want to perform a time series analysis of Landsat NDVI. I could not find a prepared product online (except in GE Engine but it is no possible to download). Thus I would like to calculate the NDVI in batch, possibly applying a rule to keep the filename (I need the reference of the date).
I have a code for IDL/ENVI to do it:
; reading multiband image, calculate NDVI and save them in a file pro CalculateNDVI ; error handling compile_opt IDL2 Catch, theError IF theError NE 0 THEN BEGIN Catch, /Cancel MESSAGE, /REISSUE_LAST stop ENDIF ; count number of input files from the specified folders file_name = file_search('D:\mmrahm\Rangeland_Monitoring_Aug14Feb15\Works\Site1\MODIS_Site1\*.tif', COUNT = Nfiles) print, 'Number of files to be processed = ', Nfiles ; read files one by one and downscale it using MODIS data for ifile = 0, Nfiles-1 do begin print, 'Current File: ', file_name[ifile] ; read current UAV file and header informations Data = read_tiff(file_name[ifile]) result = query_tiff(file_name[ifile], info, GEOTIFF = geo) imagesize = info.dimensions W = imagesize H = imagesize C = (size(Data)) print, 'Width = ', W print, 'Height = ', H print, 'Number of Channels = ', C ;create empty output channel NDVI = intarr(W, H) ; calculate NDVI NDVI = (float(Data[3,*,*])-Data[2,*,*])/(float(Data[3,*,*])+Data[2,*,*]) ;create output file name from input file OutFileName = strmid(file_name[ifile], 70,30)+'_NDVI' print, 'output_file_name = ', OutFileName ; write data to write_tiff, 'D:\mmrahm\Rangeland_Monitoring_Aug14-Feb15\Test1\'+OutFileName+'.tif', NDVI, /float, geotiff = geo endfor end