ianhi / ianhi/xarray-linked-indexes

Partial Interval Selection - what to do

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

If you slice the continuous index to include only part of an interval what should we do with an interval. The current behavior:

```python
from linked_indices.interval_index import DimensionInterval
from linked_indices.util import interval_dataset
ds = interval_dataset(interval_dim="intervals")
ds = (
ds.drop_indexes(["time", "intervals"])
.set_xindex(["time", "intervals"], DimensionInterval)
.drop_vars("word")
)
print(ds.sel(time=slice(500,1500)))
```

```
Size: 50kB
Dimensions: (C: 10, time: 201, rgb: 3, intervals: 2)
Coordinates:
* time (time) int64 2kB 500 505 510 515 520 ... 1480 1485 1490 1495 1500
* intervals (intervals) interval[int64, left] 32B [0, 1000) [1000, 2500)
Dimensions without coordinates: C, rgb
Data variables:
data (C, time, rgb) float64 48kB 1.0 0.0 0.0 1.0 ... 1.0 0.2806 0.0
Indexes:
┌ time DimensionInterval
└ intervals
```

makes decent sense. But you could image that the interval should maybe be truncated to match the actual time values

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.