Version: dev

parse_unit_conversion

Stable function · Units

Tier: stable · Kind: function · Topic: Units

JuliaTypeScriptPythonRustGo
parse_unit_conversionnot exportedparse_unit_conversionnot exportednot exported

Julia

parse_unit_conversion(raw; variable_name)
parse_unit_conversion(raw; variable_name) -> Nothing | Float64 | ASTExpr

Parse a loader variable’s RAW unit_conversion (number | Expression).

nothing (the field is absent, or null) means the variable declares no conversion — so a document that declares none costs nothing and behaves exactly as it did before this existed.

Source

TypeScript

TypeScript does not export this function.

Python

parse_unit_conversion(raw: Any, *, variable_name: str) -> float | ExprNode | None

Parse a loader variable’s RAW unit_conversion (esm-spec §8.5).

The JSON spelling is ONE Expression, which admits all three forms: a plain multiplicative factor, a bare reference string, or a full Expression AST for a conversion that is not a pure scale — an affine one like °F→K, which §4.8.1 keeps OUT of the dimensional metadata on purpose (“a unit conversion that needs the offset is a unit_conversion expression, not a dimensional judgement”).

Returns None when the variable declares none, so a document that declares no conversion costs nothing and behaves exactly as before. This is the raw-document entry point the provider paths use; the typed parse (earthsci_ast.parse) produces the same two shapes.

Source

Rust

Rust does not export this function.

Go

Go does not export this function.