Metadata-Version: 2.3
Name: nc-check
Version: 0.2.5
Summary: Prepare xarray Datasets for CF-1.12 compliant NetCDF output
Author: lukegre
Author-email: lukegre <lukegre@gmail.com>
Requires-Dist: netcdf4
Requires-Dist: numpy>=1.24
Requires-Dist: pydantic>=2.8
Requires-Dist: rich>=14.3.2
Requires-Dist: xarray>=2023.1
Requires-Dist: cfchecker ; extra == 'cf'
Requires-Dist: cfunits>=3.3.7 ; extra == 'cf'
Requires-Python: >=3.11
Provides-Extra: cf
Description-Content-Type: text/markdown

# nc-check

![nc-check banner](assets/nc-check-banner.svg)

Prepare `xarray.Dataset` objects for CF-1.12-ready NetCDF output.

## What It Does

- Validates metadata and conventions with `ds.check.compliance()`.
- Applies safe non-destructive metadata fixes with `ds.check.make_cf_compliant()`.
- Runs ocean-grid and time-slice coverage checks with `ds.check.ocean_cover()` and `ds.check.time_cover()`.
- Provides both Python and CLI workflows (`nc-check`, `nc-comply`).

## Install

```bash
uv add nc-check
# or
pip install nc-check
```

Optional full CF checker support:

```bash
uv add "nc-check[cf]"
# or
pip install "nc-check[cf]"
```

## Quickstart

```python
import xarray as xr
import nc_check  # Registers ds.check accessor

ds = xr.Dataset(
    data_vars={"temp": (("time", "lat", "lon"), [[[280.0]]])},
    coords={"time": [0], "lat": [10.0], "lon": [20.0]},
)

compliance = ds.check.compliance(report_format="python")
fixed = ds.check.make_cf_compliant()
ocean = ds.check.ocean_cover(report_format="python")
time = ds.check.time_cover(report_format="python")
full = ds.check.all(report_format="python")
```

CLI quickstart:

```bash
nc-check input.nc
nc-check all input.nc --save-report
nc-comply input.nc output.nc
```

## Docs

- [Docs home](docs/index.md)
- [Getting started](docs/getting-started.md)
- [CLI guide](docs/cli.md)
- [Python API guide](docs/python-api.md)
- [Checks and reports](docs/checks-and-reports.md)
- [Troubleshooting](docs/troubleshooting.md)
- [Development](docs/development.md)

Local docs site:

```bash
uv run --with mkdocs-material mkdocs serve
```

## Development Test Run

```bash
uv sync --group dev
uv run --group dev python -m pytest
```
