Skip to content

Commit

Permalink
fix yearly trend
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jun 3, 2024
1 parent 0ac48b2 commit 697d7cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions notebooks/wp5/satellite_esacci_gmpe_trends.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@
" ds = da.groupby(\"time.season\").map(_mann_kendall, **mann_kendall_kwargs)\n",
" ds[\"trend\"].attrs[\"units\"] = f\"{da.attrs['units']}/year\"\n",
" else:\n",
" ds = da.groupby(\"time.year\").map(_mann_kendall, **mann_kendall_kwargs)\n",
" ds = _mann_kendall(\n",
" da.groupby(\"time.year\").mean(keep_attrs=True).rename(year=\"time\"),\n",
" **mann_kendall_kwargs,\n",
" )\n",
" ds[\"trend\"].attrs[\"units\"] = f\"{da.attrs['units']}/year\"\n",
" return rechunk(ds)"
]
Expand Down Expand Up @@ -264,8 +267,6 @@
" )\n",
" for coord in (\"longitude\", \"latitude\"):\n",
" ds[coord] = ds[coord].round(3)\n",
" if not seasonal:\n",
" ds = ds.mean(\"year\", keep_attrs=True)\n",
" ds = ds.expand_dims(product=[product])\n",
" datasets.append(rechunk(ds))\n",
" maps_datasets[f\"{seasonal=}\"] = xr.concat(datasets, \"product\")\n",
Expand Down

0 comments on commit 697d7cb

Please sign in to comment.