openclimatefix / power_perceiver

Machine learning experiments using the Perceiver IO model to forecast the electricity system (starting with solar)
MIT License
7 stars 1 forks source link

Try using `gsp_id_to_shape.geometry.envelope.centroid` #76

Closed JackKelly closed 2 years ago

JackKelly commented 2 years ago

Instead of using the centroid of the GSP region, maybe we should use the centroid of the bounding rectangle of the GSP region?

https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.envelope.html

This is done in RawGSPDataSource.load_everything_into_ram.

JackKelly commented 2 years ago

Here's the plot using gsp_id_to_shape.geometry.centroid:

ax = gsp_data_source._gsp_id_to_shape.plot()
xr.plot.scatter(gsp_data_source._data_in_ram.to_dataset(), x="x_osgb", y="y_osgb", color="black", s=10, ax=ax)
plt.show()

image

JackKelly commented 2 years ago

And here it is using the envelope.centroid:

color = rng.choice(np.arange(0, 338), replace=False, size=338)
gsp_data_source._gsp_id_to_shape["color"] = color
ax = gsp_data_source._gsp_id_to_shape.plot(column="color")
xr.plot.scatter(gsp_data_source._data_in_ram.to_dataset(), x="x_osgb", y="y_osgb", color="black", s=10, ax=ax)
plt.show()

image

JackKelly commented 2 years ago

For now, I think we should probably just use centroid (rather than envelope.centroid)