File: datatree.py

package info (click to toggle)
python-xarray 2025.08.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,796 kB
  • sloc: python: 115,416; makefile: 258; sh: 47
file content (15 lines) | stat: -rw-r--r-- 429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import xarray as xr
from xarray.core.datatree import DataTree


class Datatree:
    def setup(self):
        run1 = DataTree.from_dict({"run1": xr.Dataset({"a": 1})})
        self.d_few = {"run1": run1}
        self.d_many = {f"run{i}": xr.Dataset({"a": 1}) for i in range(100)}

    def time_from_dict_few(self):
        DataTree.from_dict(self.d_few)

    def time_from_dict_many(self):
        DataTree.from_dict(self.d_many)