DRIP.py 文件源码

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

项目:DRIP-SLIP 作者: NASA-DEVELOP 项目源码 文件源码
def sum72(newFile,extent):
    currentSum=loadtxt(os.path.join(getCurrentDirectory(),'Sum72','sum72.txt'),dtype='float',delimiter=',')
    historicFiles=sorted(glob.glob(os.path.join(getCurrentDirectory(),'Sum72','Files','*txt')))
    lastFile=loadtxt(os.path.join(getCurrentDirectory(),'Sum72','Files',historicFiles[0]),dtype='float',delimiter=',')
    currentSum=currentSum-lastFile
    currentSum=currentSum+newFile
    np.savetxt(os.path.join(getCurrentDirectory(),'Sum72','sum72.txt'),currentSum,delimiter=',')
    rotatedSum = np.rot90(currentSum)
    tiffFiles=glob.glob(os.path.join(getCurrentDirectory(),'Sum72','Tiffs','*.TIF'))
    if not tiffFiles:
        lastTifNum='1'
    else:
        tiffFiles=natsorted(tiffFiles,alg=ns.IC)
        lastTif=tiffFiles[-1]
        lastTifNum=str(int(lastTif[lastTif.rfind('_')+1:lastTif.rfind('.')])+1)
    array2raster(os.path.join(getCurrentDirectory(),'Sum72','Tiffs',timeStr[-11:-7]) + '_72HourSum_' + lastTifNum + '.TIF',[extent[0],extent[3]],extent[4],extent[5],rotatedSum,gdalconst.GDT_Float32)
    while len(tiffFiles)>48:
        os.remove(tiffFiles[0])
        tiffFiles=natsorted(glob.glob(os.path.join(getCurrentDirectory(),'Sum72','Tiffs','*.TIF')),alg=ns.IC)
    os.remove(historicFiles[0])

#sends an e-mail containing "attachment", currently to the authors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号