Statistics version: I have a few measurements of a function that takes three inputs and produces a few 2D fields of outputs: $f(a,b,c;x,y)$, with $f$ being a vector of several quantities. I would like to cluster the points in $(x,y)$-space into regions that have a similar response to the input variables. If I treat the points independently, applying a clustering algorithm is fairly easy. (I can elaborate on which one I'm using if you think it's relevant.) I'd like to have a manageable number of clusters, which I'm usually able to stick to with a few tests. But there's no guarantee that the clusters are near each other spatially. Having continuous clusters of roughly equal size is definitely a plus. What are some ways to modify the approach to add in that constraint?

Science version: I'm running an atmospheric chemistry model and varying emissions over the US. In that setup,

  • $(a, b, c)$ are the national-total emissions of $NO_x$, $SO_2$, and $NH_3$;
  • $(x, y)$ are grid points over the US; and
  • $f$ is a vector of the various chemical species I'm tracking.

I've varied $(a,b,c)$ in a number of simulations, and I want to divide the country into regions of similar responses to the emissions and create simplified models for a manageable number of regions. I'm particularly interested in nonlinearities/mixed-effects/second-order derivatives in the chemistry response. Now, it's possible that different regions of the country do respond similarly to emissions even if they're not near each other, but the different regions should have some sort of spatial agglomeration. Thoughts?

Side question 1: I originally played around with this a few years ago with Matlab code but have since migrated to Python. Suggestions on how to efficiently use Python stats packages for this sort of problem?

Side question 2: Recommended books on spatial data analysis and statistics?