# units pack 8 nodes, in `noodlelab` and above. ## Units (node-units.constant)= ### Constant `units.constant` A named constant: π, the speed of light, standard gravity... with its unit, and with its CODATA uncertainty when it was measured rather than defined. Exact constants without a unit are plain numbers; use unit '1' to feed one into Quantity Math. One node can feed many others: two nodes naming the same measured constant are sampled independently by Monte Carlo. Symbolic Values take constants by name too (a line 'g = g0'). **Inputs** | Name | Type | Description | |---|---|---| | `name` | `str` | A built-in constant, one from the workspace's constants.toml, or one of the graph's own (Constants panel) Default `'pi'`. | | `unit` | `str` | Express it in this unit; empty: as defined. '1' makes a plain number such as π a dimensionless quantity, for Quantity Math Default `''`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Any` | | (node-units.convert_units)= ### Convert Units `units.convert_units` Express a quantity in another unit of the same dimension. Links do this by themselves; use the node to choose the unit a result is shown in. **Inputs** | Name | Type | Description | |---|---|---| | `quantity` | `Quantity` | | | `unit` | `str` | Default `'m'`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Quantity` | | (node-units.magnitude)= ### Magnitude `units.magnitude` The number without its unit, in ``unit`` (empty: the quantity's own). For array quantities, use Magnitude (Array). **Inputs** | Name | Type | Description | |---|---|---| | `quantity` | `Quantity` | | | `unit` | `str` | Default `''`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `float` | | (node-units.magnitude_array)= ### Magnitude (Array) `units.magnitude_array` The numbers of an array quantity without the unit, in ``unit`` (empty: the quantity's own): floats, or complex numbers when the quantity holds them. **Inputs** | Name | Type | Description | |---|---|---| | `quantity` | `Quantity` | | | `unit` | `str` | Default `''`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `NDArray` | | (node-units.make_quantity)= ### Make Quantity `units.make_quantity` Attach a unit to a plain number. **Inputs** | Name | Type | Description | |---|---|---| | `value` | `float` | | | `unit` | `str` | Default `'m'`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Quantity` | | (node-units.make_quantity_array)= ### Make Quantity (Array) `units.make_quantity_array` Attach a unit to an array of numbers, such as a table column. **Inputs** | Name | Type | Description | |---|---|---| | `values` | `NDArray[floating]` | | | `unit` | `str` | Default `'m'`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Quantity` | | (node-units.quantity)= ### Quantity `units.quantity` A constant with a unit, typed as text: 9.81 m/s^2, 3 km, 25 degC. **Inputs** | Name | Type | Description | |---|---|---| | `value` | `Quantity` | Default `'1.0 m'`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Quantity` | | (node-units.quantity_math)= ### Quantity Math `units.quantity_math` Arithmetic on quantities. Add, subtract, minimum, maximum and modulo need the same dimension; the result is in the first input's unit. A temperature plus or minus a difference (delta_degC) is a temperature, and one temperature minus another is a difference. Power raises A to B and root takes the B-th root of A: B is a plain number, and must be exact when A has a unit, because the result's unit depends on it. Sqrt, absolute and negate ignore B. **Inputs** | Name | Type | Description | |---|---|---| | `a` | `Quantity` | | | `b` | `Quantity` | Default `'1.0'`. | | `operation` | `Literal['add', 'subtract', 'multiply', 'divide', 'power', 'root', 'minimum', 'maximum', 'modulo', 'sqrt', 'absolute', 'negate']` | Default `'multiply'`. | **Outputs** | Name | Type | Description | |---|---|---| | `result` | `Quantity` | |