Skip to content

fix: correct units for unit vector and direction elements (dimensionless, not metres)#242

Open
Simon-McIntosh wants to merge 2 commits into
iterorganization:developfrom
Simon-McIntosh:feature/unit_vector_dimensions
Open

fix: correct units for unit vector and direction elements (dimensionless, not metres)#242
Simon-McIntosh wants to merge 2 commits into
iterorganization:developfrom
Simon-McIntosh:feature/unit_vector_dimensions

Conversation

@Simon-McIntosh
Copy link
Copy Markdown
Contributor

@Simon-McIntosh Simon-McIntosh commented May 6, 2026

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 same xyz0d_static / xyz0d_dynamic_aos3 / xyz0d_constant templates 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

File Elements Updated Count
dd_support.xsd New templates + compound templates (filter_window, detector_aperture, curved_object, polarizer, camera_geometry, flat_object_orientation_aos3) 18 refs + 3 templates
dd_camera_ir.xsd direction, up 2
dd_ec_launchers.xsd direction 1
dd_operational_instrumentation.xsd x1/x2/x3_unit_vector, direction, direction_second 5
dd_spectrometer_uv.xsd x1/x2/x3_unit_vector (×2 contexts) 4
dd_spectrometer_x_ray_crystal.xsd x1/x2/x3_unit_vector 3
dd_spi.xsd unit_vector_major, unit_vector_minor, direction, injection_direction 4
Total 37 refs

Verification

Confirmed via static XSD analysis that:

  • Zero unit_vector or direction elements remain on the old metres-based templates
  • Only 3 genuine position elements (pinhole, target_surface_center, attachement_points) retain units="m"
  • All direction element documentation strings confirm dimensionless semantics ("unit vector", "direction unit vector")
  • Dimensionless unit follows the DD convention: <units>1</units> (542 existing uses across the DD)
  • Cross-checked against imas-python IDSFactory output confirming the source bug is in the XSD, not downstream tooling

📚 Documentation preview 📚: https://imas-data-dictionary--242.org.readthedocs.build/en/242/

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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

…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.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

@SimonPinches SimonPinches requested review from imbeauf and olivhoenen May 6, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants