Python API Guide¶
Importing nc_check registers a dataset accessor at ds.check.
Main Methods¶
ds.check.compliance(...)¶
Run convention checks (cf, ferret, or both).
Common options:
conventions:"cf,ferret"(default),"cf", or"ferret"engine:"auto"(default),"cfchecker","heuristic"fallback_to_heuristic:Trueby defaultdomain: optional standard-name suggestion domain (ocean,atmosphere,land,cryosphere,biogeochemistry)report_format:auto,python,tables,htmlreport_html_file: path, only valid withreport_format="html"
Returns:
dictforpythonstrforhtmlNonefortables
ds.check.make_cf_compliant()¶
Returns a copied dataset with safe metadata fixes. The original dataset is unchanged.
Key updates:
- sets
Conventions = "CF-1.12" - normalizes key CF attribute names to expected lowercase forms
- fills inferred axis coordinate metadata
- creates missing inferred axis coordinates when needed
- sets extent attrs when possible:
time_coverage_starttime_coverage_endgeospatial_lat_mingeospatial_lat_maxgeospatial_lon_mingeospatial_lon_max- removes coordinate
_FillValuefrom attrs/encoding
ds.check.ocean_cover(...)¶
Ocean-grid sanity checks for one variable or all eligible variables.
Common options:
var_name: optional variable namelon_name,lat_name: optional coordinate names (auto-inferred if omitted)time_name: preferred time dim name (defaulttime)check_edge_of_map: detect persistent missing longitude bandscheck_land_ocean_offset: reference-point land/ocean alignment testreport_format,report_html_file
ds.check.time_cover(...)¶
Time slice missing-data coverage checks.
Common options:
var_name: optional variable nametime_name: preferred time dim name (defaulttime)report_format,report_html_file
ds.check.all(...)¶
Runs selected checks and returns one combined report.
Check toggles:
compliance=Trueocean_cover=Truetime_cover=True
Forwards method-specific options to each check family and produces:
check_summary- per-check reports
- overall status fields (
overall_status,overall_ok)