Getting Started¶
Install¶
Install optional CF checker dependencies:
First Python Run¶
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]},
)
report = ds.check.compliance(report_format="python")
print(report["counts"])
First CLI Run¶
# shorthand for: nc-check compliance input.nc
nc-check input.nc
# run all checks
nc-check all input.nc
# apply safe fixes and write a new file
nc-comply input.nc output.nc
Output Formats¶
All check methods support report_format:
auto: notebooks -> HTML, CLI -> rich tables, scripts/tests -> Python dictpython: return a dictionarytables: print rich tables to stdouthtml: return HTML string (and optionally save withreport_html_file)
Common Workflow¶
- Run
ds.check.compliance()(ornc-check compliance) to find metadata issues. - Apply safe fixes with
ds.check.make_cf_compliant()(ornc-complyfor files). - Run
ds.check.all()(ornc-check all) and save an HTML report for review.