From ae16d42013abd2392ea7468a2c8885e596d7bfd3 Mon Sep 17 00:00:00 2001 From: "Martin K. Scherer" Date: Mon, 3 Apr 2023 22:43:46 +0200 Subject: [PATCH] Fix XArray LCS join (#861) * adjust reference time handling in xr_interp_coordinates_in_time --------- Co-authored-by: Cagtay Fabry <43667554+CagtayFabry@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- weldx/util/xarray.py | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27ef8367c..4f84e0c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release Notes +## 0.6.5 (unreleased) + +### Dependencies + +- require XArray >= 2022.9.0, as `LocalCoordinateSystem` now handles merges correctly \[{pull}`861`\]. + ## 0.6.4 (09.02.2023) Version `0.6.4` is a small maintenance release with no changes affecting user code. diff --git a/pyproject.toml b/pyproject.toml index 2e5a17bc1..204223147 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "numpy >=1.20", "asdf >=2.8.2,!=2.14.0,!=2.14.1,!=2.14.2", "pandas >=1.0", - "xarray >=0.19,<2022.09.0", + "xarray >=2022.9.0", "scipy >=1.4,!=1.6.0,!=1.6.1", "sympy >=1.6", "pint >=0.18", diff --git a/weldx/util/xarray.py b/weldx/util/xarray.py index c883217de..4cbf8d84c 100644 --- a/weldx/util/xarray.py +++ b/weldx/util/xarray.py @@ -737,10 +737,14 @@ def xr_interp_coordinates_in_time( return da times = Time(times).as_pandas_index() + time_ref = da.weldx.time_ref da = da.weldx.time_ref_unset() da = xr_interp_like( da, {"time": times}, assume_sorted=True, broadcast_missing=False, fillna=True ) + # resync and reset to correct format + if time_ref: + da.weldx.time_ref = time_ref da = da.weldx.time_ref_restore() if len(da.time) == 1: # remove "time dimension" for static cases