Skip to content

Commit fff4355

Browse files
author
Joseph Hamman
committed
handle large last chunk
1 parent a4173b2 commit fff4355

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ schema_ds.validate(da.to_dataset())
4949

5050
This is a very early prototype of a library. Some key things are missing:
5151

52-
1. Validation of `coords` and `attrs`. None of these are implemented yet.
53-
1. Class-based schema's for parts of the Xarray data model. Most validations are currently made as direct comparisons (`da.name == self.name`) but a more robust approach is possible that leverages classes for each component of the data model. We're already handling some special cases using `None` as a sentinel value to allow for wildcard-like behavior in places (i.e. `dims` and `shape`)
52+
1. Validation of `coords` and `attrs`. These are implemented yet.
5453
1. Exceptions: Pandera accumulates schema exceptions and reports them all at once. Currently, we are a eagerly raising `SchemaErrors` when the are found.
5554

5655
## license

tests/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def test_component_schema(component, schema_args, validate, json):
8787
),
8888
(ChunksSchema, {'x': -1}, (((1, 2, 1),), ('x',), (4,)), r'.*did not match.*'),
8989
(ChunksSchema, {'x': 2}, (((2, 3, 2),), ('x',), (7,)), r'.*did not match.*'),
90+
(ChunksSchema, {'x': 2}, (((2, 2, 3),), ('x',), (7,)), r'.*did not match.*'),
9091
(ChunksSchema, {'x': 2, 'y': -1}, (((2, 2), (5, 5)), ('x', 'y'), (4, 10)), r'.*(5).*'),
9192
],
9293
)

xarray_schema/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def validate(
156156
if ec < 0:
157157
ec = dim_sizes[key]
158158
ac = dim_chunks[key]
159-
if not all(a == ec for a in ac[:-1]) and ac[-1] <= ec:
159+
if not all(a == ec for a in ac[:-1]) or ac[-1] <= ec:
160160
raise SchemaError(f'{key} chunks did not match: {ac} != {ec}')
161161

162162
else: # assumes ec is an iterable

0 commit comments

Comments
 (0)