def downloadLandsatScene(jd,year,month,day,path,row,directory):
LandsatID=LSUniqueID(path,row,year,jd,os.path.join(directory,str(row)))
downLoadCommand=getCurrentDirectory() + "/download_landsat_scene.py -o scene -b LC8 -d "+ year + month + day + ' -s ' + path + '0'+str(row)+ " -u usgs.txt --output " + LandsatID
os.system(downLoadCommand)
print('extracting...')
tarName=extractTar(LandsatID,os.path.join(directory,str(row)))
allFiles=glob.glob(os.path.join(directory,str(row),'*.TIF'))
for filename in allFiles:
bandName=filename.strip('.TIF')[filename.rfind('_')+1:]
if bandName != 'B4' and bandName != 'B5' and bandName != 'B7' and bandName != 'B8' and bandName != 'BQA':
os.remove(filename)
try:
shutil.rmtree(os.path.join(directory,str(row),tarName))
except:
print('No folder to delete called: ' + os.path.join(directory,str(row),tarName))
try:
os.remove(os.path.join(directory,str(row),tarName + '_MTL.txt'))
except:
print('No file to delete called: ' + os.path.join(directory,str(row),tarName + '_MTL.txt'))
reprojectPanBand(gdal.Open(os.path.join(directory,str(row),tarName + '_B8.TIF'),gdalconst.GA_ReadOnly),gdal.Open(os.path.join(directory,str(row),tarName + '_B4.TIF'),gdalconst.GA_ReadOnly),os.path.join(directory,str(row),tarName + '_B8.TIF'))
SLIP.model(year+month+day,path,str(row))
评论列表
文章目录