Closed valeriupredoi closed 3 years ago
iris version: iris 3.1.0 py39hf3d152e_1 conda-forge
looks like iris is not permitting reshaping: in lib/python3.9/site-packages/iris/_data_manager.py
l.259
if init_done and self.shape != data.shape:
# The _ONLY_ data reshape permitted is converting a 0-dimensional
# array i.e. self.shape == () into a 1-dimensional array of length
# one i.e. data.shape == (1,)
if self.shape or data.shape != (1,):
emsg = "Require data with shape {!r}, got {!r}."
raise ValueError(emsg.format(self.shape, data.shape))
Well, yes, the shape of a cube can not be changed like this.
yip, but broadcasting the fx data onto the shape of the data cube should be allowed no?
Yes. I think a straight-forward fix is as follows:
Since fx_cube.data
effectively is only a temporary variable here, just use it as such, i.e. s/fx_cube.data/fx_cube_data/
in L117-118. Beware that the same problem happens a little later in the file, so perhaps best to search for broadcast_to
. Also, we should add a test with different size cubes.
right on, Klaus! work started in https://github.com/ESMValGroup/ESMValCore/pull/1350
Minimal recipe
Trace (full)
Issue in a nutshell
fx data has shape: (64, 128) and data cube has shape: (36, 17, 64, 128); in
_mask.py
l.117 (not 118 as in the trace, I added a line at pos 117 inspect the two cubes)fails to broadcast fx data onto cube data.