python - xarray: calculate time-series of daily anomalies

PHOTO EMBED

Sat May 08 2021 10:53:52 GMT+0000 (Coordinated Universal Time)

Saved by @diptish #python

da = da.assign_coords(year_month=da.time.dt.strftime("%Y-%m"))
result = da.groupby("year_month") - da.groupby("year_month").mean("time")
content_copyCOPY

https://stackoverflow.com/questions/61370684/xarray-calculate-time-series-of-daily-anomalies-from-local-monthly-means