setUnits()

Signature:

set_unit(
    value: Union[pint.registry.Unit, str],
    in_place: bool = False
) -> TimeSeries

Detailed Documentation

The hec-python-library equivalent of Jython method setUnits():

If in_place=True, the instance itself is modified. In this case the returned value (which can be ignored in python) is the modified instance, which can be used in chaining methods.

Notes:

  1. The direct equivalent requires using in_place=True or iset_unit().

  2. Setting the unit does not convert the values to the specified unit. For that functionality use the to() or ito() method.

Example:

ts2 = ts1.set_unit("cfs")

Signature:

iset_unit(
    value: Union[pint.registry.Unit, str],
    in_place: bool = False
) -> TimeSeries

Convenience method for callint set_unit(...) with in_place=True.

Example:

ts1.iset_unit("cfs")