diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 8388946f8..461e4d1a5 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -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. diff --git a/scripts/build_shapes.py b/scripts/build_shapes.py index 85afdaea4..8eaea9f0f 100644 --- a/scripts/build_shapes.py +++ b/scripts/build_shapes.py @@ -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] @@ -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):