Skip to content
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

Tag extent behaviour [discussion] #802

Open
achilleas-k opened this issue Nov 26, 2019 · 1 comment
Open

Tag extent behaviour [discussion] #802

achilleas-k opened this issue Nov 26, 2019 · 1 comment

Comments

@achilleas-k
Copy link
Member

achilleas-k commented Nov 26, 2019

We need to decide on the exact behaviour of extents for a couple of edge cases. Currently, extents are inclusive, so for a tag that has extents (10, 20) (assuming the interval of the underlying data is 1) the returned data has the shape (11, 21). This should probably change such that the extents are equivalent to the shape.

To generalise a little, let's assume a DataArray with n-dimensions, all regularly sampled with a sampling interval for dn (for dimension n). In that case, a tag with position (p1, p2, ..., pn) and extent (e1, e2, ..., en) should be equivalent to slicing the underlying array as:
[p1*d1:(p1+e1)*d1, p2*d2:(p2+e2)*d2, ..., pn*dn:(pn+en)*dn]

This would make extents exclusive.

There's also the more complicated question of what it means for an extent to be missing, what it means if it's 0, and what it means if it's 1. If we follow the above logic (and think about it in numpy equivalent behaviour), None, 0, and 1 are all different, but it might make sense if we treat None as 0 and take it to mean drop this dimension, while 1 returns an extra dimension with length 1.

@jgrewe jgrewe added this to the Version 1.5 milestone Nov 26, 2019
@achilleas-k
Copy link
Member Author

achilleas-k commented Nov 26, 2019

From Jan

Current behaviour (from #801 I believe?) is:

a.shape = (10, 10, 10)
t.position = (5, 5)
t.extent = None
t.retrieve(a).shape = (1,1,10)

New behaviour could be (this is my current proposal and personally preferred behaviour):

a.shape = (10, 10, 10)
t.position = (5, 5)

t.extent = None
t.retrieve(a).shape = (10)

t.extent = (0, 0)
t.retrieve(a).shape = (10)

t.extent = (1, 1)
t.retrieve(a).shape = (1, 1, 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants