Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/iris/_lazy_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def _co_realise_lazy_arrays(arrays):
if real_out is not None:
real_out = np.asanyarray(real_out)
else:
raise iris.exceptions.DatalessError("realising")
raise iris.exceptions.DatalessError("Data is None; cannot be realised.")
if isinstance(real_out, ma.core.MaskedConstant):
# Convert any masked constants into NumPy masked arrays.
# NOTE: in this case, also apply the original lazy-array dtype, as
Expand Down
6 changes: 4 additions & 2 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -5374,7 +5374,9 @@ def interpolate(

"""
if self.is_dataless():
raise iris.exceptions.DatalessError("interpolate")
raise iris.exceptions.DatalessError(
"Dataless cubes cannot be interpolated."
)
coords, points = zip(*sample_points)
interp = scheme.interpolator(self, coords) # type: ignore[arg-type]
return interp(points, collapse_scalar=collapse_scalar)
Expand Down Expand Up @@ -5421,7 +5423,7 @@ def regrid(self, grid: Cube, scheme: iris.analysis.RegriddingScheme) -> Cube:

"""
if self.is_dataless():
raise iris.exceptions.DatalessError("regrid")
raise iris.exceptions.DatalessError("Dataless cubes cannot be regridded.")
regridder = scheme.regridder(self, grid)
return regridder(self)

Expand Down
9 changes: 2 additions & 7 deletions lib/iris/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,9 @@ class CannotAddError(ValueError):


class DatalessError(ValueError):
"""Raised when an method cannot be performed on a dataless :class:`~iris.cube.Cube`."""
"""Raised when a method cannot be performed on a dataless :class:`~iris.cube.Cube`."""

def __str__(self):
msg = (
"Dataless cubes are still early in implementation, and dataless {} "
"operations are not currently supported."
)
return msg.format(super().__str__())
pass


class CFParseError(IrisError):
Expand Down
Loading