From 715335238ddeef0b444d9346b696e5f11fef9614 Mon Sep 17 00:00:00 2001
From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu>
Date: Fri, 21 May 2021 15:43:28 +0200
Subject: [PATCH] Set time encoding: calendar.

---
 climax/main/preprocess.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/climax/main/preprocess.py b/climax/main/preprocess.py
index 526829a..726544d 100644
--- a/climax/main/preprocess.py
+++ b/climax/main/preprocess.py
@@ -176,6 +176,9 @@ if __name__ == '__main__':
                 # read multiple netcdf files using xarray and dask
                 ds = xr.open_mfdataset(group, parallel=True).compute()
 
+                # set encoding of time: calendar
+                ds.time.encoding = ds.time_bnds.encoding
+
                 # save aggregated netcdf file
                 LOGGER.info('Saving aggregated NetCDF: {}'.format(filename))
                 ds.to_netcdf(filename)
-- 
GitLab