Skip to content

Commit

Permalink
eez: do not simplify as it distorts topology
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed Aug 2, 2024
1 parent 7bfb795 commit e77d8dd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions scripts/build_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def eez(eez, country_list):
df = gpd.read_file(eez)
iso3_list = cc.convert(country_list, src="ISO2", to="ISO3")
df = df.query("ISO_TER1 in @iso3_list and POL_TYPE == '200NM'").copy()
df['name'] = cc.convert(df.ISO_TER1, src="ISO3", to="ISO2")
df["name"] = cc.convert(df.ISO_TER1, src="ISO3", to="ISO2")
s = df.set_index("name").geometry.map(
lambda s: _simplify_polys(s, tolerance=0.01, filterremote=False)
lambda s: _simplify_polys(s, filterremote=False)
)
s = s.to_frame("geometry").set_crs(df.crs)
s.index.name = "name"
Expand Down Expand Up @@ -249,9 +249,7 @@ def nuts3(country_shapes, nuts3, nuts3pop, nuts3gdp, ch_cantons, ch_popgdp):
country_shapes = countries(snakemake.input.naturalearth, snakemake.params.countries)
country_shapes.reset_index().to_file(snakemake.output.country_shapes)

offshore_shapes = eez(
snakemake.input.eez, snakemake.params.countries
)
offshore_shapes = eez(snakemake.input.eez, snakemake.params.countries)
offshore_shapes.reset_index().to_file(snakemake.output.offshore_shapes)

europe_shape = gpd.GeoDataFrame(
Expand Down

0 comments on commit e77d8dd

Please sign in to comment.