gaia icon indicating copy to clipboard operation
gaia copied to clipboard

Add pysal spatial weight functions to gaia

Open chuehlien opened this issue 9 years ago • 7 comments

Many spatial analysis functions in pysal rely on spatial weights, so we're adding this first.

TODO:

  • add WeightProcess class to processes.py
  • add WeightFileIO class to inputs.py
  • test WeightProcess class

chuehlien avatar Feb 16 '16 22:02 chuehlien

@chuehlien Could you please describe the use-case so that we can drive our development based on it. I am thinking spatial clustering but I am open for other ideas.

aashish24 avatar Feb 17 '16 07:02 aashish24

@chuehlien thanks for adding this on the github.

aashish24 avatar Feb 17 '16 07:02 aashish24

ping @chuehlien

aashish24 avatar Feb 18 '16 02:02 aashish24

Hey @aashish24 , some basic use cases for pysal are as follows:

  • local autocorrelation
    • use case: identify "hotspots" in disease outbreak
    • return vector layer
  • global autocorrelation - quantification of clustering/dispersion
    • use case: tests if a certain disease is clustered in a region
    • return a json object with with stats. eg, for Moran's I global correlation, return value of Moran's I, expected value under normality assumption, etc
  • regionalization
    • use case: form contiguous regions of states in the US displaying similar levels of per capita income over the period 1929-2010
    • return vector layer

We could write each of them into a process. Let me know what you think, esp on whether these are good processes to add to the api and whether there are additional pysal use cases that should be prioritized. Thanks!

chuehlien avatar Feb 18 '16 03:02 chuehlien

@chuehlien local and global autocorrelation would be most interesting. Let's try to get these two done first.

aashish24 avatar Feb 20 '16 15:02 aashish24

@aashish24 , I've added processes for local (ClusterProcess) and global autocorrelation (AutocorrelationProcess) to the spatial_weight branch.

Local process takes a vector file and variable column name, and returns a vector layer with the Local Moran's I statistics added. Global autocorrelation takes a vector file and variable column name and returns a json object with Global Moran's I statistics.

I've added the WeightProcess, WeightFileIO, and JsonFileIO classes as well. The WeightProcess or WeightFileIO are not required for the local/global autocorrelation processes to work, so we can remove them if we don't plan to include the process in the API.

I've also created six tests: a parser test and processor test for each of the new processes. The ClusterProcess and AutocorrelationProcess tests takes a while to run since calculating contiguity weight takes a while.

chuehlien avatar Feb 22 '16 15:02 chuehlien

@aashish24 let me know if there are any additional processes to prioritize.

chuehlien avatar Feb 24 '16 20:02 chuehlien