-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
x and y range attributes on returned aggregations #1198
x and y range attributes on returned aggregations #1198
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1198 +/- ##
==========================================
+ Coverage 84.68% 84.70% +0.02%
==========================================
Files 35 35
Lines 8345 8357 +12
==========================================
+ Hits 7067 7079 +12
Misses 1278 1278
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Test failures are because our CI conda environments are now using |
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.
Accessing the ranges in the returned result is definitely useful, but I would have thought that the ranges were already readable from the extent of the coordinates in the DataArray returned?
Looks like the ranges are slightly larger than the coordinates would suggest. Is that just due to the size of each array cell? If so, having the ranges explicitly listed is indeed useful. |
Yes, linear coordinates are equally spaced and the end coordinates are half a cell width inside the ends. The ranges are therefore easy to calculate from the coordinates. But with logarithmic axes the maths is non-trivial so it is useful for the ranges to always be available. |
Closes #1157.
This PR adds new attributes
x_range
andy_range
to aggregations returned from datashader. Simple example:Output produced:
so the attributes can be accessed using
agg.x_range
and similar.The ranges are set regardless of whether they are specified by the user in the
Canvas
constructor, or determined from the data limits.For situations that return an
xarray.Dataset
rather than anxarray.DataArray
, e.g. if ads.summary()
is used, the attributes are copied to theDataset
. Hence they are always available as attributes of the top-level object returned fromCanvas
aggregation functions.