Skip to content

Commit 48dac2c

Browse files
committed
fixup! Handle filter_temporal end-exclusiveness in DateTimeInterval #955
1 parent e288323 commit 48dac2c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎openeo/metadata/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ def filter_temporal(self, extent: Tuple[str | None, str | None] | List[str | Non
124124
if (interval1 := DateTimeInterval.try_from_tuple(self.extent)) and (
125125
interval2 := DateTimeInterval.try_from_tuple(extent, end_inclusive=False)
126126
):
127+
# Note on "end-inclusiveness" aspect in this intersection calculation:
128+
# the current extent of the dimension is end-inclusive by definition (a data extent),
129+
# while the `filter_temporal` extent is end-exclusive by definition (a filter extent).
130+
# The inclusivity is taken into account while determining the intersection,
131+
# but the end result is handled as (coerced into) an end-inclusive data extent regardless.
132+
# While this might introduce a (sub-)second imprecision, it is typically
133+
# multiple orders of magnitude smaller than the actual error (hours/days)
134+
# of this best-effort, client-side approximation/simulation.
127135
if intersection := interval1.intersection(interval2):
128136
new_extent = intersection.as_rfc3339()
129137
else:

0 commit comments

Comments
 (0)