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

Method test_honor_chunks

xarray/tests/test_backends_api.py:218–231  ·  view source on GitHub ↗

Honor the backend's preferred chunks when opening a dataset.

(self, shape, pref_chunks, request_with_empty_map)

Source from the content-addressed store, hash-verified

216 )
217 @pytest.mark.parametrize("request_with_empty_map", [False, True])
218 def test_honor_chunks(self, shape, pref_chunks, request_with_empty_map):
219 """Honor the backend's preferred chunks when opening a dataset."""
220 initial = self.create_dataset(shape, pref_chunks)
221 # To keep the backend's preferred chunks, the `chunks` argument must be an
222 # empty mapping or map dimensions to `None`.
223 chunks = (
224 {}
225 if request_with_empty_map
226 else dict.fromkeys(initial[self.var_name].dims, None)
227 )
228 final = xr.open_dataset(
229 initial, engine=PassThroughBackendEntrypoint, chunks=chunks
230 )
231 self.check_dataset(initial, final, explicit_chunks(pref_chunks, shape))
232
233 @pytest.mark.parametrize(
234 "shape,pref_chunks,req_chunks",

Callers

nothing calls this directly

Calls 4

create_datasetMethod · 0.95
check_datasetMethod · 0.95
explicit_chunksFunction · 0.85
open_datasetMethod · 0.45

Tested by

no test coverage detected