SLIP_Preprocess.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:DRIP-SLIP 作者: NASA-DEVELOP 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号