Comments (4)
Is it planned to backport the bugfixes of xarray to this datatree repo, or not (so users are encouraged to use the latest xarray versions)?
No - this repo will be archived in favour of using xarray itself.
from datatree.
Technical analysis
Quick fix
The quick and dirty fix can be the following
- "<div class='xr-wrap' style='display:none'>"
+ "<div class='xr-wrap' style='display:none; min-width: 700px;'>"
It forces override the min-width: 300px
coming from the xr-wrap
CSS class, and replace it with the same value as its max-width of 700px
.
See the method _obj_repr
https://github.com/pydata/xarray/blob/12123be8608f3a90c6a6d8a1cdc4845126492364/xarray/core/formatting_html.py#L297C22-L297C24
See the xr-wrap
class https://github.com/pydata/xarray/blob/12123be8608f3a90c6a6d8a1cdc4845126492364/xarray/static/css/style.css#L29
Better fix
The good fix would be to update the class xr-wrap
; however this class is from the xarray's core, so changing it would not only change datatree but xarray too. So, an alternative could be for instance, adding a new class, xr-datatree-wrap
, with more-suited width parameters, copied from xr-wrap
with a minor change:
.xr-wrap {
display: block !important;
min-width: 300px;
max-width: 700px;
}
.xr-dataset-wrap {
display: block !important;
min-width: 700px;
max-width: 700px;
}
Improvement
The following applies to both xarray and datatree.
The current collapsible section is based on using hidden checkboxes with the CSS :checked
selector to reveal or hide the elements. This code is from 5 years ago. This StackOverflow thread shows the current solution being using <details>
, and the old solution of using hidden checkboxes and CSS :checked
selection as an older solution: https://stackoverflow.com/questions/41220717/collapse-without-javascript
Recently, a new couple of HTML elements have been added, <details>
and <summary>
, that are the official HTML tags to implemented collapsible sections with little effort. See MDN docs: <details>
: The Details disclosure element (widely available on browsers according to this link)
Example (it works with GitHub's markdown)
-
Giant planets
-
Gas giants
- Jupiter
- Saturn
-
Ice giants
- Uranus
- Neptune
-
Example taken from Tree views in CSS
The idea would be to just create a tree structure of nested <section>
and <summary>
, and delegating the final HTML rendering to the current Dataset code. This can be done for each node, by using to_dataset()
, whether the group is a leaf or not. Each node would be: its Dataset (the leaf variables it contains) + its children.
An other alternative, at the cost of a dependency, would be to use ipytree, a Jupyter widget representing a tree. This is a Jupyter widget ; can it be rendered as HTML for export?
from datatree.
This should be a duplicate of #91 (unless I'm misunderstanding something?). Can you try to reproduce with xarray.core.datatree.DataTree
? I believe this should have been fixed in pydata/xarray#8930.
from datatree.
Hello, indeed it is a duplicate of #91 and is fixed when using xarray.core.datatree.DataTree
!
The point of using <details>
and <summary>
remains, but as long as the current solution works... I am fine with it!
Is it planned to backport the bugfixes of xarray to this datatree repo, or not (so users are encouraged to use the latest xarray versions)?
from datatree.
Related Issues (20)
- Resolve dimension coordinates from parents HOT 8
- Tree linkage + dataset in one object nonideal for UI tree view HOT 6
- v0.0.14 not on pypi HOT 1
- setting node name breaks tree linkage HOT 7
- When creating a DataTree from a Dataset with path-like variable, subgroups are expected to be created HOT 8
- Actually you're right, I don't know if the docs currently mention anywhere that assigning to `.ds` is allowed!
- Typing: `DataTree[Unknown]`
- `drop_vars` issue? HOT 1
- Creating DataTree from DataArrays
- Opening a datatree from S3 bucket HOT 3
- Typing issue: Pylance complains with DataTree inequalities HOT 1
- open_datatree() keeps the hdf file open preventing writes HOT 2
- open_datatree() from zarr creates issues with `kwargs` HOT 4
- `open_datatree` performance HOT 2
- decision analysis in datatree? HOT 1
- Collapse by default the "Attributes" section in rich display HOT 1
- Add an `attrs` keyword argument to the constructor: `DataTree(attrs={})` HOT 1
- Describe a DataTree: adidng visualization and summarization capabilities HOT 1
- Auto-plotting capabilities HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datatree.