Units of Measure

From The SBN Wiki
Jump to navigation Jump to search

Units of measure come up in two difference contexts in the PDS4 archive: As the value of the <unit> attribute in a table field or array element description; and as qualifiers for label meta-data values.

Values of <unit> Attributes

When specifying units for data objects, as in fields of tables or elements of arrays, you should use SI units unless there is a compelling reason to use a unit better known to the community. In forming units of measure, follow these guidelines from the PDS4 Standards Reference:

  • Use standard SI abbreviations for units for everything that can be expressed in ASCII characters (the "micro-" prefix is the common exception; do not use an ASCII 'u' character as an abbreviation for "micro-").
  • Use "*" to explicitly indicate multiplication.
  • Use "/" to indicate division.
  • Use "**" to indicate exponentiation.
  • Avoid negative exponents as far as possible.
  • Limit use of parentheses to one pair for the numerator and one pair for the denominator if possible.

Note: As of this writing, the actual value of <unit> attributes is not validated by schemas or software. If you have questions about the appropriate use of units for data fields, please contact your SBN consultant sooner rather than later.

Finally, note that the <unit> attribute is always optional. If the quantity you are describing is unitless, then omit the <unit> attribute. Never use <unit>N/A</unit> or <unit>None</unit> in PDS4 labels.

Units of Label Attributes

When a label attribute has a unit (as field lengths and object offsets do, for example), you will always be required to specify it. This is done using an XML attribute in the tag. For example, the location of the start of a data is specified using the offset attribute with a unit of bytes:

<offset unit="byte">2880</offset>

The value of the unit= XML attribute come from a standard value list contained in the PDS4 master schema.

The Underlying Design

The PDS4 master schema defines classes of units with names like Units_of_Length and Units_of_Angle. These classes contain fairly short lists of standard units, any of which can be used as the value of the unit= XML attribute when that type of unit is called for. When you are defining new attributes in a mission dictionary, these unit classes are available for your use as well.

[ These unit classes enable software to perform specific scaling operations on attribute values as they are ingested into a database so that, for example, a web search can support searching on wavelength even when some labels give wavelength in angstroms while others use nanometers. ]

Unit values

In general, unit values are specified using the standard abbreviations where those abbreviations can be expressed using only ASCII characters. The notable exception is anything beginning with the "micro-" prefix. Do not use an ASCII 'u' character to indicate "micro-" - spell it out.

The standard value lists for the PDS4 unit classes are defined on the Unit Classes Standard Values page, for ready reference.