ensure_unit¶
-
gunagala.utils.
ensure_unit
(arg, unit)[source]¶ Ensures that the argument has the requested units, performing conversions as necessary.
Parameters: - arg : astropy.units.Quantity or compatible
Argument to be coerced into the requested units. Can be an
astropy.units.Quantity
instance or any numeric type or sequence that is compatible with theQuantity
constructor (e.g. anumpy.array
,list
offloat
, etc.).- unit : astropy.units.Unit
Requested units.
Returns: - arg : astropy.units.Quantity
arg
as anastropy.units.Quantity
with units ofunit
.