Skip to content

Commit

Permalink
build_shapes: default to no tolerance in polygon simplification (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed Jul 9, 2024
1 parent 3175314 commit b6d11bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit b6d11bb

Please sign in to comment.