Skip to content

Commit

Permalink
Fix GADM_ID naming inconsistency (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-f committed Feb 29, 2024
1 parent d5fac61 commit f2a5cba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ 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>`__


PyPSA-Earth 0.3.0
=================
Expand Down
6 changes: 2 additions & 4 deletions scripts/build_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,10 +1296,8 @@ def gadm(
)

# renaming 3 letter to 2 letter ISO code before saving GADM file
# In the case of a contested territory in the form 'Z00.00_0', save 'AA.Z00.00_0'
df_gadm["GADM_ID"] = df_gadm["country"] + df_gadm["GADM_ID"].apply(
lambda x: "." + x if x[0] == "Z" else x[3:]
)
# In the case of a contested territory in the form 'Z00.00_0', save 'AA.00_0'
df_gadm["GADM_ID"] = df_gadm["country"] + df_gadm["GADM_ID"].str[3:]
df_gadm.set_index("GADM_ID", inplace=True)
df_gadm["geometry"] = df_gadm["geometry"].map(_simplify_polys)
df_gadm.geometry = df_gadm.geometry.apply(
Expand Down

0 comments on commit f2a5cba

Please sign in to comment.