循环时间数据集

时间:2015-08-04 19:46:16

标签: python gis arcpy

我有一个点要素类,其中包含具有时态数据的列。我将如何收集前10年数据的平均中心,然后是前20个,前30个等...并使用Python循环将结果导出为点?我想测量数据随时间的人口变化,而不必手动计算每个十年的影响。

如果这是一个天真的问题我很抱歉,因为我刚刚开始编程。

以下链接包含一个文件地理数据库,其中包含我正在使用的要素类。

https://drive.google.com/file/d/0Bw8dHpiUsYU7QjlKQnRSaDV5RnM/view?usp=sharing

1 个答案:

答案 0 :(得分:0)

我最终选择了这样的事情。

import os
import arcpy

in_feature = "C:\\temp\\mlb_birth.gdb\\mlb_birthplaces"
out_features = "C:\\temp\\mlb_birth.gdb"

for x in range(10, 140, 10):
    year_range = int(1870 + x)

    year_out_name = os.path.join(out_features, "Years_{0}".format(x))
    mean_out_name = os.path.join(out_features, "Mean_{0}".format(x))

    arcpy.Select_analysis(in_feature, year_out_name, "birthYear <= {0}".format(year_range))

    arcpy.MeanCenter_stats(year_out_name, mean_out_name, "#", "#", "#")
相关问题