nexusformat / definitions

Definitions of the NeXus Standard File Structure and Contents
https://manual.nexusformat.org/
Other
26 stars 55 forks source link

Proposal: Adopt unitsSI from openPMD #1325

Open benajamin opened 8 months ago

benajamin commented 8 months ago

openPMD describes a unit by a list of exponents describing the magnitude of the possible dimensions: length L, mass M, time T, electric current I, thermodynamic temperature theta, amount of substance N, luminous intensity J. There was a request from the recent HELPMI workshop that the HELPMI community be able to describe units in the openPMD format.

Currently, NeXus expects an NX_CHAR string in the @units attribute, which is apparently not being validated. Allowing the openPMD way of describing units could be as simple as allowing the content of @units to be either an NX_CHAR string (for the current NeXus way), or an array of 7 signed floats (for the openPMD style). I expect that open PMD chose to allow floats instead of just integers so that strange units could be accommodated (e.g. imperial measures, or relativistic units based on c). Validation of the openPMD style units would be fairly simple since you could just check that the array values have the correct pattern of zero or non-zero values.

Do others in the community like this idea? Is there a better way to implement it in NeXus?

benajamin commented 7 months ago

One issue with this system is that it doesn't specify the power of the dimension, i.e. meters of length and cubic meters of volume are not differentiated. Being able to specify the dimension power would help to differentiate similar measures, such as the flux measurements described in NXmx. Specifying this would require an extra set of numbers.

phyy-nx commented 6 months ago

Comments from Telco Jan 17 2024:

What could we take from these ideas to make units easier in NeXus?