ecl-logo Documentation

Units

Units[q]unitQuantity

returns a Quantity object containing the Units of the given quantity q.

Units[qa,levelSpec]unitSpec

returns a unit specification describing the units in the QuantityArray qa.

Details

    Input
    Output
    Messages
  • InconsistentUnitsUnits are not consistent above level `1`.
    InvalidLevelLevel `1` is deeper than the dimensions of the array.

Examples

Basic Examples  (3)

Extracts the unit from a value:

Works with compound Units:

Find units of a QuantityArray:

Additional Examples  (7)

Numeric values have dimensionless Units:

Works with non-numeric quantities:

Maps over list of quantities:

Level zero returns unit array whose size matches the data array:

Automatic level resolution will increase the level if units are not consistent at usual default value:

Extract the untis from a quantity distribution:

Extract the units from a multi-variate quantity distribution:

Messages  (2)

InconsistentUnits  (1)

Cannot return units at level 2 because units at level 1 are not all the same:

InvalidLevel  (1)

Cannot specify a level that is deeper than the dimensions of the array:

Possible Issues  (4)

Physical Constants  (4)

Physical constants are represented behind the scences as 1*PhysicalConstant, where PhysicalConstant is the unit:

Asking for their units will return the constant itself, as that is the unit:

They can be converted to any compatible unit:

To get a physical constant's units in some other unit (such as base SI units), you must first convert to the desired units: