Debian Codegraph @

tests/_broken/doctests_py3/wcs_nsidc.txt

raw
1 Web Coverage Service: #This is an example that shows how to the OWSLib wcs client to make requests from the NSIDC WCS.
2 ====================
3
4 Version 1.1.0
5 ========
6
7 Imports
8
9 >>> from owslib.wcs import WebCoverageService
10 >>> from tests.utils import resource_file, scratch_file
11
12 >>> xml = open(resource_file('wcs_nsidc.xml')).read()
13 >>> wcs=WebCoverageService('http://nsidc.org/cgi-bin/atlas_north', version='1.1.0', xml=xml)
14 >>> wcs.url
15 'http://nsidc.org/cgi-bin/atlas_north'
16 >>> wcs.version
17 '1.1.0'
18 >>> wcs.identification.service
19 'WCS'
20 >>> wcs.identification.version
21 '1.1.0'
22 >>> wcs.identification.type
23 'OGC WCS'
24 >>> wcs.identification.title
25 'Atlas of the Cryosphere: Northern Hemisphere'
26 >>> wcs.identification.abstract
27 "The National Snow and Ice Data Center (NSIDC) Atlas of the Cryosphere is a map server that provides data and information pertinent to the frozen regions of Earth, including monthly climatologies of sea ice extent and concentration, snow cover extent, and snow water equivalent, in addition to glacier outlines, permafrost extent and classification, ice sheet elevation and accumulation, and more. In order to support polar projections, the Atlas is divided into two separate map servers: one for the Northern Hemisphere and one for the Southern Hemisphere. In addition to providing map images and source data through Open Geospatial Consortium, Inc. (OGC) protocols (WMS, WFS, and WCS), a dynamic web interface for exploring these data is also available at http://nsidc.org/data/atlas. If you have questions, comments or suggestions, please contact NSIDC User Services at +1.303.492.6199 or [email protected]. The development of this map server application was supported by NASA's Earth Observing System (EOS) Program under contract NAS5-03099 and was developed using MapServer, an Open Source development environment for building spatially-enabled internet applications. To cite the Atlas of the Cryosphere: Maurer, J. 2007. Atlas of the Cryosphere. Boulder, Colorado USA: National Snow and Ice Data Center. Digital media. Available at http://nsidc.org/data/atlas/."
28 >>> wcs.identification.keywords
29 ['Arctic', 'Cryosphere', 'Earth Science', 'Ice Extent', 'Ice Sheets', 'Northern Hemisphere', 'Oceans', 'Polar', 'Sea Ice', 'Sea Ice Concentration', 'Snow/Ice', 'Snow Cover', 'Snow Melt', 'Snow Water Equivalent']
30 >>> wcs.identification.fees
31 'none'
32 >>> wcs.identification.accessConstraints
33 'none'
34
35 #There is no 'ResponsibleParty' information in the NCEP/NAM capabilities document, so wcs.provider is empty.
36 #but if there was you could do:
37 #wcs.provider.url
38 #and..
39 #wcs.provider.contact.organization
40 #wcs.provider.contact.email
41 #wcs.provider.contact.address
42 #etc... for region, city, postcode, country
43
44 Print the ids of all layers (actually just the first 3):
45 >>> sorted(wcs.contents.keys())
46 ['greenland_accumulation', 'greenland_bedrock_elevation', 'greenland_elevation', 'greenland_ice_thickness', 'greenland_surface_melt', 'sea_ice_concentration_01', 'sea_ice_concentration_02', 'sea_ice_concentration_03', 'sea_ice_concentration_04', 'sea_ice_concentration_05', 'sea_ice_concentration_06', 'sea_ice_concentration_07', 'sea_ice_concentration_08', 'sea_ice_concentration_09', 'sea_ice_concentration_10', 'sea_ice_concentration_11', 'sea_ice_concentration_12', 'seasonal_snow_classification', 'snow_extent_01', 'snow_extent_02', 'snow_extent_03', 'snow_extent_04', 'snow_extent_05', 'snow_extent_06', 'snow_extent_07', 'snow_extent_08', 'snow_extent_09', 'snow_extent_10', 'snow_extent_11', 'snow_extent_12', 'snow_water_equivalent_01', 'snow_water_equivalent_02', 'snow_water_equivalent_03', 'snow_water_equivalent_04', 'snow_water_equivalent_05', 'snow_water_equivalent_06', 'snow_water_equivalent_07', 'snow_water_equivalent_08', 'snow_water_equivalent_09', 'snow_water_equivalent_10', 'snow_water_equivalent_11', 'snow_water_equivalent_12']
47
48
49 #To further interrogate a single "coverage" get the coverageMetadata object
50 #You can either do:
51 >>> cvg= wcs.contents['sea_ice_concentration_09'] #to get it from the dictonary
52
53 #or even simpler you can do:
54 >>> cvg=wcs['sea_ice_concentration_09']
55
56 >>> cvg.boundingBoxWGS84
57 (-179.999998745864, 34.9037152643753, 178.959571606408, 53.7717181062498)
58
59 >>> len(cvg.timepositions)>1 #The old test kept failing as the response timepositions kept changign on the server
60 False
61
62 >>> [y for y in (x.getcode() for x in cvg.supportedCRS) if y]
63 ['EPSG:32661', 'EPSG:4326', 'EPSG:3408', 'EPSG:3410', 'EPSG:3411', 'EPSG:3413', 'EPSG:3571', 'EPSG:3572', 'EPSG:3573', 'EPSG:3574', 'EPSG:3575', 'EPSG:3576', 'EPSG:3973', 'EPSG:3975', 'EPSG:32624', 'EPSG:3857', 'EPSG:900913']
64
65 >>> cvg.supportedFormats
66 ['image/tiff']