File: sos_ngwd.txt

package info (click to toggle)
owslib 0.33.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,620 kB
  • sloc: xml: 140,558; python: 24,274; makefile: 15
file content (217 lines) | stat: -rw-r--r-- 5,321 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

Imports

    >>> from tests.utils import resource_file
    >>> from owslib.sos import SensorObservationService
    >>> from owslib.fes2 import FilterCapabilities
    >>> from owslib.ows import OperationsMetadata
    >>> from owslib.crs import Crs
    >>> from datetime import datetime
    >>> from operator import itemgetter

Initialize

    >>> xml = open(resource_file('sos_ngwd.xml'),'rb').read()
    >>> ngwd = SensorObservationService(None, xml=xml, version='2.0.0')

ServiceIdentification

    >>> id = ngwd.identification

    >>> id.service
    'OGC:SOS'

    >>> id.version
    '2.0.0'

    >>> len(id.profiles)
    5

    >>> id.title
    'GIN SOS'

    >>> id.abstract
    'GIN SOS mediator'

    >>> id.keywords
    ['water level', 'groundwater level', 'surface water flow']

    >>> id.fees
    'NONE'

    >>> id.accessconstraints
    'NONE'


ServiceProvider

    >>> p = ngwd.provider

    >>> p.name
    'Geological Survey of Canada, Earth Sciences Sector, Natural Resources Canada, Government of Canada'

    >>> p.url
    'http://gw-info.net'


    ServiceContact

    >>> sc = p.contact

    Unused fields should return nothing
    >>> sc.role
    >>> sc.position
    'Research Scientist'
    >>> sc.instructions
    >>> sc.organization
    >>> sc.fax
    '+1-613-995-9273'
    >>> sc.hours

    >>> sc.name
    'Boyan Brodaric'

    >>> sc.phone
    '+1-613-992-3562'

    >>> sc.address
    '615 Booth Street'

    >>> sc.city
    'Ottawa'

    >>> sc.region

    >>> sc.postcode
    'K1A 0E9'

    >>> sc.country
    'Canada'

    >>> sc.email
    'brodaric at nrcan dot gc dot ca'


OperationsMetadata

    >>> o = ngwd.operations
    >>> len(o)
    4

    Get by name
    >>> getcap = ngwd.get_operation_by_name('GetCapabilities')
    >>> isinstance(getcap, OperationsMetadata)
    True

    Get by name (case insensitive)
    >>> getcap = ngwd.get_operation_by_name('getcapabilities')
    >>> isinstance(getcap, OperationsMetadata)
    True

    # GetCapabilities
    >>> getcap.constraints
    []

    >>> x = getcap.parameters
    >>> x == {'AcceptVersions': {'values': ['2.0.0']}, 'updateSequence': {'values': []}, 'Sections': {'values': ['ServiceIdentification', 'ServiceProvider', 'OperationsMetadata', 'FilterCapabilities', 'Contents', 'All']}, 'AcceptFormats': {'values': ['text/xml', 'application/zip']}}
    True

    >>> x = sorted(getcap.methods, key=itemgetter('type'))
    >>> x == [{'type' : 'Get', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw?', 'constraints': []}, {'type' : 'Post', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw', 'constraints': []}]
    True


    # DescribeSensor
    >>> descsen = ngwd.get_operation_by_name('describesensor')

    >>> descsen.constraints
    []

    >>> x = descsen.parameters
    >>> x == {'procedureDescriptionFormat': {'values': ['http://www.opengis.net/sensorML/1.0.1']}, 'procedure': {'values': ['urn:ogc:object:Sensor::GIN_GroundwaterLevelProcess']}}
    True


    >>> x = sorted(descsen.methods, key=itemgetter('type'))
    >>> x == [{'type': 'Get', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw?', 'constraints': []}, {'type' : 'Post', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw', 'constraints': []}]
    True


    # GetObservation
    >>> getob = ngwd.get_operation_by_name('getobservation')

    >>> getob.constraints
    []

    >>> x = getob.parameters
    >>> x == {'srsName': {'values': []}, 'temporalFilter': {'values': []}, 'offering': {'values': ['GW_LEVEL']}, 'result': {'values': []}, 'responseFormat': {'values': ['http://www.opengis.net/waterml/2.0', 'application/zip']}, 'observedProperty': {'values': ['urn:ogc:def:phenomenon:OGC:1.0.30:groundwaterlevel']}, 'procedure': {'values': ['urn:ogc:object:Sensor::GIN_GroundwaterLevelProcess']}}
    True

    >>> x = getob.methods
    >>> x == [{'type' : 'Get', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw?', 'constraints': []}, {'type': 'Post', 'url': 'http://ngwd-bdnes.cits.nrcan.gc.ca:8080/proxy/GinService/sos/gw', 'constraints': []}]
    True


Filter_Capabilities

    >>> filter = ngwd.filters
    >>> isinstance(filter, FilterCapabilities)
    False


Contents
    >>> contents = ngwd.contents
    >>> len(contents)
    1


    Network
    >>> network = contents['GW_LEVEL']
    >>> network.id
    'GW_LEVEL'

    >>> network.procedures
    ['urn:ogc:object:Sensor::GIN_GroundwaterLevelProcess']

    >>> srs = network.bbox_srs
    >>> isinstance(srs, Crs)
    True
    >>> srs.id
    'http://www.opengis.net/def/crs/EPSG/0/4326'

    >>> srs.getcodeurn()
    'urn:ogc:def:crs:EPSG::4326'

    >>> srs.getcode()
    'EPSG:4326'

    # (left, bottom, right, top)
    >>> network.bbox
    (-120.0, 41.0, -60.0, 60.0)

    >>> bbsrs = network.bbox_srs

    >>> isinstance(bbsrs, Crs)
    True

    >>> bbsrs.getcodeurn()
    'urn:ogc:def:crs:EPSG::4326'

    >>> bbsrs.getcode()
    'EPSG:4326'

    >>> bp = network.begin_position
    >>> isinstance(bp, datetime)
    True
    >>> ep = network.end_position
    >>> isinstance(ep, datetime)
    True

    >>> network.observed_properties
    ['urn:ogc:def:phenomenon:OGC:1.0.30:groundwaterlevel']

    >>> network.response_formats
    []

    >>> network.observation_models
    []