H5file = h5py.File( filePath, 'r') # 'r' means that hdf5 file is open in read-only mode #Select the reflectance dataset within the flightline reflectance = H5file['/Reflectance'] #get plot name if file.endswith('.h5'): plot = file[:-3] #default NDVI bands redBand=53,NIRband=95, redEnd=57, NIRend=99 ndviOut = processNDVI(reflectance) #write the NDVI out as a geotif filenameNDVI = ('data/NDVItiff/' + plot + 'NDVI.tif') writeGeotiff(filenameNDVI, ndviOut, plotBound[plot][0][0], plotBound[plot][0][2]) #create dictionary of NDVI values for kicks #NOTE: this is problematic now because of low NDVI values in some plots (senescent grass) #- might need to look at the lidar as well for this NDVIdict[plot] = ndviOut brightestBool = ndviOut > .6 #check to see how many bright pixels are in the tiff print plot, 'brightpixels: ', (np.count_nonzero(brightestBool)) #delete testing1=reflectance #to save code, simply apply all non bright pixels (boolean= false) to -999 #not sure how to do the above gracefully #delete testing=reflectance[:,:,brightestBool] = -999
#open the h5 file H5file = h5py.File(filePath, 'r') # 'r' means that hdf5 file is open in read-only mode #Select the reflectance dataset within the flightline reflectance=H5file['/Reflectance'] #get plot name if file.endswith('.h5'): plot = file[:-3] #default NDVI bands redBand=53,NIRband=95, redEnd=57, NIRend=99 ndviOut=processNDVI(reflectance) #write the NDVI out as a geotif filenameNDVI=('data/NDVItiff/' + plot + 'NDVI.tif' ) writeGeotiff(filenameNDVI,ndviOut,plotBound[plot][0][0],plotBound[plot][0][2]) #create dictionary of NDVI values for kicks #NOTE: this is problematic now because of low NDVI values in some plots (senescent grass) #- might need to look at the lidar as well for this NDVIdict[plot]=ndviOut brightestBool=ndviOut>.6 #check to see how many bright pixels are in the tiff print plot, 'brightpixels: ', (np.count_nonzero(brightestBool)) #delete testing1=reflectance #to save code, simply apply all non bright pixels (boolean= false) to -999 #not sure how to do the above gracefully #delete testing=reflectance[:,:,brightestBool] = -999