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

Method __init__

xarray/backends/h5netcdf_.py:124–155  ·  view source on GitHub ↗
(
        self,
        manager: FileManager | h5netcdf.File | h5netcdf.Group,
        group=None,
        mode=None,
        format="NETCDF4",
        lock=HDF5_LOCK,
        autoclose=False,
    )

Source from the content-addressed store, hash-verified

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":

Callers

nothing calls this directly

Calls 5

find_root_and_groupFunction · 0.90
DummyFileManagerClass · 0.90
is_remote_uriFunction · 0.90
ensure_lockFunction · 0.90
typeFunction · 0.85

Tested by

no test coverage detected