xhycom reads HYCOM model output in the native .ab format directly into xarray Datasets, with coordinates, units, and lazy out-of-memory access attached automatically.
conda (recommended, includes xESMF for horizontal regridding):
conda install -c conda-forge xhycompip (xESMF must come from conda-forge, so create a conda env with it first):
conda create -n hycom-env -c conda-forge xesmf
conda activate hycom-env
pip install xhycomFrom GitHub (latest unreleased, clone and install in editable mode):
git clone https://github.com/nansencenter/xhycom.git
cd xhycom
conda env create -f ci/environment-regrid.yml
conda activate hycom-analysis-envSee Installation for details, including setup on the Olivia and Betzy HPC clusters.
import xhycom
# Single snapshot: auto-detects file type, attaches lon/lat/time/dens
ds = xhycom.open_dataset("archv.2020_001_00", grid="regional.grid")
ds["temp"].isel(time=0, k=0).plot()
# Multi-year time series: lazy, out-of-memory, no data loaded until .compute()
ds = xhycom.open_mfdataset("data/", grid="regional.grid", chunks={"time": 1})
ds["temp"].isel(k=0).mean("time").compute()Full documentation (why xarray, worked examples, API reference) is at https://xhycom.readthedocs.io.