Skip to content

Commit

Permalink
ISO: subclass SV_ServiceIdentification from MD_DataIdentification (#872)
Browse files Browse the repository at this point in the history
* ISO: subclass SV_ServiceIdentification from MD_DataIdentification

* fix tests
  • Loading branch information
tomkralidis authored Apr 13, 2023
1 parent 306ceed commit 700751a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 38 deletions.
30 changes: 4 additions & 26 deletions owslib/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)))

Expand Down
24 changes: 12 additions & 12 deletions tests/doctests/iso_parse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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'

0 comments on commit 700751a

Please sign in to comment.