Skip to content

Commit

Permalink
NetCDF saving avoid dimensionality reduction for string coords.
Browse files Browse the repository at this point in the history
  • Loading branch information
trexfeathers committed Mar 1, 2022
1 parent db445de commit 27677a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/iris/fileformats/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2865,10 +2865,11 @@ def _increment_name(self, varname):

@staticmethod
def _lazy_stream_data(data, fill_value, fill_warn, cf_var):
if data.shape == (1,) + cf_var.shape:
if hasattr(data, "shape") and data.shape == (1,) + cf_var.shape:
# Reduce dimensionality where bounds data is for a scalar point -
# bounds data is 2D but contains just 1 row, which causes
# broadcast ambiguity between the data and its 1D cf_var.
# (Don't do this check for string data).
data = np.atleast_1d(data[0])

if is_lazy_data(data):
Expand Down

0 comments on commit 27677a8

Please sign in to comment.