(
self,
manager: FileManager | h5netcdf.File | h5netcdf.Group,
group=None,
mode=None,
format="NETCDF4",
lock=HDF5_LOCK,
autoclose=False,
)
| 122 | ) |
| 123 | |
| 124 | def __init__( |
| 125 | self, |
| 126 | manager: FileManager | h5netcdf.File | h5netcdf.Group, |
| 127 | group=None, |
| 128 | mode=None, |
| 129 | format="NETCDF4", |
| 130 | lock=HDF5_LOCK, |
| 131 | autoclose=False, |
| 132 | ): |
| 133 | import h5netcdf |
| 134 | |
| 135 | if isinstance(manager, h5netcdf.File | h5netcdf.Group): |
| 136 | if group is None: |
| 137 | root, group = find_root_and_group(manager) |
| 138 | else: |
| 139 | if type(manager) is not h5netcdf.File: |
| 140 | raise ValueError( |
| 141 | "must supply a h5netcdf.File if the group argument is provided" |
| 142 | ) |
| 143 | root = manager |
| 144 | manager = DummyFileManager(root) |
| 145 | |
| 146 | self._manager = manager |
| 147 | self._group = group |
| 148 | self._mode = mode |
| 149 | self.format = format or "NETCDF4" |
| 150 | # todo: utilizing find_root_and_group seems a bit clunky |
| 151 | # making filename available on h5netcdf.Group seems better |
| 152 | self._filename = find_root_and_group(self.ds)[0].filename |
| 153 | self.is_remote = is_remote_uri(self._filename) |
| 154 | self.lock = ensure_lock(lock) |
| 155 | self.autoclose = autoclose |
| 156 | |
| 157 | def get_child_store(self, group: str) -> Self: |
| 158 | if self.format == "NETCDF4_CLASSIC": |
nothing calls this directly
no test coverage detected