spectrochempy.is_units_compatible

is_units_compatible(other)[source]

Check the compatibility of units with another object.

Parameters

other (|ndarray|) – The ndarray object for which we want to compare units compatibility.

Returns

result – True if units are compatible.

Examples

>>> nd1 = scp.NDDataset([1. + 2.j, 2. + 3.j], units='meters')
>>> nd1
NDDataset: [complex128] m (size: 2)
>>> nd2 = scp.NDDataset([1. + 2.j, 2. + 3.j], units='seconds')
>>> nd1.is_units_compatible(nd2)
False
>>> nd1.ito('minutes', force=True)
>>> nd1.is_units_compatible(nd2)
True
>>> nd2[0].values * 60. == nd1[0].values
True