(self)
| 1773 | open_dataset(tmp_file, group=(1, 2, 3)) |
| 1774 | |
| 1775 | def test_open_subgroup(self) -> None: |
| 1776 | # Create a netCDF file with a dataset stored within a group within a |
| 1777 | # group |
| 1778 | with create_tmp_file() as tmp_file: |
| 1779 | rootgrp = nc4.Dataset(tmp_file, "w") |
| 1780 | foogrp = rootgrp.createGroup("foo") |
| 1781 | bargrp = foogrp.createGroup("bar") |
| 1782 | ds = bargrp |
| 1783 | ds.createDimension("time", size=10) |
| 1784 | x = np.arange(10) |
| 1785 | ds.createVariable("x", np.int32, dimensions=("time",)) |
| 1786 | ds.variables["x"][:] = x |
| 1787 | rootgrp.close() |
| 1788 | |
| 1789 | expected = Dataset() |
| 1790 | expected["x"] = ("time", x) |
| 1791 | |
| 1792 | # check equivalent ways to specify group |
| 1793 | for group in "foo/bar", "/foo/bar", "foo/bar/", "/foo/bar/": |
| 1794 | with self.open(tmp_file, group=group) as actual: |
| 1795 | assert_equal(actual["x"], expected["x"]) |
| 1796 | |
| 1797 | def test_write_groups(self) -> None: |
| 1798 | data1 = create_test_data() |
nothing calls this directly
no test coverage detected