From 700751afe755b848f192b528ec496d56d25c0308 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Wed, 12 Apr 2023 22:14:03 -0400 Subject: [PATCH] ISO: subclass SV_ServiceIdentification from MD_DataIdentification (#872) * ISO: subclass SV_ServiceIdentification from MD_DataIdentification * fix tests --- owslib/iso.py | 30 ++++-------------------------- tests/doctests/iso_parse.txt | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/owslib/iso.py b/owslib/iso.py index d5a29fa2..ae486b36 100644 --- a/owslib/iso.py +++ b/owslib/iso.py @@ -747,35 +747,20 @@ def __init__(self, md=None): self.specificationdate.append(val) -class SV_ServiceIdentification(object): +class SV_ServiceIdentification(MD_DataIdentification): """ process SV_ServiceIdentification """ def __init__(self, md=None): + + super().__init__(md, 'service') + if md is None: - self.title = None - self.abstract = None - self.contact = None - self.identtype = 'service' self.type = None self.version = None self.fees = None - self.bbox = None self.couplingtype = None self.operations = [] self.operateson = [] else: - val = md.find(util.nspath_eval('gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString', namespaces)) - self.title = util.testXMLValue(val) - - val = md.find(util.nspath_eval('gmd:abstract/gco:CharacterString', namespaces)) - self.abstract = util.testXMLValue(val) - - self.contact = None - val = md.find(util.nspath_eval( - 'gmd:citation/gmd:CI_Citation/gmd:citedResponsibleParty/gmd:CI_ResponsibleParty', namespaces)) - if val is not None: - self.contact = CI_ResponsibleParty(val) - - self.identtype = 'service' val = md.find(util.nspath_eval('srv:serviceType/gco:LocalName', namespaces)) self.type = util.testXMLValue(val) @@ -786,13 +771,6 @@ def __init__(self, md=None): 'srv:accessProperties/gmd:MD_StandardOrderProcess/gmd:fees/gco:CharacterString', namespaces)) self.fees = util.testXMLValue(val) - val = md.find(util.nspath_eval('srv:extent/gmd:EX_Extent', namespaces)) - - if val is not None: - self.bbox = EX_Extent(val) - else: - self.bbox = None - self.couplingtype = _testCodeListValue(md.find(util.nspath_eval( 'gmd:couplingType/gmd:SV_CouplingType', namespaces))) diff --git a/tests/doctests/iso_parse.txt b/tests/doctests/iso_parse.txt index 611c735b..f1dc87bd 100755 --- a/tests/doctests/iso_parse.txt +++ b/tests/doctests/iso_parse.txt @@ -3,7 +3,7 @@ Imports >>> from tests.utils import resource_file >>> from owslib.etree import etree - >>> from owslib.iso import MD_Metadata + >>> from owslib.iso import MD_Metadata Print testing some metadata elements @@ -15,14 +15,14 @@ Print testing some metadata elements >>> x.identification[1].title 'Parameter-elevation Regressions on Independent Slopes Model Monthly Climate Data for the Continental United States. February 2013 Snapshot' - >>> x.identification[1].abstract[0:40] - 'This dataset was created using the PRISM' - - >>> x.identification[1].contact.name - 'Christopher Daley' - - >>> x.identification[1].contact.email - 'daley@nacse.org' - - >>> x.identification[1].operations[0]['connectpoint'][0].url - 'http://cida.usgs.gov/thredds/dodsC/prism' + >>> x.identification[1].abstract[0:40] + 'This dataset was created using the PRISM' + + >>> x.contact[0].name + 'Christopher Daley' + + >>> x.contact[0].email + 'daley@nacse.org' + + >>> x.identification[1].operations[0]['connectpoint'][0].url + 'http://cida.usgs.gov/thredds/dodsC/prism'