Beispiel #1
0
    def metamap_station(self, sensor_ml):
        with app.app_context():
            # gets a metamap document of this service using wicken
            beliefs = IOOSSOSDSCheck.beliefs()
            doc = MultipleXmlDogma('sos-ds', beliefs, sensor_ml._root, namespaces=get_namespaces())

            # now make a map out of this
            # @TODO wicken should make this easier
            metamap = {}
            for k in beliefs:
                try:
                    metamap[k] = getattr(doc, doc._fixup_belief(k)[0])
                except Exception as e:
                    pass

            return metamap
Beispiel #2
0
    def metamap_station(self, sensor_ml):
        with app.app_context():
            # gets a metamap document of this service using wicken
            beliefs = IOOSSOSDSCheck.beliefs()
            doc = MultipleXmlDogma('sos-ds', beliefs, sensor_ml._root, namespaces=get_namespaces())

            # now make a map out of this
            # @TODO wicken should make this easier
            metamap = {}
            for k in beliefs:
                try:
                    metamap[k] = getattr(doc, doc._fixup_belief(k)[0])
                except Exception as e:
                    pass

            return metamap
Beispiel #3
0
    def metamap_service(self):
        assert self.sos

        with app.app_context():
            # gets a metamap document of this service using wicken
            beliefs = IOOSSOSGCCheck.beliefs()
            doc = MultipleXmlDogma('sos-gc', beliefs, self.sos._capabilities, namespaces=get_namespaces())

            # now make a map out of this
            # @TODO wicken should make this easier
            metamap = {}
            for k in beliefs:
                try:
                    metamap[k] = getattr(doc, doc._fixup_belief(k)[0])
                except Exception as e:
                    pass

            return metamap
Beispiel #4
0
    def metamap_service(self):
        assert self.sos

        with app.app_context():
            # gets a metamap document of this service using wicken
            beliefs = IOOSSOSGCCheck.beliefs()
            doc = MultipleXmlDogma('sos-gc', beliefs, self.sos._capabilities, namespaces=get_namespaces())

            # now make a map out of this
            # @TODO wicken should make this easier
            metamap = {}
            for k in beliefs:
                try:
                    metamap[k] = getattr(doc, doc._fixup_belief(k)[0])
                except Exception as e:
                    pass

            return metamap
Beispiel #5
0
def eval_mapping(mapping_id):
    mapping = db.Mapping.find_one({'_id':mapping_id})

    evals = []
    for query in mapping.queries:

        source_type_id = query['source_type']
        eval_sources = db.EvalSource.find({'source_type':source_type_id})

        cur_mappings = {mapping.ioos_name: query['query']}

        # load attachment from gridfs
        for eval_source in eval_sources:
            try:
                root = etree.fromstring(eval_source.fs.src_file)
            except:
                print >>sys.stderr, "Could not parse:", eval_source.fs.src_file

            data_object = MultipleXmlDogma(str(source_type_id),    # any identifier here
                                           cur_mappings,
                                           root,
                                           namespaces=namespaces)


            # get new name (@TODO this should be easier)
            new_name = data_object._fixup_belief(mapping.ioos_name)[0]

            val = None
            try:
                val = getattr(data_object, new_name)
            except Exception as e:
                print >>sys.stderr, "problem", e

            evals.append((str(eval_source._id), val))

    return json.dumps(dict(evals))
Beispiel #6
0
def eval_mapping(mapping_id):
    mapping = db.Mapping.find_one({'_id': mapping_id})

    evals = []
    for query in mapping.queries:

        source_type_id = query['source_type']
        eval_sources = db.EvalSource.find({'source_type': source_type_id})

        cur_mappings = {mapping.ioos_name: query['query']}

        # load attachment from gridfs
        for eval_source in eval_sources:
            try:
                root = etree.fromstring(eval_source.fs.src_file)
            except:
                print >> sys.stderr, "Could not parse:", eval_source.fs.src_file

            data_object = MultipleXmlDogma(
                str(source_type_id),  # any identifier here
                cur_mappings,
                root,
                namespaces=namespaces)

            # get new name (@TODO this should be easier)
            new_name = data_object._fixup_belief(mapping.ioos_name)[0]

            val = None
            try:
                val = getattr(data_object, new_name)
            except Exception as e:
                print >> sys.stderr, "problem", e

            evals.append((str(eval_source._id), val))

    return json.dumps(dict(evals))
Beispiel #7
0
 def load_datapair(self, ds):
     data_object = MultipleXmlDogma('sos-gc',
                                    self.beliefs(),
                                    ds._capabilities,
                                    namespaces=get_namespaces())
     return DSPair(ds, data_object)
Beispiel #8
0
 def load_datapair(self, ds):
     data_object = MultipleXmlDogma('sos-ds',
                                    self.beliefs(),
                                    ds._root,
                                    namespaces=get_namespaces())
     return DSPair(ds, data_object)