xarray units check: check unit compatibility instead of units itself
When pushing data to outputs, the associated units need to match the output specifications at the moment.
In my opinion it would be better to add options convert_units
and only_check_units_compatibility
(both false by default) to data.check
to convert compatible units in-place and to call this routine with check(...,only_check_units_compatibility=True, convert_units=True)
in data.to_xarray
in order to get the desired units. This would then also solve the problem in Output.push_data
pint provides a routine Unit.is_compatible_with
to check if two units are compatible (link).
Maybe we could also only check compatibility (i.e. same dimensionality) in data.check
by default, so we don't compare the units directly.