本文整理汇总了Python中owslib.namespaces.Namespaces.get_versioned_namespace方法的典型用法代码示例。如果您正苦于以下问题:Python Namespaces.get_versioned_namespace方法的具体用法?Python Namespaces.get_versioned_namespace怎么用?Python Namespaces.get_versioned_namespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owslib.namespaces.Namespaces
的用法示例。
在下文中一共展示了Namespaces.get_versioned_namespace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Namespaces
# 需要导入模块: from owslib.namespaces import Namespaces [as 别名]
# 或者: from owslib.namespaces.Namespaces import get_versioned_namespace [as 别名]
from pyoos.utils.etree import etree
from owslib.namespaces import Namespaces
ns = Namespaces()
SML_NS = ns.get_versioned_namespace('sml', '1.0.1')
SWE_NS = [ns.get_versioned_namespace('swe', '1.0.1')]
class IoosDescribeSensor(object):
def __new__(cls, element):
if isinstance(element, str):
root = etree.fromstring(element)
else:
root = element
sml_str = ".//{{{0}}}identifier/{{{0}}}Term[@definition='http://mmisw.org/ont/ioos/definition/%s']".format(SML_NS)
if hasattr(root, 'getroot'):
root = root.getroot()
# circular dependencies are bad. consider a reorganization
# find the the proper type for the DescribeSensor
from pyoos.parsers.ioos.one.describe_sensor import (NetworkDS,
StationDS, SensorDS)
for ds_type, constructor in [('networkID', NetworkDS), ('stationID', StationDS), ('sensorID', SensorDS)]:
if root.find(sml_str % ds_type) is not None:
return super(IoosDescribeSensor, cls).__new__(constructor)
# NOAA CO-OPS
sml_str = ".//{{{0}}}identifier/{{{0}}}Term[@definition='urn:ioos:def:identifier:NOAA::networkID']".format(SML_NS)
if root.find(sml_str) is not None:
示例2: Namespaces
# 需要导入模块: from owslib.namespaces import Namespaces [as 别名]
# 或者: from owslib.namespaces.Namespaces import get_versioned_namespace [as 别名]
from __future__ import absolute_import, division, print_function
from owslib.namespaces import Namespaces
from pyoos.utils.etree import ElementType, etree
ns = Namespaces()
SML_NS = ns.get_versioned_namespace("sml", "1.0.1")
SWE_NS = [ns.get_versioned_namespace("swe", "1.0.1")]
class IoosDescribeSensor(object):
def __new__(cls, element):
if isinstance(element, ElementType):
root = element
else:
root = etree.fromstring(element)
sml_str = ".//{{{0}}}identifier/{{{0}}}Term[@definition='http://mmisw.org/ont/ioos/definition/%s']".format(
SML_NS
)
if hasattr(root, "getroot"):
root = root.getroot()
# Circular dependencies are bad. consider a reorganization
# find the the proper type for the DescribeSensor.
from pyoos.parsers.ioos.one.describe_sensor import (
NetworkDS,
StationDS,
SensorDS,