fix: correct units for unit vector and direction elements (dimensionless, not metres)#242
Open
Simon-McIntosh wants to merge 2 commits into
Open
Conversation
Unit vectors, direction vectors, and orientation vectors are dimensionless direction cosines with magnitude 1. They were incorrectly inheriting units='m' from shared position templates. Solution: Create new dimensionless variants of the xyz0D templates (xyz0d_static_dimensionless, xyz0d_dynamic_aos3_dimensionless, xyz0d_constant_dimensionless) with units='1' and update all 37 unit_vector/direction/up/injection_direction element references across 7 schema files. Affected elements (37 refs across 7 files): - x1/x2/x3_unit_vector in compound templates (18 refs in dd_support) - direction, direction_second, up (camera_ir, operational_instrumentation) - unit_vector_major, unit_vector_minor, direction, injection_direction (spi) - direction (ec_launchers) - x1/x2/x3_unit_vector (spectrometer_uv, spectrometer_x_ray_crystal) Position elements (pinhole, target_surface_center, attachement_points) correctly remain on the original meters-based templates.
…imensionless template The xyz0d_dynamic_aos3_dimensionless template was missing the <aos3Parent>yes</aos3Parent> annotation and used <type>dynamic_aos3</type> instead of <type>dynamic</type>. This caused DD validation to fail with 'all leaves below an AoS3 must be dynamic' for reflectometer_fluctuation antennas_orientation paths.
SimonPinches
approved these changes
May 6, 2026
simpla-fusion
approved these changes
May 6, 2026
imbeauf
approved these changes
May 6, 2026
DavidPCoster
approved these changes
May 6, 2026
medvedevsyu
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Unit vectors, direction vectors, and orientation vectors in the Data Dictionary are currently tagged with
units="m"(metres). These elements represent dimensionless direction cosines with magnitude 1 — they are not spatial coordinates.The root cause is that unit vector elements (
x1_unit_vector,direction,up,injection_direction, etc.) reference the samexyz0d_static/xyz0d_dynamic_aos3/xyz0d_constanttemplates as genuine position elements (pinhole,target_surface_center). These templates hardcode<units>m</units>, which is correct for positions but incorrect for direction cosines.Impact: 1335 data paths across ~20 IDSs carry incorrect unit metadata. Any code that relies on DD units for unit conversion, dimensional analysis, or IMAS Standard Name generation will produce incorrect results for these quantities.
Solution
Create three new dimensionless template variants in
dd_support.xsd:xyz0d_static_dimensionless(units="1")xyz0d_dynamic_aos3_dimensionless(units="1")xyz0d_constant_dimensionless(units="1")These are identical to the original templates except for the unit declaration. All unit vector and direction element references (37 total across 7 files) are updated to use the new templates. Position elements (
pinhole,target_surface_center,attachement_points) correctly remain on the original metres-based templates.Changes
dd_support.xsddd_camera_ir.xsddd_ec_launchers.xsddd_operational_instrumentation.xsddd_spectrometer_uv.xsddd_spectrometer_x_ray_crystal.xsddd_spi.xsdVerification
Confirmed via static XSD analysis that:
units="m"<units>1</units>(542 existing uses across the DD)imas-pythonIDSFactory output confirming the source bug is in the XSD, not downstream tooling📚 Documentation preview 📚: https://imas-data-dictionary--242.org.readthedocs.build/en/242/