-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update TimeSeries
handling of absolute times
#791
Conversation
Codecov Report
@@ Coverage Diff @@
## master #791 +/- ##
=======================================
Coverage 96.87% 96.87%
=======================================
Files 88 88
Lines 6019 6025 +6
=======================================
+ Hits 5831 5837 +6
Misses 188 188
Help us with your feedback. Take ten seconds to tell us how you rate us. |
weldx/core.py
Outdated
if self.time is None and time.is_absolute: | ||
# type: ignore[union-attr] | ||
data = data.weldx.reset_reference_time(time.reference_time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something we should probably discuss. It fixes the following problem:
We replaced
return ut.xr_interp_like(
self._data,
{"time": time.as_data_array()},
method=self.interpolation,
assume_sorted=False,
broadcast_missing=False,
)
with
return ut.xr_interp_like(
data,
time.as_data_array(),
method=self.interpolation,
assume_sorted=False,
broadcast_missing=False,
)
to get absolute times working correctly when using xr_interp_like
. However, this causes the test case (ts_const, time_mul + pd.Timestamp("2020"), [1, 1, 1, 1, 1, 1, 1, 1], "m")
of test_interp_time
to fail (currently line 450 in test_core.py
). The test just checks if the value of a constant TimeSeries
that gets interpolated with an array of times is broadcasted correctly. Since the value is constant, reference times shouldn't matter, but after the change, they suddenly did. So I caught this special case and just added a reference time to a copy of the data prior to interpolation. The question is if we want to keep it that way, should it be handled differently or is that something that xr_interp_like
should handle internally
Changes
Addresses the issues mentioned in #471
Related Issues
Closes #471
Checks
updated doc/update example/tutorial notebooksupdate manifest file