Skip to content

Commit

Permalink
Revised geometry filtering of lines (#989)
Browse files Browse the repository at this point in the history
* Revised geometry filtering of lines

* Error-safe gadm_id point check

* Update release_note
  • Loading branch information
davide-f authored Mar 13, 2024
1 parent d27fb08 commit 97ac5fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t

**Minor Changes and bug-fixing**

* Minor bug-fixing for GADM_ID format naming. `PR #980 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/980>`__ and `PR #986 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/986>`__
* Minor bug-fixing for GADM_ID format naming. `PR #980 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/980>`__, `PR #986 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/986>`__ and `PR #989 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/989>`__

* Keep data on the original voltage value when rebasing voltages to the standard values and adjust the transmission capacity accordingly. `PR #898 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/978>`__

* Fix download_osm_data compatibility for earth-osm v2.1. `PR #954 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/954>`__ and `PR #988 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/988>`__

* Improve geometry filtering in clean_osm_data. `PR #989 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/989>`__

PyPSA-Earth 0.3.0
=================

Expand Down
2 changes: 1 addition & 1 deletion scripts/build_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ def gadm(
# In the case of a contested territory in the form 'Z00.00_0', save 'AA.00_0'
# Include bugfix for the case of 'XXX00_0' where the "." is missing, such as for Ghana
df_gadm["GADM_ID"] = df_gadm["country"] + df_gadm["GADM_ID"].str[3:].apply(
lambda x: x if x[0] == "." else "." + x
lambda x: x if x.find(".") == 0 else "." + x
)
df_gadm.set_index("GADM_ID", inplace=True)
df_gadm["geometry"] = df_gadm["geometry"].map(_simplify_polys)
Expand Down
6 changes: 2 additions & 4 deletions scripts/clean_osm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,8 @@ def filter_lines_by_geometry(df_all_lines):
# drop None geometries
df_all_lines.dropna(subset=["geometry"], axis=0, inplace=True)

# remove lines without endings (Temporary fix for a Tanzanian line TODO: reformulation?)
df_all_lines = df_all_lines[
df_all_lines["geometry"].map(lambda g: len(g.boundary.geoms) >= 2)
]
# remove lines represented as Polygons
df_all_lines = df_all_lines[df_all_lines.geometry.geom_type == "LineString"]

return df_all_lines

Expand Down

0 comments on commit 97ac5fb

Please sign in to comment.