diff --git a/notebooks/wp5/lake_water_temperature_outlier_detection.ipynb b/notebooks/wp5/lake_water_temperature_outlier_detection.ipynb index 06b8d58..9eaa98d 100644 --- a/notebooks/wp5/lake_water_temperature_outlier_detection.ipynb +++ b/notebooks/wp5/lake_water_temperature_outlier_detection.ipynb @@ -127,7 +127,9 @@ "outputs": [], "source": [ "_ = plot.projected_map(\n", - " ds[\"lakeid\"].isel(time=0), projection=ccrs.PlateCarree(), show_stats=False\n", + " ds[\"lakeid\"].isel(time=0),\n", + " projection=ccrs.PlateCarree(),\n", + " show_stats=False,\n", ")" ] }, @@ -146,19 +148,16 @@ "metadata": {}, "outputs": [], "source": [ - "# Reindex using lakeids\n", + "# Reindex using lakeids and min_quality_level\n", "lakeid = (\n", " xr.DataArray(np.unique(ds[\"lakeid\"].values), dims=(\"lakeid\"))\n", " .dropna(\"lakeid\")\n", " .astype(int)\n", ")\n", - "ds = ds.drop_vars(\"lakeid\").where(ds[\"lakeid\"] == lakeid).assign_coords(lakeid=lakeid)\n", - "\n", - "# Reindex using min_quality_level\n", "min_quality_level = xr.DataArray([0, 4], dims=(\"min_quality_level\"))\n", - "ds = ds.where(ds[\"quality_level\"] >= min_quality_level).assign_coords(\n", - " min_quality_level=min_quality_level\n", - ")\n", + "ds = ds.drop_vars(\"lakeid\").where(ds[\"lakeid\"] == lakeid)\n", + "ds = ds.where(ds[\"quality_level\"] >= min_quality_level)\n", + "ds = ds.assign_coords(lakeid=lakeid, min_quality_level=min_quality_level)\n", "\n", "# Spatial weighted mean\n", "da = diagnostics.spatial_weighted_mean(ds[varname])"