Repository navigation
v0.2.0
What's Changed
Added
- New
xarray_binfile.conventionsmodule with ready-to-use implementations of the read and write spec getter protocols:FilenamePatternbuilds both the writer's formatter and the reader's regular expression from a singlestr.formattemplate such as"{name}-{step:04d}.bin". Matching is anchored to the whole filename, zero-fill is a minimum width, and formatting verifies that the result parses back, so write and read conventions can no longer drift apart.Layoutdeclares the on-disk dimension order, coordinates and dtype, and validates arrays strictly before writing (dimensions, sizes and, by default, coordinate values).StepIndexedFilesfor files numbered by an integer step, with optionaltime_stepto map steps to physical time on read and back on write. Values that do not land on an integer step raise instead of being truncated.TimeStampedFilesfor files named with the physical time (for exampleux-0.250.bin), rejecting values that collide at the pattern precision.StaticFilesfor fields without a time dimension, one file per variable.FolderConventionsto dispatch on the parent folder when different folders hold arrays of different shapes. Writes require exactly one convention to accept the array and raiseLayoutMismatchErrorotherwise.
WriteSpecs.filenamemay include sub-folders, created on demand, or be an absolute path, so oneto_filecall can target several locations.
Changed
to_filestages each file in a temporary sibling next to its destination and moves it into place atomically, instead of using one temporary directory inside the output directory. Relative filenames that escape the output directory through..are rejected; the output directory itself must exist.to_fileno longer copies the array when the on-disk dtype equals the in-memory dtype.
Documentation
- The spec getter protocols page is rewritten around the shipped conventions, with examples for step-indexed, time-stamped, static and folder-dependent layouts. All tutorials use the new conventions, and the API reference gains a Conventions section.
Deprecated
xarray_binfile.tutorial.FileSpecsGetteris deprecated in favour ofxarray_binfile.conventions.StepIndexedFiles. It is kept unchanged and emits aDeprecationWarning. ReplaceFileSpecsGetter(base_coords=coords, dtype=dtype)withStepIndexedFiles(Layout(coords, dtype=dtype)); the default pattern produces the same filenames.
Internals
- Build(deps-dev): bump pytest-rerunfailures from 16.3 to 16.4 in the pip-dependencies group by @dependabot[bot] in #32
- Build(deps): bump SonarSource/sonarqube-scan-action from 8.2.0 to 8.2.1 in the actions group by @dependabot[bot] in #35
- Build(deps-dev): bump pytest-rerunfailures from 16.4 to 16.5 in the pip-dependencies group by @dependabot[bot] in #37
- Build(deps): bump the actions group across 1 directory with 4 updates by @dependabot[bot] in #38
- Build(deps-dev): bump pytest-rerunfailures from 16.5 to 16.6 in the pip-dependencies group by @dependabot[bot] in #39
- Build(deps-dev): bump the pip-dependencies group with 2 updates by @dependabot[bot] in #40
- Build(deps): bump SonarSource/sonarqube-scan-action from 8.2.1 to 8.2.2 in the actions group by @dependabot[bot] in #41
- Build(deps-dev): bump pytest-rerunfailures from 16.6.1 to 16.7 in the pip-dependencies group by @dependabot[bot] in #42
Other Changes
- pre-commit autoupdate by @pre-commit-ci[bot] in #33
- pre-commit autoupdate by @pre-commit-ci[bot] in #34
- pre-commit autoupdate by @pre-commit-ci[bot] in #43
Full Changelog: v0.1.0...v0.2.0