Python版的ArcGIS栅格计算器模板
2015-11-07 11:02
393 查看
import arcpy
from arcpy.sa import *
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1
#custom
arcpy.env.workspace="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\1Length\\"
#custom
outpath="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\2mean_len\\"
#custom
outfilename="mean";n=30;
Sum=0
files=arcpy.ListRasters()
for file in files:
Sum=Sum+Raster(file)
(Sum/n).save(outpath+outfilename)
print("Done,please close")
说明:
(1)带#号的为需要改动的地方
(2)本例实现求平均
from arcpy.sa import *
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1
#custom
arcpy.env.workspace="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\1Length\\"
#custom
outpath="G:\\Phenology of 30 Years\\GIMMS 3g\\15Length\\2mean_len\\"
#custom
outfilename="mean";n=30;
Sum=0
files=arcpy.ListRasters()
for file in files:
Sum=Sum+Raster(file)
(Sum/n).save(outpath+outfilename)
print("Done,please close")
说明:
(1)带#号的为需要改动的地方
(2)本例实现求平均
相关文章推荐
- python中的浅拷贝与赋值不同
- python刚入门,还需多努力
- python获取堆栈信息的方法
- Python之filter筛选数据工具
- Vim与Python真乃天作之和
- Windows 7下的python环境配置
- Python之上下文管理器
- python自然语言处理:NLTK+Ubuntu+Eclipse环境配置
- Python实现PointToRaster
- Python编程入门——基础语法详解
- Python 中 return 和 print
- 第二篇、python进阶篇
- Java vs Python
- 使用Python导出Excel图表以及到处为图片的方法
- Python的Flask框架中SQLAlchemy使用时的乱码问题解决
- 用Python的Flask框架结合MySQL些一个内存监控程序
- Vim与Python真乃天作之和
- python 学习爬虫教程~
- python 邮件发送 zabbix 图片
- Python多版本管理软件pyenv的安装应用及pip的使用讲解