Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jul 4, 2024
1 parent 7996c02 commit bac96b2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions notebooks/wp5/lake_water_temperature_outlier_detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
")"
]
},
Expand All @@ -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])"
Expand Down

0 comments on commit bac96b2

Please sign in to comment.