source: CMIP6dreqbuild/trunk/src/framework/compare.py @ 539

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreqbuild/trunk/src/framework/compare.py@1149
Revision 539, 1.3 KB checked in by mjuckes, 4 years ago (diff)

For distribution

Line 
1
2from dreqPy import dreq
3import os
4import urllib2
5
6ref = 'http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/tags/01.beta.13/dreqPy/docs/dreq.xml'
7refi = 'http://proj.badc.rl.ac.uk/svn/exarch/CMIP6dreq/tags/01.beta.13/dreqPy/docs/dreq2Defn.xml'
8reqi = urllib2.Request(refi)
9response = urllib2.urlopen(reqi)
10the_pagei = response.read()
11
12req = urllib2.Request(ref)
13response = urllib2.urlopen(req)
14the_page = response.read()
15
16
17dq = dreq.loadDreq( dreqXML=the_page, configdoc=the_pagei, strings=True )
18dqc = dreq.loadDreq()
19
20print 'Comparing version 01.beta.13 with current'
21
22s0 = set( dqc.coll.keys() )
23s1 = set( dq.coll.keys() )
24if len( s1.difference( s0 ) ) > 0:
25  print 'Sections omitted in current: %s' % str( s1.difference( s0 ) )
26else:
27  print 'No sections removed'
28if len( s0.difference( s1 ) ) > 0:
29  print 'Sections new in current: %s' % str( s0.difference( s1 ) )
30else:
31  print 'No sections added'
32
33ss = s0.intersection( s1 )
34for s in sorted( list(ss) ):
35  if len( dq.coll[s].items ) == len( dqc.coll[s].items ):
36    print "Section %s: length unchanged -- %s" % (s,len( dqc.coll[s].items ) )
37  elif len( dq.coll[s].items ) < len( dqc.coll[s].items ):
38    print "Section %s: expanded %s to %s" % (s,len( dq.coll[s].items ), len( dqc.coll[s].items ))
39  else:
40    print "Section %s: shrunk %s to %s" % (s,len( dq.coll[s].items ), len( dqc.coll[s].items ))
41
Note: See TracBrowser for help on using the repository browser.