-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.met.no.py
72 lines (51 loc) · 1.73 KB
/
read.met.no.py
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
# read met.no
import parse_c4i_catalog
from read_catalog import ReadCatalog
class ReadMetNo(ReadCatalog):
def __init__(self):
catalog_url_head = "http://thredds.met.no/thredds/dodsC/"
catalog_url_proj = "arcticdata/met.no/CLIPC"
catalog_url = catalog_url_head+catalog_url_proj+"/catalog.xml"
wmsStart = 'http://thredds.met.no/thredds/wms/'#'https://climate4impact.eu/impactportal/ImpactService?source='
#catalog = 'http://opendap.knmi.nl/knmi/thredds/catalog/'
#opendap = 'http://opendap.knmi.nl/knmi/thredds/dodsC/'
wmsEnd = '?service=WMS&version=1.3.0&request=GetCapabilities'
ReadCatalog.__init__(self , catalog_url_head ,catalog_url_proj)
layer = ''
links , ncs = parse_c4i_catalog.readcatalog3B(catalog_url,catalog_url_head,wmsStart,wmsEnd , layer)
self.print_list_to_file('met.no.wms',links)
self.print_list_to_file('met.no.ncs',ncs)
print len(ncs)
#class UniDict():
print ""
uni = {}
uni['variable'] = []
uni['experiment'] = []
uni['model'] = []
uni['ensemble'] = []
uni['regional'] = []
#uni['8'] = []
for n in ncs:
line = n.split('_')
#print line
if line[1] not in uni['variable']:
uni['variable'].append(line[1])
elif line[3] not in uni['model']:
uni['model'].append(line[3])
elif line[4] not in uni['experiment']:
uni['experiment'].append(line[4])
elif line[5] not in uni['ensemble']:
uni['ensemble'].append(line[5])
elif line[6] not in uni['regional']:
uni['regional'].append(line[6])
#elif line[8] not in uni['8']:
# uni['8'].append(line[8])
for k in uni.keys():
print k+": "+str(uni[k])
print ""
self.printSelf()
#fileName = 'ncs.last'
#fo = open(fileName,"r+")
#old = fo.read()
#print old
catalogMetNo = ReadMetNo()