def pint_multiply(da, q, out_units=None):
    """Multiply xarray.DataArray by pint.Quantity.

    Parameters
    ----------
    da : xr.DataArray
      Input array.
    q : pint.Quantity
      Multiplicating factor.
    out_units : str
      Units the output array should be converted into.
    """
    a = 1 * units2pint(da)
    f = a * q.to_base_units()
    if out_units:
        f = f.to(out_units)
    out = da * f.magnitude
    out.attrs['units'] = pint2cfunits(f.units)
    return out
def pint_multiply ( da , q , out_units = None ) : a = 1 * units2pint ( da ) f = a * q . to_base_units ( ) if out_units : f = f . to ( out_units ) out = da * f . magnitude out . attrs [ 'units' ] = pint2cfunits ( f . units ) return out
Multiply xarray.DataArray by pint.Quantity.

    Parameters
    ----------
    da : xr.DataArray
      Input array.
    q : pint.Quantity
      Multiplicating factor.
    out_units : str
      Units the output array should be converted into.