Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 1.83 KB

File metadata and controls

58 lines (48 loc) · 1.83 KB

README

IMAS-Validator is a tool to validate IMAS IDS's through the use of general and case-specific validation rules.

Installation

Installation guide readthedocs

CLI

After installation process is completed one can run CLI application by executing imas_validator command in bash console

See imas_validator -h for more information

The validate command exits with status 0 when every URI passes validation and status 1 when any URI fails. Invalid command-line arguments exit with status 2. Reports are generated before the validation status is returned.

Documentation

Documentation is autogenerated from the source using Sphinx and can be found at the readthedocs

The documentation can be manually generated by installing sphinx and running:

make -C docs html

Examples

@validator("*")
def validate_ids_plugins_metadata(ids):
  """Validate mandatory attributes in the ids_properties.plugins."""
  plugins = ids.ids_properties.plugins
  for node in plugins.node:
    assert node.path != ""
    for name in node.put_operation:
      assert name != ""
  # etc.

@validator("gyrokinetics_local")
def validate_gyrokinetics_electron_definition(gk):
  """Validate that there is an electron species in the species AoS."""
  for species in gk.species:
    if species.charge_norm != -1:
      continue
    assert species.mass_norm == 2.724437108e-4
    assert species.temperature_norm == 1.0
    assert species.density_norm == 1.0
    break
  else:
    assert False, "No electron species found"

@validator("core_profiles")
def validate_ion_charge(cp):
  """Validate that profiles_1d/ion/z_ion is defined."""
  for p1d in cp.profiles_1d:
    for ion in p1d.ion:
      assert ion.z_ion.has_value