Skip to content

Commit 3ccf1a8

Browse files
committed
Merge pull request #154 from akleeman/fix-decode-no-tests
Fix decode_cf_variable, without tests
2 parents 606f388 + dffb5ec commit 3ccf1a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

xray/conventions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ def get_to(source, dest, k):
414414
def decode_cf_variable(var, concat_characters=True, mask_and_scale=True,
415415
decode_times=True):
416416
# use _data instead of data so as not to trigger loading data
417+
var = xray.variable.as_variable(var)
417418
data = var._data
418419
dimensions = var.dimensions
419420
attributes = var.attrs.copy()
@@ -433,7 +434,7 @@ def pop_to(source, dest, k):
433434
return v
434435

435436
if 'dtype' in encoding:
436-
if var.data.dtype != encoding['dtype']:
437+
if data.dtype != encoding['dtype']:
437438
raise ValueError("Refused to overwrite dtype")
438439
encoding['dtype'] = data.dtype
439440

0 commit comments

Comments
 (0)