栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

ArcPy最大值法由NDVI月度数据转化为年度数据

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ArcPy最大值法由NDVI月度数据转化为年度数据

下载中国5km分辨率逐月NDVI数据集(1982-2020)

目录

下载中国5km分辨率逐月NDVI数据集(1982-2020)

配置python环境

编写代码


下载地址:国家地球系统科学数据中心数据详细信息http://www.geodata.cn/data/datadetails.html?dataguid=239118756960240&docid=474

配置python环境

配置方法可以参考我的另一篇文章

 Pycharm中安装arcpy_冬_冬_的博客-CSDN博客_arcpy安装

编写代码
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project :arcpy_WSI 
@File    :NDVI_sum.py
@Author  :Ryo
@Date    :2021/12/8 19:55 
'''
'''This program is for calculate annual NDVI dataset by monthly dataset '''
import arcpy
arcpy.env.overwriteOutput = True
from arcpy import env
from arcpy.sa import *
import os
import re
env.workspace = r'E:BaiduNetdiskDownloadnew WSINDVI.mdb'
luccpath=r'E:BaiduNetdiskDownloadnew WSICatchment_LUCC'
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput = 1
arcpy.env.overwriteOutput = 1

# Convert tiff dataset to rasters
for i in range(1,468):
    year=1982+i//12
    month=i%12+1
    print(year,month)
    if year<2000:#Extract data after 2000
        continue
    ##Create raster layer from single raster dataset with clipping feature
    arcpy.MakeRasterLayer_management(r"E:FireFoxDownloadCDRMVCCN.tiff", "rdlayer", "#", "", str(i))
    arcpy.CopyRaster_management("rdlayer",str(year)+str(month))

for year in range(2000,2021):# turn monthly data to annualdata by max
    # Check out the ArcGIS Spatial Analyst extension license
    arcpy.CheckOutExtension("Spatial")

    # Execute CellStatistics
    outCellStatistics = CellStatistics([Raster(str(year)+str(month)) for month in range(1,13)], "MAXIMUM", "DATA")

    # Save the output
    outCellStatistics.save("NDVI"+str(year))
    print(year,'finished')

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/649569.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号