path_evi="/home/faizan/Pakistan/EVI/" path_lswi="/home/faizan/HDD1/LSWI/" path_flood="/home/faizan/HDD1/FLOOD_thresh/" for year in range(2004,2010): n=0 for i in range(1, 363): #assigning names test data evi=path_evi+str(year)+"/clip.%d%03d" % (year, i) + ".tif" lswi=path_lswi+str(year)+"/clip.%d%03d" % (year, i) + ".tif" Oflood =path_flood+str(year)+"/flood_thr.%d%03d" % (year, i) + ".tif" #Test data if os.path.exists(evi) is True: limage = Index(evi) cols = limage.iminfo['cols'] rows = limage.iminfo['rows'] bandnum= limage.iminfo['bandnum'] EVI = (limage.index2Array()) limage = Index(lswi) LSWI = (limage.index2Array()) DVEL = limage.CalcDVEL(EVI, LSWI, fill) #calculate Flood Flood= (limage.CalcFlood(EVI, LSWI, DVEL, fill)) #Get Flood as tiff limage.WriteArrayAsImage(Oflood, Flood) print n n +=1 del EVI, LSWI, DVEL, Flood
np.savetxt(b1o, data, delimiter=",") # nir band limage = Index(b6) data= (limage.Band2Array(0.0001, fill)) np.savetxt(b6o, data, delimiter=",") limage = Index(b2) data= (limage.Band2Array(0.0001, fill)) np.savetxt(b2o, data, delimiter=",") limage = Index(b3) data= (limage.Band2Array(0.0001, fill)) np.savetxt(b3o, data, delimiter=",") limage = Index(b4) data= (limage.Band2Array(0.0001, fill)) np.savetxt(b4o, data, delimiter=",") """ limage = Index(evi) cols = limage.iminfo['cols'] # Get pixel row number rows = limage.iminfo['rows'] data = (limage.index2Array(0.0001, fill)) np.savetxt(evio, data, delimiter=",") """ limage = Index(ndvi) data = (limage.index2Array(0.0001, fill)) np.savetxt(ndvio, data, delimiter=",") """ limage = Index(lswi) data = (limage.index2Array(0.0001, fill)) np.savetxt(lswio, data, delimiter=",") limage = Index(dvel) data = (limage.index2Array(0.0001, fill))