Commit 78827afd authored by Mario's avatar Mario
Browse files

possible groups are now senseable with key:description

parent 14da2d3c
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ except ImportError:
    pass

SEMVER_MCPARAMETER_CURRENT = VersionInfo(major=1, minor=0)
SEMVER_MCPARAMETER_Collection_CURRENT = VersionInfo(major=1, minor=0)
SEMVER_MCPARAMETER_Collection_CURRENT = VersionInfo(major=1, minor=0, patch=1)


class McParameter(object):
@@ -640,7 +640,11 @@ class McParameterCollection(object):
                    f"{__McParameterCollection__:1.1f}.0"
                )  # if it is a number only MAJOR.MINOR is used

        if __McParameterCollection__ != SEMVER_MCPARAMETER_Collection_CURRENT:
        if __McParameterCollection__ == VersionInfo(major=1, minor=0):
            # trun around possible groups..
            if possible_groups is not None:
                possible_groups = dict([(key, item) for item, key in possible_groups.items()])
        elif __McParameterCollection__ != SEMVER_MCPARAMETER_Collection_CURRENT:
            raise NotImplementedError(
                "DMT->McParameterCollection: Unknown version of collection to create!"
            )
@@ -1256,15 +1260,16 @@ class McParameterCollection(object):

                        group = para.group
                        try:
                            group_desc = next(
                                description
                                for description, group_a in self.possible_groups.items()
                                if group_a == group
                            )
                            # group_desc = next(
                            #     description
                            #     for description, group_a in self.possible_groups.items()
                            #     if group_a == group
                            # )
                            group_desc = self.possible_groups[group]
                            data_table.add_row(
                                (MultiColumn(2, align="l", data=group_desc),), strict=False
                            )
                        except StopIteration:
                        except KeyError:
                            pass

                    if para.unit.dimensionless:
+1 −3
Original line number Diff line number Diff line
@@ -60,9 +60,7 @@ class McSkywater(MCard):
        **kwargs,
    ):
        if possible_groups is None:
            possible_groups = {
                "Geometrie": "geo",
            }
            possible_groups = {"geo": "Geometrie"}

        super().__init__(
            nodes_list,
+7 −0
Original line number Diff line number Diff line
@@ -339,6 +339,13 @@ class MCard(McParameterCollection):

                para.unit = unit_converter[para_properties.unit]  # type: ignore
                para.description = para_properties.description  # type: ignore

                if para_properties.group not in self.possible_groups:
                    warnings.warn(
                        f"DMT->MCard: The parameter group {para_properties.group} is not part of this modelcards possible groups.",
                        category=RuntimeWarning,
                    )

                para.group = para_properties.group  # type: ignore
            except KeyError:
                para = McParameter(