IMAS-Validator is a tool to validate IMAS IDS's through the use of general and case-specific validation rules.
Installation guide readthedocs
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 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
@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