最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Cluster latlon values based on values - Stack Overflow

programmeradmin3浏览0评论

I'm trying to cluster values from a map in Python (these values could be income, kindness towards dogs or amount of penguins in supermarkets, for me the values are floats) from different data sources. I have 14 of such sources, and I'm trying to find clusters in which the data sources agree the most. This clustering would result in N regions, where N would be variable (from 1 region, i.e. the entire globe to N=648000 gridcells -- the amount of data points on my maps).

I think some unsupervised learning method would best suit this task. I have tried to look for this, with e.g. knn or kmeans clustering. However, these did not seem suited for the task. Is there any method that could do this? Some sample code is put below -- although very simple.

lats = np.linspace(-89.5, 89.5, 180)
lons = np.linspace(-179.5, 179.5, 360)
vals_to_cluster = np.random.random(size=(14, 180, 360))

# Just for showing purposes:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeat
fig = plt.figure()
ax = fig.add_subplot(111, projection=ccrs.PlateCarree())
ax.imshow(vals_to_cluster[0], extent=[-180, 180, -90, 90])# Show only first member
ax.add_feature(cfeat.COASTLINE)```
发布评论

评论列表(0)

  1. 暂无评论