source: CMIP6dreqbuild/trunk/src/framework/dreqPy/examples/ex002.py @ 629

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreqbuild/trunk/src/framework/dreqPy/examples/ex002.py@629
Revision 629, 920 bytes checked in by mjuckes, 4 years ago (diff)

cleaned scope.py

Line 
1
2import sys, os
3
4if len(sys.argv) > 1:
5  if os.path.isdir( sys.argv[1] ):
6    if os.path.isfile( '%s/dreq.py' % sys.argv[1] ):
7      sys.path.insert(0, sys.argv[1] )
8      import dreq
9    else:
10      print 'No dreq.py in specified directory'
11      sys.exit(0)
12  else:
13    print 'Specified directoty does not exist'
14    sys.exit(0)
15else:
16  from dreqPy import dreq
17
18
19
20dq = dreq.loadDreq()
21
22dcppLinks = [x for x in dq.coll['requestLink'].items if x.mip == 'DCPP']
23print 'Request links found for DCPP: %s' % len( dcppLinks )
24
25dcppRequestedGroups = set( [dq.inx.uid[x.refid] for x in dcppLinks] )
26print 'Request groups found for DCPP: %s' % len( dcppRequestedGroups )
27
28dcppRequestedCmorVars = set()
29for vg in dcppRequestedGroups:
30   for x in dq.inx.iref_by_sect[vg.uid].a['requestVar']:
31       dcppRequestedCmorVars.add( dq.inx.uid[x].vid )
32print 'Requested CMOR Variables found for DCPP: %s' % len( dcppRequestedCmorVars )
33
Note: See TracBrowser for help on using the repository browser.