MCPcopy
hub / github.com/pydata/xarray / setup

Method setup

asv_bench/benchmarks/indexing.py:77–94  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

75
76class Base:
77 def setup(self, key):
78 self.ds = xr.Dataset(
79 {
80 "var1": (("x", "y"), randn((nx, ny), frac_nan=0.1)),
81 "var2": (("x", "t"), randn((nx, nt))),
82 "var3": (("t",), randn(nt)),
83 },
84 coords={
85 "x": np.arange(nx),
86 "y": np.linspace(0, 1, ny),
87 "t": pd.date_range("1970-01-01", periods=nt, freq="D"),
88 "x_coords": ("x", np.linspace(1.1, 2.1, nx)),
89 },
90 )
91 # Benchmark how indexing is slowed down by adding many scalar variable
92 # to the dataset
93 # https://github.com/pydata/xarray/pull/9003
94 self.ds_large = self.ds.merge({f"extra_var{i}": i for i in range(400)})
95
96
97class Indexing(Base):

Callers 1

setupMethod · 0.45

Calls 4

randnFunction · 0.85
arangeMethod · 0.80
linspaceMethod · 0.80
mergeMethod · 0.45

Tested by

no test coverage detected