Skip to content

Commit

Permalink
Chunk control minor fixes (#5593)
Browse files Browse the repository at this point in the history
* Disallow chunks=None in optimum_chunksize.

* Clearer docstrings.

* Corrected docstring.
  • Loading branch information
trexfeathers authored Nov 20, 2023
1 parent 34571eb commit 0ca91c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/iris/_lazy_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def _optimum_chunksize_internals(
Args:
* chunks (tuple of int, or None):
Pre-existing chunk shape of the target data : None if unknown.
* chunks (tuple of int):
Pre-existing chunk shape of the target data.
* shape (tuple of int):
The full array shape of the target data.
* limit (int):
Expand Down Expand Up @@ -106,8 +106,6 @@ def _optimum_chunksize_internals(
"chunks = [c[0] for c in normalise_chunks('auto', ...)]".
"""
if chunks is None:
chunks = list(shape)

# Set the chunksize limit.
if limit is None:
Expand Down
10 changes: 8 additions & 2 deletions lib/iris/fileformats/netcdf/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,13 @@ def set(
@contextmanager
def from_file(self) -> None:
"""
Ensures the chunks are loaded in from file variables, else will throw an error.
Ensures the chunksizes are loaded in from NetCDF file variables.
Raises
------
KeyError
If any NetCDF data variables - those that become
:class:`~iris.cube.Cube`\\ s - do not specify chunksizes.
Notes
-----
Expand All @@ -800,7 +806,7 @@ def from_file(self) -> None:
@contextmanager
def as_dask(self) -> None:
"""
Ensures the chunks are decided from dask.
Uses Dask :external+dask:doc:`array` to control chunksizes.
Notes
-----
Expand Down

0 comments on commit 0ca91c3

Please sign in to comment.