Skip to content

Commit 87bd449

Browse files
committed
Moving chunks check below the dataarray check - because won't work if on dataset
1 parent 35d4676 commit 87bd449

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xarray_schema/core.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ def validate(self, da: xr.DataArray) -> xr.DataArray:
7272
------
7373
SchemaError
7474
'''
75-
if da.chunks:
76-
assert _check_regular_chunks(da.chunks), 'Good gracious no! Chunks are not regular!'
7775
if not isinstance(da, xr.DataArray):
7876
raise ValueError('Input must be a xarray.DataArray')
77+
78+
if da.chunks:
79+
assert _check_regular_chunks(da.chunks), 'Good gracious no! Chunks are not regular!'
7980

8081
if self.dtype is not None and not np.issubdtype(da.dtype, self.dtype):
8182
raise SchemaError(f'dtype {da.dtype} != {self.dtype}')

0 commit comments

Comments
 (0)