From 92cb912752d3624c5c480f12cc904d58657fdabb Mon Sep 17 00:00:00 2001 From: Mattia Almansi Date: Mon, 9 Oct 2023 17:53:38 +0200 Subject: [PATCH] fix rmse --- notebooks/wp4/cmip6_sea_ice_evaluation.ipynb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/notebooks/wp4/cmip6_sea_ice_evaluation.ipynb b/notebooks/wp4/cmip6_sea_ice_evaluation.ipynb index 9626852..efb8d18 100644 --- a/notebooks/wp4/cmip6_sea_ice_evaluation.ipynb +++ b/notebooks/wp4/cmip6_sea_ice_evaluation.ipynb @@ -86,7 +86,7 @@ " \"kiost_esm\",\n", " \"miroc6\",\n", " \"miroc_es2l\",\n", - " # \"mpi_esm1_2_hr\", # TODO: Memory error\n", + " \"mpi_esm1_2_hr\", # TODO: Memory error\n", " \"mpi_esm1_2_lr\",\n", " \"mri_esm2_0\",\n", " \"nesm3\",\n", @@ -257,10 +257,10 @@ "\n", "\n", "def get_monthly_interpolated_data(ds, add_stde, check_values, **regrid_kwargs):\n", - " std_names = [\"latitude\", \"longitude\", \"sea_ice_area_fraction\"]\n", " if add_stde:\n", - " std_names.append(\"sea_ice_area_fraction standard_error\")\n", - " ds = ds.cf[std_names].cf.reset_coords(std_names[2:])\n", + " stde = ds.cf[\"sea_ice_area_fraction standard_error\"]\n", + "\n", + " ds = ds.cf[[\"latitude\", \"longitude\", \"sea_ice_area_fraction\"]]\n", "\n", " if regrid_kwargs:\n", " ds = interpolate_to_satellite_grid(ds, **regrid_kwargs)\n", @@ -268,6 +268,10 @@ " ds = ds.sortby(\"time\").resample(time=\"MS\").mean()\n", " ds[\"time\"].attrs[\"long_name\"] = \"time\"\n", "\n", + " if add_stde:\n", + " with xr.set_options(keep_attrs=True):\n", + " ds = ds.merge((stde**2).resample(time=\"MS\").mean() ** (1 / 2))\n", + "\n", " if check_values:\n", " ds = ds.where(\n", " ds.cf[\"sea_ice_area_fraction\"].any(set(ds.dims) - {\"time\"}).compute(),\n",