# 3.2.1.2. NXDL: Data Types and Units¶

## Data Types allowed in NXDL specifications¶

Data types for use in NXDL describe the expected type of data for a NeXus field. These terms are very broad. More specific terms are used in actual NeXus data files that describe size and array dimensions. In addition to the types in the following table, the NAPI type is defined when one wishes to permit a field with any of these data types.

ISO8601: ISO8601 date/time stamp
NX_BINARY: any representation of binary data - if text, line terminator is [CR][LF]
NX_BOOLEAN: true/false value ( true | 1 | false | 0 )
NX_CHAR: any string representation All strings are to be encoded in UTF-8. Includes fixed-length strings, variable-length strings, and string arrays. Some file writers write strings as a string array of rank 1 and length 1. Clients should be prepared to handle such strings.
NX_DATE_TIME: alias for the ISO8601 date/time stamp
NX_FLOAT: any representation of a floating point number
NX_INT: any representation of an integer number
NX_NUMBER: any valid NeXus number representation
NX_POSINT: any representation of a positive integer number (greater than zero)
NX_UINT: any representation of an unsigned integer number (includes zero)

## Unit Categories allowed in NXDL specifications¶

Unit categories in NXDL specifications describe the expected type of units for a NeXus field. They should describe valid units consistent with the NeXus units section. The values for unit categories are restricted (by an enumeration) to the following table.

NX_ANGLE: units of angle, example: m
NX_ANY: units for things like logs that aren’t picky on units
NX_AREA: units of area, example: m2 or barns
NX_CHARGE: units of electrical charge, example: c
NX_CROSS_SECTION:
units of area, example: barns (alias of NX_AREA)
NX_CURRENT: units of electrical current, example: A
NX_DIMENSIONLESS:
units for fields where the units cancel out, example: “” or mm/mm (NOTE: not the same as NX_UNITLESS)
NX_EMITTANCE: units of emittance (length * angle) of a radiation source, example: nm*rad
NX_ENERGY: units of energy, example: J or keV
NX_FLUX: units of flux, example: s-1 cm-2
NX_FREQUENCY: units of frequency, example: Hz
NX_LENGTH: units of length, example: m
NX_MASS: units of length, example: g
NX_MASS_DENSITY:
units of mass density, example: g cm-3
NX_MOLECULAR_WEIGHT:
units of molecular weight, example: g mol-1
NX_PERIOD: units of time, period of pulsed source, example: microseconds (alias to NX_TIME)
NX_PER_AREA: units of length, example: m
NX_PER_LENGTH: units of length, example: m
NX_POWER: units of power, example: W
NX_PRESSURE: units of pressure, example: Pa
NX_PULSES: units of clock pulses (alias to NX_NUMBER)
NX_SCATTERING_LENGTH_DENSITY:
units of scattering length density, example: cm-2
NX_SOLID_ANGLE: units of solid angle, example: sr | steradian
NX_TEMPERATURE: units of temperature, example: K
NX_TIME: units of time, example: s
NX_TIME_OF_FLIGHT:
units of (neutron) time of flight, example: s (alias to NX_TIME)
NX_TRANSFORMATION:

units of the specified transformation

could be any of these: NX_LENGTH, NX_ANGLE, or NX_UNITLESS

There will be one or more transformations defined by one or more fields for each transformation. The units type NX_TRANSFORMATION designates the particular axis generating a transformation (e.g. a rotation axis or a translation axis or a general axis). NX_TRANSFORMATION designates the units will be appropriate to the type of transformation, indicated in the NXtransformations base class by the transformation_type value:

• NX_LENGTH for translation
• NX_ANGLE for rotation
• NX_UNITLESS for axes for which no transformation type is specified.
NX_UNITLESS: for fields that don’t have a unit (e.g. hkl) so that they don’t inherit the wrong units (NOTE: not the same as NX_DIMENSIONLESS)
NX_VOLTAGE: units of voltage, example: V
NX_VOLUME: units of volume, example: m3
NX_WAVELENGTH: units of wavelength, example: angstrom
NX_WAVENUMBER: units of wavenumber or Q, example: angstrom-1 or nm-1