source: CMIP6dreqbuild/trunk/srcMisc/dreq01.py @ 323

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreqbuild/trunk/srcMisc/dreq01.py@376
Revision 323, 996 bytes checked in by mjuckes, 5 years ago (diff)

dreq misc

Line 
1
2
3from extractMipInfo import cmip5_ignore
4from fcc_utils2 import mipTableScan, snlist, tupsort
5import string, collections
6
7ms = mipTableScan()
8d = 'config/cmip5_vocabs/mip/CMIP5_Omon'
9d1 = ms.scan_table( open( d ).readlines(), None, asDict=True, lax=True, tag="x", warn=True)
10for k in cmip5_ignore:
11  if d1.has_key(k):
12    d1.pop(k)
13
14l1 = d1.keys()
15l1.sort()
16k = 0
17ll1 = []
18for l in l1:
19  ll1.append( (l,'a',k) )
20  k += 1
21
22d2 = '/home/martin/2014/wip/dreq/input/FAFMIP/fafmip_tall.csv'
23
24l2 = []
25for l in open(d2).readlines():
26  if len(string.strip(l)) > 0 and l[0] != '#':
27    bits = string.split( l, ',' )
28    l2.append( bits[0] )
29l2.sort()
30k = 0
31ll2 = []
32for l in l2:
33  ll2.append( (l,'b',k) )
34  k += 1
35 
36ll = ll1 + ll2
37ll.sort( tupsort(0).cmp )
38ee = collections.defaultdict( list )
39for l in ll:
40  ee[l[0]].append(l)
41
42la = []
43lb = []
44lab = []
45for k in ee.keys():
46  l = ee[k]
47  if len(l) == 2:
48    lab.append( k )
49  else:
50    if l[0][1] == 'a':
51      la.append(k)
52    else:
53      lb.append(k)
54
Note: See TracBrowser for help on using the repository browser.