Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Apr 4, 2024
1 parent de7ae3a commit 241fcf0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions notebooks/wp5/glacier_distribution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
" years = gdf[column].str[:4]\n",
" months = gdf[column].str[4:6].replace(\"99\", \"01\")\n",
" days = gdf[column].str[6:8].replace(\"99\", \"01\")\n",
" series = years + months + days\n",
" series = series.where(~series.str.startswith(\"-\"))\n",
" columns.append(pd.to_datetime(series))\n",
" date = years + months + days\n",
" date = date.where(~date.str.startswith(\"-\"))\n",
" columns.append(pd.to_datetime(date))\n",
"gdf[\"year\"] = pd.DataFrame(columns).mean().dt.year.astype(\"Int64\")"
]
},
Expand Down Expand Up @@ -290,7 +290,8 @@
" ylabel=\"Number of glaciers\",\n",
")\n",
"_ = ax.text(\n",
" *(0, 1),\n",
" 0,\n",
" 1,\n",
" f\"Date of digitization data are missing for {missing} glaciers or {missing_perc:.2f}% of the dataset.\",\n",
" transform=ax.transAxes,\n",
" bbox={\"facecolor\": \"white\", \"edgecolor\": \"black\"},\n",
Expand Down Expand Up @@ -360,7 +361,8 @@
"ax.grid()\n",
"ax.legend()\n",
"_ = ax.text(\n",
" *(0, 0),\n",
" 0,\n",
" 0,\n",
" \"\\n\".join(text),\n",
" transform=ax.transAxes,\n",
" bbox={\"facecolor\": \"white\", \"edgecolor\": \"black\"},\n",
Expand Down

0 comments on commit 241fcf0

Please sign in to comment.