Skip to content

nansencenter/xhycom

Repository files navigation

xhycom

Run Tests codecov Documentation Status

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.

Installation

conda (recommended, includes xESMF for horizontal regridding):

conda install -c conda-forge xhycom

pip (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 xhycom

From 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-env

See Installation for details, including setup on the Olivia and Betzy HPC clusters.

Quick example

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()

Documentation

Full documentation (why xarray, worked examples, API reference) is at https://xhycom.readthedocs.io.

About

Reads HYCOM model output in the native `.a.b` binary format directly into xarray Datasets

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors