Python遥感开发中地理探测器实现详解
Python遥感开发之地理探测器的实现
前言:本篇博客主要介绍使用py_geodetector库来实现地理探测器。
1 地理探测器介绍
官网链接:http://www.geodetector.cn/index.html


2 官方软件实现
下载链接:http://www.geodetector.cn/Download.html
3 Python代码实现
需要借助py_geodetector库,可使用pip下载
库的开源地址:https://github.com/djw-easy/GeoDetector
注意:驱动因子必须要离散化
代码实现:
import pandas as pd
from py_geodetector import GeoDetector
if __name__ == '__main__':
file_path = r'2001-1km.csv'
df = pd.read_csv(file_path, encoding="utf-8")
gd = GeoDetector(df, "rsei_data", ["tem_data","pre_data","lc_data","dem_data","slope_data","aspect_data"])
factor_df = gd.factor_dector()
interaction_df = gd.interaction_detector()
interaction_df, interaction_relationship_df = gd.interaction_detector(relationship=True)
ecological_df = gd.ecological_detector()
risk_result = gd.risk_detector()
print(interaction_df)
print(interaction_relationship_df)
print(ecological_df)
print(risk_result)
interaction_df.to_csv(r"2001-1-interaction.csv",index=False)
interaction_relationship_df.to_csv(r"2001-1-interaction_relationship.csv",index=False)
ecological_df.to_csv(r"2001-1-ecological.csv",index=False)
gd.plot(value_fontsize=14, tick_fontsize=16, colorbar_fontsize=14);
作者:等待着冬天的风