File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
lib/iris/fileformats/netcdf Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,14 @@ def _get_cf_var_data(cf_var, filename):
253
253
if total_bytes < _LAZYVAR_MIN_BYTES :
254
254
# Don't make a lazy array, as it will cost more memory AND more time to access.
255
255
result = cf_var [:]
256
+
257
+ # Special handling of masked scalar value; this will be returned as
258
+ # an `np.ma.masked` instance which will loose the original dtype.
259
+ # Workaround for this it return a 1-element masked array of the
260
+ # correct dtype. Note - this is not an ussue for masked arrays,
261
+ # only masked scalar values.
262
+ if result is np .ma .masked :
263
+ result = np .ma .masked_all (1 , dtype = cf_var .datatype )
256
264
else :
257
265
# Get lazy chunked data out of a cf variable.
258
266
# Creates Dask wrappers around data arrays for any cube components which
You can’t perform that action at this time.
0 commit comments