Valid Global Attributes#

The ncattvalid application validates NetCDF global attributes against ESGVOC controlled vocabularies and project specifications.

It can validate:

  • a single attribute/value pair

  • a full NetCDF header

This helps ensure that NetCDF files comply with CMIP metadata conventions and ESGVOC project specifications.

One Attribute#

esgvoc ncattvalid cmip6 activity_id CMIP
esgvoc ncattvalid cmip6 experiment_id historical
../_images/CLI_Valid_attr_one.png

Note

This mode validates a single NetCDF global attribute value against the project’s controlled vocabulary.

Validate a Full NetCDF Header#

Validate from stdin:

ncdump -h file.nc | esgvoc ncattvalid cmip6

Validate from a file:

esgvoc ncattvalid cmip6 --file header.txt

Verbose mode:

esgvoc ncattvalid cmip6 --file header.txt --verbose
../_images/CLI_Valid_attr_header.png

Note

The input must be the output of:

ncdump -h file.nc

and contain a // global attributes: section to be parsed.

Validation Report#

The validation report may contain:

  • ✅ valid attributes

  • ❌ invalid attributes

  • ❓ missing required attributes

  • ➕ extra attributes not defined in the project specification

Example output:

───────────────── Validation failed ─────────────────

File: test.nc
Project: cmip6

╭─ Invalid attributes ──────────────────────────────╮
│ ❌ activity_id='WRONG'                            │
│    'WRONG' not found in collection 'activity_id'  │
╰───────────────────────────────────────────────────╯

╭─ Missing required attributes ─────────────────────╮
│ ❓ experiment_id                                  │
╰───────────────────────────────────────────────────╯

Error Handling#

Invalid or incomplete ncdump input raises an error.

Possible errors include:

  • missing // global attributes: section

  • malformed attribute definitions

  • unknown NetCDF attributes

  • invalid controlled vocabulary values