Skip to content

Commit

Permalink
Fix weird gadm (#986)
Browse files Browse the repository at this point in the history
* Fix GADM_ID naming inconsistency

* Fig GH GADM naming issue

* Update release notes
  • Loading branch information
davide-f authored Mar 6, 2024
1 parent 283668a commit 53ee932
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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>`__ and `PR #986 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/986>`__


* Keep data on the original voltage value when rebasing voltages to the standard values and adjust the transmission capacity accordingly. `PR #898 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/978>`__

Expand Down
5 changes: 4 additions & 1 deletion scripts/build_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,10 @@ 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.00_0'
df_gadm["GADM_ID"] = df_gadm["country"] + df_gadm["GADM_ID"].str[3:]
# Include bugfix for the case of 'XXX00_0' where the "." is missing, such as for Ghana
df_gadm["GADM_ID"] = df_gadm["country"] + df_gadm["GADM_ID"].str[3:].apply(
lambda x: x if x[0] == "." else "." + x
)
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 53ee932

Please sign in to comment.