[GIS] XYZ Clustering in Python and numpy arrays

clusteringnumpypython

I am looking for a method of clustering XYZ data in Python that works on numpy arrays. I know of a few sources, such as clusterpy and Pysal but have had little success with them as they seem to still be in the development stage and do not support numpy arrays.

EDIT:

My numpy arrays are of XY points with a Z column of a value at the point such as soil moisture or plant height. I want to spatially cluster the Z values into similar regions.

Best Answer

scikit-learn has an extensive clustering library with many different methods available. As a bonus scikit-learn is one of the best documented Python libraries I've seen. When working with 3d point clouds I've had a lot of success with DBSCAN for instance.

Alternately as @Fezter suggests above, scipy offers two different methods of clustring: k-means (vector-quantization) and hierarchical classification. While there isn't the number of methods available scipy is often a good place to start as the clustering methods don't tend to require as much setup.

Related Question