Skip to content

v0.2.0

Choose a tag to compare

@fschuch fschuch released this 07 Oct 17:33
· 3 commits to main since this release
f3b4ac8

What's Changed

Added

  • New xarray_binfile.conventions module with ready-to-use implementations of the read and write spec getter protocols:
    • FilenamePattern builds both the writer's formatter and the reader's regular expression from a single str.format template 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.
    • Layout declares the on-disk dimension order, coordinates and dtype, and validates arrays strictly before writing (dimensions, sizes and, by default, coordinate values).
    • StepIndexedFiles for files numbered by an integer step, with optional time_step to 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.
    • TimeStampedFiles for files named with the physical time (for example ux-0.250.bin), rejecting values that collide at the pattern precision.
    • StaticFiles for fields without a time dimension, one file per variable.
    • FolderConventions to dispatch on the parent folder when different folders hold arrays of different shapes. Writes require exactly one convention to accept the array and raise LayoutMismatchError otherwise.
  • WriteSpecs.filename may include sub-folders, created on demand, or be an absolute path, so one to_file call can target several locations.

Changed

  • to_file stages 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_file no 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.
  • Added CONTRIBUTING, CODE_OF_CONDUCT, and CITATION.cff by @fschuch in #45

Deprecated

  • xarray_binfile.tutorial.FileSpecsGetter is deprecated in favour of xarray_binfile.conventions.StepIndexedFiles. It is kept unchanged and emits a DeprecationWarning. Replace FileSpecsGetter(base_coords=coords, dtype=dtype) with StepIndexedFiles(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

Full Changelog: v0.1.0...v0.2.0