Python遥感开发中地理探测器实现详解

Python遥感开发之地理探测器的实现

  • 1 地理探测器介绍
  • 2 官方软件实现
  • 3 Python代码实现
  • 前言:本篇博客主要介绍使用py_geodetector库来实现地理探测器。


    1 地理探测器介绍

    官网链接:http://www.geodetector.cn/index.html

  • 地理探测器用于测量和归因空间分层异质性的软件工具:自然界普遍存在的现象,即各个尺度上的层内相似性比层间相似性更高。
  • 空间分层异质性 (SSH)是一种层内比层间更相似的现象。这方面的例子包括土地利用类型和气候区以及空间数据中的遥感分类、时间序列中的周、季节和年份。
  • Geodetector是一种统计数据,用于:(1)测量和识别数据中的 SSH;(2)测试两个变量 Y 和 X 之间的耦合,而不假设关联的线性关系,且具有明确的物理含义;(3)研究两个解释变量 X1 和 X2 与响应变量 Y 之间的一般相互作用,而无需任何特定形式的相互作用,例如计量经济学中的假设乘积。

  • 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);
    


    作者:等待着冬天的风

    物联沃分享整理
    物联沃-IOTWORD物联网 » Python遥感开发中地理探测器实现详解

    发表回复