utdf2gmns.util_lib.time_unit_converter

utdf2gmns.util_lib.time_unit_converter(value: float, from_unit: str, to_unit: str, verbose: bool = True) float[source]

Convert a time value between seconds, minutes, hours, days, years

Parameters:
  • value (float) – The numerical value to convert.

  • from_unit (str) – The unit of the input value.

  • to_unit (str) – The desired output unit.

Example

>>> from pyufunc import time_unit_converter
>>> time_unit_converter(1, "hours", "minutes")
60.0
Returns:

The converted value in the target unit.

Return type:

float

Raises:

ValueError – If an invalid unit is provided.