pypsa-meets-earth / pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://pypsa-earth.readthedocs.io/en/latest/
225 stars 176 forks source link

Fix for earth-osm V0.2.0 #954

Closed GbotemiB closed 6 months ago

GbotemiB commented 9 months ago

Closes # (if applicable).

Changes proposed in this Pull Request

The changes in this PR address the incompatibility issues of earth-osm 0.2.0 in pypsa-earth framework.

Code changes were made to download_osm_data.py and clean_osm_data.py.

In download_osm_data.py, the files are downloaded with different names depending on the country being selected. I restructured the last part of the code to rename the file and move them to the resource folder.

In clean_osm_data.py, substations geopandas dataframe have a geometry column which is in polygons and points. I added a centroid method to find the centroid and replace it with the polygons. You can also read about a follow-up conversation here #936

Checklist

davide-f commented 7 months ago

@GbotemiB FYI earth-osm has pushed some updates, though not yet with a new version. It may be good to test :D That can be tested by installing the package using pip and main or just waiting for the new release.

GbotemiB commented 7 months ago

Hi @davide-f, I have tested the latest version of earth-osm with the changes in my PR. Everything seems to be working perfectly. We just have to wait for the next release.

davide-f commented 7 months ago

That's great news @GbotemiB and @mnm-matin !!! :D As the new release is available and the CI passes, we can merge this :) That's really amazing!

davide-f commented 7 months ago

@GbotemiB the new earth-osm version is out :D Many thanks @mnm-matin !!!! I'm rerunning the CI to see if it passes. It would be great @GbotemiB to incorporate the constraint "earth-osm>=0.2.1" as this PR won't be backcompatible

GbotemiB commented 7 months ago

@GbotemiB the new earth-osm version is out :D Many thanks @mnm-matin !!!! I'm rerunning the CI to see if it passes. It would be great @GbotemiB to incorporate the constraint "earth-osm>=0.2.1" as this PR won't be backcompatible

Absolutely. The version will be earth-osm>=2.1 which is the latest version.

GbotemiB commented 7 months ago

Hi @davide-f All checks for CI are successful.

davide-f commented 7 months ago

That's great and super promising!!!! As a question: would you be interested in testing download osm data for the entire africa for example? As this is a major change it would be nice to check the functionality for a large region, also Europe may work (given the notebook we have)

GbotemiB commented 7 months ago

@davide-f That will be great. So I will be testing for Africa and Europe, right?

davide-f commented 7 months ago

@davide-f That will be great. So I will be testing for Africa and Europe, right?

Both is a lot, just one should be fine :)

GbotemiB commented 7 months ago

Testing download_osm_data for Africa is a success. I was able to download successfully.

davide-f commented 7 months ago

Super @GbotemiB !!! Can you add a release note under minor fix? Then we can merge the PR :)