diff --git a/notebooks/wp5/satellite_esacci_gmpe_trends.ipynb b/notebooks/wp5/satellite_esacci_gmpe_trends.ipynb index 57a801e..5cf37a3 100644 --- a/notebooks/wp5/satellite_esacci_gmpe_trends.ipynb +++ b/notebooks/wp5/satellite_esacci_gmpe_trends.ipynb @@ -217,7 +217,7 @@ " chunks=chunks,\n", " transform_chunks=False,\n", " transform_func=compute_low_resolution,\n", - " transform_func_kwargs={\"freq\": \"Q-DEC\" if seasonal else \"MS\"},\n", + " transform_func_kwargs={\"freq\": \"QE-DEC\" if seasonal else \"MS\"},\n", " **open_mfdataset_kwargs,\n", " )\n", " dataarrays.append(rechunk(ds[\"analysed_sst\"]))\n", @@ -227,8 +227,8 @@ " 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 = _mann_kendall(da, **mann_kendall_kwargs)\n", - " ds[\"trend\"].attrs[\"units\"] = f\"{da.attrs['units']}/month\"\n", + " ds = da.groupby(\"time.year\").map(_mann_kendall, **mann_kendall_kwargs)\n", + " ds[\"trend\"].attrs[\"units\"] = f\"{da.attrs['units']}/year\"\n", " return rechunk(ds)" ] }, @@ -264,6 +264,8 @@ " )\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", @@ -330,7 +332,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.11.9" } }, "nbformat": 4,