Skip to content

xvrt 0.1.0

Latest

Choose a tag to compare

@mdsumner mdsumner released this 27 Oct 19:32
83df439

First release of xvrt: write GDAL multidimensional VRT from xarray Datasets
and STAC catalogues, in pure Python (no GDAL needed to write).

pip install xvrt
pip install "xvrt[stac]"   # adds pyarrow and pyproj for from_stac()

Documentation: https://hypertidy.github.io/xvrt/

Highlights

  • write_mdim_vrt() describes a collection of files as one multidimensional
    dataset, from the Dataset you get by opening them with xarray.
  • from_stac() builds the same from STAC items or a stac-geoparquet file,
    using catalogue fields only (grid, CRS, datetimes, band storage); no file
    is opened. For the GHRSST MUR collection on source.coop that is five
    variables over 8913 days in a few seconds.

Features

  • Compositions: concat (files already carry the dimension) and stack
    (one file per position of a new dimension), with explicit positions and
    gaps that read as nodata.
  • Multiple variables per VRT, from shared files or one source list per
    variable.
  • NetCDF/HDF5/Zarr array sources and GeoTIFF/COG band sources.
  • Packed data: storage dtype, scale, offset and nodata recovered from
    xarray's .encoding, so GDAL decodes the stored bytes as xarray did.
  • Time re-encoded with its original CF units and calendar (cftime included).
  • Every source states its extent (<SourceSlab>), so a read opens only the
    files it touches.
  • <SRS> with the data-axis-to-SRS-axis mapping computed from the WKT axis
    order.
  • Regular coordinates written as start and step.
  • Dataset.vrt.write_mdim() accessor via import xvrt.accessor.

Output validates against GDAL's gdalvrt.xsd, except the multidim
<BlockSize>, which is written comma-separated as GDAL's driver requires
(the schema expects spaces).

Known limitation

In GDAL 3.13, a strided read (step > 1) across the sources of a
multidimensional VRT fails; read the wanted positions individually or in
contiguous runs. This is a GDAL issue, not specific to VRTs written by xvrt.

Full changelog: https://github.com/hypertidy/xvrt/blob/main/CHANGELOG.md