def _setup_units(self, connections, params_dict, unknowns_dict):
        """
        Calculate unit conversion factors for any connected
        variables having different units and store them in params_dict.

        Args
        ----
        connections : dict
            A dict of target variables (absolute name) mapped
            to the absolute name of their source variable and the
            relevant indices of that source if applicable.

        params_dict : OrderedDict
            A dict of parameter metadata for the whole `Problem`.

        unknowns_dict : OrderedDict
            A dict of unknowns metadata for the whole `Problem`.
        """
        to_prom_name = self.root._sysdata.to_prom_name

        for target, (source, idxs) in iteritems(connections):
            tmeta = params_dict[target]
            smeta = unknowns_dict[source]

            # units must be in both src and target to have a conversion
            if 'units' not in tmeta or smeta not in 'units':
                continue

            src_unit = smeta['units']
            tgt_unit = tmeta['units']

            try:
                scale, offset = get_conversion_tuple(src_unit, tgt_unit)
            except TypeError as err:
                if str(err) == "Incompatible units":
                    msg = "Unit '{0}' in source {1} "\
                        "is incompatible with unit '{2}' "\
                        "in target {3}.".format(src_unit,
                                                  _both_names(smeta, to_prom_name),
                                                  tgt_unit,
                                                  _both_names(tmeta, to_prom_name))
                    self._setup_errors.append(msg)
                    continue
                else:
                    raise

            # If units are not equivalent, store unit conversion tuple
            # in the parameter metadata
            if scale != 1.0 or offset != 0.0:
                tmeta['unit_conv'] = (scale, offset)
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/core/problem.py/Problem._setup_units/swapped operands of `not in`