-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
groupby_bins: exclude bin or assign bin with nan when bin has no values #1019
Comments
Just to understand better, what is the advantage to having this empty bin? How would you use that feature? As is, the resulting Dataset can still be aligned with other bin objects that have different coordinates (i.e. non empty final bin). |
So if I plot the current output as a bar chart/histogram, that bin interval will be skipped. For example if I did: I guess that perhaps there is a cleverer way of plotting the output data than this. This leads to more important questions:
Thanks |
The sorting of bins should have been fixed in #952. |
As for the empty bins, I can see how this would be useful. I suppose it is a bug. Curious what @shoyer thinks about this case... |
@rabernat I don't have much capability to help, but if any changes are made I am happy to help test this particular case. |
For now, can you just confirm what version of xarray you are using ( I'm not sure if #952 has been released yet, but if you are using the latest master, that should at least fix the sorting issue. |
0.8.2 updated from conda a few days ago. I'll try the master. Thanks |
We actually already have some similar for ensuring that all resampled bins appear (see |
Thanks @shoyer and @rabernat . @gidden and I may have a go next week. |
* Fix a typo * fixes #1019 * fixed tiny bug * changed default * got rid of keyword arg
When using groupby_bins there are cases where no values are found for some of the bins specified. Currently, it appears that in these cases, the bin is skipped, with no value neither a bin entry added to the output dataarray.
Is there a way to identify which bins have been skipped. Or preferably, is it possible to have an option to include those bins, but with nan values. This would make comparing two dataarrays easier in cases where despite the same bin intervals as inputs, the outputs result in dataarrays with different variable and coordinates lengths.
In this case, no data falls in the 4th bin between 50 and 50.00001.
Obviously one can count the lengths but this doesn't indicate which bin was skipped. An option to include the empty bin with a nan value would be useful! Thanks
bins_example.zip
The text was updated successfully, but these errors were encountered: