Dataset¶
Load completed netCDF measurements and recover explicitly staged Zarr stores.
- qanary.dataset.load(path)[source]¶
Load a qanary measurement dataset.
Wraps
xarray.load_dataset()with engine selection appropriate for Qanary-generated files (automatic selection for.ncand the Zarr engine for.zarr) and clear error messages.- Parameters:
path (Union[str, Path]) – Path to a
.ncfile or.zarrdirectory created by a QanaryMeasurementrun.- Returns:
The fully-loaded (in-memory) xarray dataset.
- Return type:
xr.Dataset
- Raises:
DatasetNotFoundError – If path does not exist on disk.
DatasetLoadError – If xarray raises any error while opening the file.
- qanary.dataset.convert(nc_path, *, overwrite=False)[source]¶
Convert the paired
.zarrstore for a measurement to netCDF.A normal run exports its current in-memory dataset directly to netCDF and removes its temporary live checkpoint. If recovery instead leaves a
.zarrdirectory beside the intended.ncfile, this function can complete that conversion manually.Expected layout on disk:
<stem>.nc <- target output (may or may not exist yet) <stem>.zarr/ <- live zarr store (must exist)
- Parameters:
- Returns:
Resolved absolute path to the written
.ncfile.- Return type:
Path
- Raises:
ZarrStoreNotFoundError – If the
.zarrdirectory does not exist next to nc_path.DatasetConvertError – If nc_path already exists and overwrite is False, or if conversion fails for another reason.
- exception qanary.dataset.QanaryDatasetError[source]¶
Bases:
ExceptionBase class for all dataset-related errors in qanary.
- exception qanary.dataset.DatasetNotFoundError[source]¶
Bases:
QanaryDatasetErrorRaised when the requested dataset file or directory does not exist.
- exception qanary.dataset.ZarrStoreNotFoundError[source]¶
Bases:
QanaryDatasetErrorRaised when the expected .zarr store directory cannot be found.
- exception qanary.dataset.DatasetLoadError[source]¶
Bases:
QanaryDatasetErrorRaised when xarray cannot open the dataset.
- exception qanary.dataset.DatasetConvertError[source]¶
Bases:
QanaryDatasetErrorRaised when conversion from .zarr to .nc fails.