Units follow the calculation.
Multiply or divide quantities inside an xarray Dataset. Their units follow the operation, and compact_units presents the result at a useful scale.
u.compact_units(ds)Readable scales. Physical meaning intact.
ds["power"] = ds.voltage * ds.current
ds["resistance"] = ds.voltage / ds.current
ds = u.compact_units(ds)Illustrative electrical quantities. Units are attached to the input variables in the Dataset.
