-
Notifications
You must be signed in to change notification settings - Fork 414
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
Issue with xarray dimensions #319
Comments
@juanfcocontreras Thanks for catching this and I plan on adding this to the release this weekend. Here's how I'll do it: @dtale.route("/xarray-dimension-values/<data_id>/<dim>")
@exception_decorator
def get_xarray_dimension_values(data_id, dim):
ds = global_state.get_dataset(data_id)
try:
dim = pd.DataFrame({"value": ds.coords[dim].data})
except ValueError:
dim = pd.Series({"value": ds.coords[dim].data}).to_frame()
dim_f, _ = build_formatters(dim)
return jsonify(data=dim_f.format_dicts(dim.itertuples())) Let me know if you're alright with that and I'll move forward 🙏 |
After that fix, dtale gives another exception in: Input:
Output:
|
It's been a while since I've used dtale for xarray, but I think there have been several changes, probably in pandas that have affected its functionality. If a single-point dataset is selected, it gives another exception. I don't know if both exceptions are related. Input:
Output:
|
Ok, thanks. Maybe i’ll hold off on this release and dig back into xarray for the next one. Thanks for your help |
@juanfcocontreras good news, I did some digging and the issue was with how I was obtaining the dimensions. I was assuming that everything in |
That's great, thank you very much! By the way, I don't know if to put it right here or open a new issue, when open_browser=True, it shouldn't appear dtale embedded in Jupyter (or nteract in my case), right? The browser is open, but still appears in the output of the cell. |
Ok I think I have a fix for that too |
Thas is awesome!! Thank you so much!! PD: I've played a little bit with the xarray fix and it seems to work fine! |
Terrific, I'll let you know when I publish 1.23.0 |
Ok v1.23.0 should be on conda in the next 15 minutes. Just merged the version update |
Both fixes seem to be working great. Thank you very much! |
With the following xarray file, I get the following exception when trying to access the xarray dimensions:
ValueError: If using all scalar values, you must pass an index
I think the problem is on line 2718 of the views.py file:
dim = pd.DataFrame({"value": ds.coords[dim].data})
And I think it would be enough to change it for the next one to fix it:
dim = pd.Series({"value": ds.coords[dim].data}).to_frame()
The text was updated successfully, but these errors were encountered: