成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

python獲取柵格點(diǎn)和面值的實(shí)現(xiàn)

瀏覽:15日期:2022-08-02 18:01:12

1、獲取指定位置的點(diǎn)值:

OutputFile = open(statisticResultTXT, ’w’) cellvalue=arcpy.GetCellValue_management(inputfilepath+filenname+'.tif',staionXY, '1')OutputFile.write(stationID+'_'+filenname+''+str(cellvalue)+’n’)OutputFile.close()

2、獲取區(qū)域的均值極值

utputFile = open(statisticResult, ’w’) env.workspace = (’E:loessplateauET_Splineextract_year’)rlist = arcpy.ListRasters(’*’,’tif’)for file in rlist: minValueInfo= arcpy.GetRasterProperties_management(file,’MINIMUM’)minValue = minValueInfo.getOutput(0)maxValueInfo = arcpy.GetRasterProperties_management(file,’MAXIMUM’)maxValue = maxValueInfo.getOutput(0)meanValueInfo = arcpy.GetRasterProperties_management(file,’MEAN’)meanValue = meanValueInfo.getOutput(0)print file + ’,’ + str(minValue) + ’,’ + str(maxValue) + ’,’ + str(meanValue) +’n’OutputFile.write(file + ’,’ + str(minValue) + ’,’ + str(maxValue) + ’,’ + str(meanValue) +’n’)OutputFile.close()

補(bǔ)充知識(shí):python_計(jì)算格點(diǎn)數(shù)據(jù)降水變化斜率

我就廢話不多說了,還是直接看代碼吧!

import numpy as npimport pandas as pdimport codecs path=r’C:try.csv’ #讀取格點(diǎn)數(shù)據(jù)CSVdata=pd.read_csv(path,encoding=’gbk’)outpath=r’C:rate.csv’#新建存放斜率的CSVfile_csv = codecs.open(outpath,’w+’,’utf-8’) #打開方式data1=data.T #轉(zhuǎn)置n=80 #格點(diǎn)數(shù)m=17 #年數(shù)sl=[] #空列表for i in list(range(0,80)):#循環(huán)計(jì)算80個(gè)格點(diǎn)的變化斜率 print (i) sp=[] y=data1[i] y=y.values for k in range(0,m-1): for j in range(k+1,m): print(k,j) s=(y[j]-y[k])/(j-k) #計(jì)算斜率 sp.append(s) sl.append(np.median(sp)) slop= pd.DataFrame(sl)slop.to_csv(outpath,header=[’slop’]) #將SLOP寫入CSV

以上這篇python獲取柵格點(diǎn)和面值的實(shí)現(xiàn)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Python 編程
相關(guān)文章: