I have temperature measurements from weather stations in a mountainous region and I want to obtain a vertical profile from these data at any given time.
In a simple case one can just plot all values in a temperature vs height chart and apply a linear/polynomial/fancy regression to obtain a curve and therefore an estimate of the lapse rate dT/dz.
In some cases, though, the weather changes abruptly and temperature will differ widely between, say, the eastern and western parts of the region. In such case the cloud of values in the above-mentioned plot will be quite messy and a regression won't be of help - R^2 will be quite low.
I was thinking of using a clustering algorithm in these cases, to split values into two groups (e.g. west and east), each having its own vertical profile, which would then (ideally) be suitable for applying regression. The algorithm could use information about each value's geographical position (lat-lon), which is hidden in the temp vs height plot, to figure out to which group each value belongs.
Can I achieve something like this using k-means? Any suggestion is welcome.