From d7876136542f38b3750a690d362a9d11370cf3a1 Mon Sep 17 00:00:00 2001 From: Mattia Almansi Date: Wed, 7 Feb 2024 12:25:14 +0100 Subject: [PATCH] use percentage --- notebooks/wp3/WIP-hit_rate.ipynb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/notebooks/wp3/WIP-hit_rate.ipynb b/notebooks/wp3/WIP-hit_rate.ipynb index 9ff1565..70436ce 100644 --- a/notebooks/wp3/WIP-hit_rate.ipynb +++ b/notebooks/wp3/WIP-hit_rate.ipynb @@ -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()" ]