def __init__(self):
        super(ACDD1_3Check, self).__init__()
        self.high_rec_atts.extend([("Conventions", self.verify_convention_version)])

        self.rec_atts.extend(
            [
                "geospatial_vertical_positive",
                "geospatial_bounds_crs",
                "geospatial_bounds_vertical_crs",
                "publisher_name",  # publisher,dataCenter
                "publisher_url",  # publisher
                "publisher_email",  # publisher
                "source",
            ]
        )

        self.sug_atts.extend(
            [
                ("creator_type", ["person", "group", "institution", "position"]),
                "creator_institution",
                "platform",
                "platform_vocabulary",
                "keywords_vocabulary",
                "instrument",
                "metadata_link",
                "product_version",
                "references",
                ("publisher_type", ["person", "group", "institution", "position"]),
                "instrument_vocabulary",
                "date_metadata_modified",
                "program",
                "publisher_institution",
            ]
        )

        # override the ISO date checks in
        def _check_attr_is_iso_date(attr, ds):
            result_name = "{}_is_iso".format(attr)
            if not hasattr(ds, attr):
                return ratable_result(
                    (0, 2), result_name, ["Attr {} is not present".format(attr)]
                )
            else:
                iso_check, msgs = datetime_is_iso(getattr(ds, attr))
                return ratable_result((1 + iso_check, 2), result_name, msgs)

        # run ISO 8601 date checks against the date_created, date_issued,
        # date_modified, and date_metadata_modified global attributes
        self.rec_atts = kvp_convert(self.rec_atts)
        self.rec_atts["date_created"] = partial(_check_attr_is_iso_date, "date_created")
        self.sug_atts = kvp_convert(self.sug_atts)
        for k in (
            "date_{}".format(suffix)
            for suffix in ("issued", "modified", "metadata_modified")
        ):

            self.sug_atts[k] = partial(_check_attr_is_iso_date, k)
示例#2
0
    def __init__(self):
        super(ACDD1_3Check, self).__init__()
        self.high_rec_atts.extend([('Conventions',
                                    self.verify_convention_version)])

        self.rec_atts.extend([
            'geospatial_vertical_positive',
            'geospatial_bounds_crs',
            'geospatial_bounds_vertical_crs',
            'publisher_name',  # publisher,dataCenter
            'publisher_url',  # publisher
            'publisher_email',  # publisher
            'source'
        ])

        self.sug_atts.extend([
            ('creator_type', ['person', 'group', 'institution', 'position']),
            'creator_institution',
            'platform',
            'platform_vocabulary',
            'keywords_vocabulary',
            'instrument',
            'metadata_link',
            'product_version',
            'references',
            ('publisher_type', ['person', 'group', 'institution', 'position']),
            'instrument_vocabulary',
            'date_metadata_modified',
            'program',
            'publisher_institution',
        ])

        # overrride the ISO date checks in
        def _check_attr_is_iso_date(attr, ds):
            result_name = "{}_is_iso".format(attr)
            if not hasattr(ds, attr):
                return ratable_result((0, 2), result_name,
                                      ["Attr {} is not present".format(attr)])
            else:
                iso_check, msgs = datetime_is_iso(getattr(ds, attr))
                return ratable_result((1 + iso_check, 2), result_name, msgs)

        # run ISO 8601 date checks against the date_created, date_issued,
        # date_modified, and date_metadata_modified global attributes
        self.rec_atts = kvp_convert(self.rec_atts)
        self.rec_atts['date_created'] = partial(_check_attr_is_iso_date,
                                                'date_created')
        self.sug_atts = kvp_convert(self.sug_atts)
        for k in ("date_{}".format(suffix)
                  for suffix in ('issued', 'modified', 'metadata_modified')):

            self.sug_atts[k] = partial(_check_attr_is_iso_date, k)
示例#3
0
        def _dec(s, ds):
            attr_process = kvp_convert(func(s, ds))

            ret_val = []
            # could potentially run tests in parallel if we eliminated side
            # effects on `ret_val`
            for kvp in attr_process.items():
                # function mutates ret_val
                attr_check(kvp, ds, priority, ret_val, gname)
            return ret_val
示例#4
0
        def _dec(s, ds):
            attr_process = kvp_convert(func(s, ds))

            ret_val = []
            # could potentially run tests in parallel if we eliminated side
            # effects on `ret_val`
            for kvp in attr_process.items():
                # function mutates ret_val
                attr_check(kvp, ds, priority, ret_val, gname)
            return ret_val
示例#5
0
    def __init__(self):
        super(ACDD1_3Check, self).__init__()
        self.high_rec_atts.extend([
            ('Conventions', self.verify_convention_version)
        ])

        self.rec_atts.extend([
                              'geospatial_vertical_positive',
                              'geospatial_bounds_crs',
                              'geospatial_bounds_vertical_crs',
                              'publisher_name',       # publisher,dataCenter
                              'publisher_url',        # publisher
                              'publisher_email',      # publisher
                              'source'])

        self.sug_atts.extend([
            ('creator_type', [
                'person',
                'group',
                'institution',
                'position'
            ]),
            'creator_institution',
            'platform',
            'platform_vocabulary',
            'keywords_vocabulary',
            'instrument',
            'metadata_link',
            'product_version',
            'references',
            ('publisher_type', [
                'person',
                'group',
                'institution',
                'position'
            ]),
            'instrument_vocabulary',
            'date_metadata_modified',
            'program',
            'publisher_institution',
        ])

        # overrride the ISO date checks in
        def _check_attr_is_iso_date(attr, ds):
            result_name = "{}_is_iso".format(attr)
            if not hasattr(ds, attr):
                return ratable_result((0,2), result_name,
                                      ["Attr {} is not present".format(attr)])
            else:
                iso_check, msgs = datetime_is_iso(getattr(ds, attr))
                return ratable_result((1 + iso_check, 2),
                                      result_name, msgs)

        # run ISO 8601 date checks against the date_created, date_issued,
        # date_modified, and date_metadata_modified global attributes
        self.rec_atts = kvp_convert(self.rec_atts)
        self.rec_atts['date_created'] = partial(_check_attr_is_iso_date,
                                                'date_created')
        self.sug_atts = kvp_convert(self.sug_atts)
        for k in ("date_{}".format(suffix) for suffix in
                  ('issued', 'modified', 'metadata_modified')):

            self.sug_atts[k] = partial(_check_attr_is_iso_date, k)