Skip to content

Commit

Permalink
New BatchSchema class to generate patch selectors and combine into ba…
Browse files Browse the repository at this point in the history
…tch selectors (#132)

In v0.2.0, information about the batch_selectors was stored as a dict in the ._batch_selectors attribute of the BatchGenerator class. This PR introduces BatchSchema which contains all necessary information about the batch selectors. BatchGenerator now creates an instance of BatchSchema, which handles the creation of selectors object. The purpose of BatchGenerator is to create batches (xarray Datasets/DataArrays) from those selector objects. This opens up possibilities including serializing/deserializing the BatchSchema (e.g., BatchSchema.to_json() and BatchSchema.from_json()), caching BatchSchema objects separate from caching batches, and relatedly applying one BatchSchema instance to multiple xarray datasets.

Co-authored-by: Anderson Banihirwe <[email protected]>

Co-authored-by: Anderson Banihirwe <[email protected]>
  • Loading branch information
maxrjones and andersy005 authored Jan 3, 2023
1 parent 13c69fe commit 221dfb0
Show file tree
Hide file tree
Showing 4 changed files with 322 additions and 54 deletions.
2 changes: 1 addition & 1 deletion xbatcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from . import testing # noqa: F401
from .accessors import BatchAccessor # noqa: F401
from .generators import BatchGenerator # noqa: F401
from .generators import BatchGenerator, BatchSchema # noqa: F401
from .util.print_versions import show_versions # noqa: F401

try:
Expand Down
Loading

0 comments on commit 221dfb0

Please sign in to comment.