Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_shapes: default to no tolerance in polygon simplification #1137

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Release Notes
Upcoming Release
================

* In simplifying polygons in :mod:`build_shapes` default to no tolerance.

* Set non-zero capital_cost for methanol stores to avoid unrealistic storage sizes

* Set p_nom = p_nom_min for generators with baseyear == grouping_year in add_existing_baseyear. This has no effect on the optimization but helps n.statistics to correctly report already installed capacities.
Expand Down
6 changes: 4 additions & 2 deletions scripts/build_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _get_country(target, **keys):
return np.nan


def _simplify_polys(polys, minarea=0.1, tolerance=0.01, filterremote=True):
def _simplify_polys(polys, minarea=0.1, tolerance=None, filterremote=True):
if isinstance(polys, MultiPolygon):
polys = sorted(polys.geoms, key=attrgetter("area"), reverse=True)
mainpoly = polys[0]
Expand All @@ -106,7 +106,9 @@ def _simplify_polys(polys, minarea=0.1, tolerance=0.01, filterremote=True):
)
else:
polys = mainpoly
return polys.simplify(tolerance=tolerance)
if tolerance is not None:
polys = polys.simplify(tolerance=tolerance)
return polys


def countries(naturalearth, country_list):
Expand Down
Loading