8000 GitHub - iterorganization/IMAS-Validator: Python toolbox to support the validation of IDS data against generic and specific rulesets
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

iterorganization/IMAS-Validator

Repository files navigation

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

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

About

Python toolbox to support the validation of IDS data against generic and specific rulesets

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

Languages

0