MCPcopy Index your code
hub / github.com/pydata/xarray / test_append_with_new_variable

Method test_append_with_new_variable

xarray/tests/test_backends.py:3340–3357  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3338 )
3339
3340 def test_append_with_new_variable(self) -> None:
3341 ds, ds_to_append, ds_with_new_var = create_append_test_data()
3342
3343 # check append mode for new variable
3344 with self.create_zarr_target() as store_target:
3345 combined = xr.concat([ds, ds_to_append], dim="time")
3346 combined.to_zarr(store_target, mode="w", **self.version_kwargs)
3347 assert_identical(
3348 combined,
3349 xr.open_dataset(store_target, engine="zarr", **self.version_kwargs),
3350 )
3351 ds_with_new_var.to_zarr(store_target, mode="a", **self.version_kwargs)
3352 combined = xr.concat([ds, ds_to_append], dim="time")
3353 combined["new_var"] = ds_with_new_var["new_var"]
3354 assert_identical(
3355 combined,
3356 xr.open_dataset(store_target, engine="zarr", **self.version_kwargs),
3357 )
3358
3359 def test_append_with_append_dim_no_overwrite(self) -> None:
3360 ds, ds_to_append, _ = create_append_test_data()

Callers

nothing calls this directly

Calls 6

create_zarr_targetMethod · 0.95
create_append_test_dataFunction · 0.90
assert_identicalFunction · 0.90
concatMethod · 0.45
to_zarrMethod · 0.45
open_datasetMethod · 0.45

Tested by

no test coverage detected