Skip to content

Commit

Permalink
use percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Feb 7, 2024
1 parent cd7fe94 commit d787613
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions notebooks/wp3/WIP-hit_rate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,16 @@
"outputs": [],
"source": [
"hit_rate = (ds_seasonal == ds_reanalysis).sum(\"valid_year\")\n",
"hit_rate = hit_rate.where(ds_seasonal.notnull().any(\"valid_year\"))\n",
"hit_rate *= 100 / ds_seasonal.notnull().sum(\"valid_year\")\n",
"for var, da in hit_rate.data_vars.items():\n",
" da[\"valid_month\"] = da[\"valid_month\"].astype(str)\n",
" da.attrs[\"long_name\"] = \"Hit-Rate\"\n",
" facet = da.plot(col=\"centre\", row=\"region\", x=\"valid_month\")\n",
" da.attrs = {\"long_name\": \"Hit-Rate\", \"units\": \"%\"}\n",
" facet = da.plot(\n",
" col=\"centre\",\n",
" row=\"region\",\n",
" x=\"valid_month\",\n",
" xticks=range(1, 13),\n",
" yticks=range(1, 13),\n",
" )\n",
" facet.fig.suptitle(f\"{da.name.replace('_', ' ')}\", y=1.01)\n",
" plt.show()"
]
Expand Down

0 comments on commit d787613

Please sign in to comment.