Changeset 15
- Timestamp:
- 12/13/11 17:56:51
- Files:
-
- virtexp/trunk/virtexp/tests/currents/currents.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
virtexp/trunk/virtexp/tests/currents/currents.py
r14 r15 5 5 import re 6 6 7 log_pattern = "/var/opt/gmc/gliders/ramses/logs/ramses_network_20111213*.log" 7 log_patterns = ["/var/opt/gmc/gliders/ramses/logs/ramses_network_20111213*.log", 8 "/var/opt/gmc/gliders/ramses/logs/ramses_network_20111212*.log", 9 "/var/opt/gmc/gliders/ramses/logs/ramses_network_20111211*.log", 10 ] 8 11 stamp_pattern = re.compile("ramses_network_(\w+)") 9 vx_pattern = re.compile("m_water_vx\(m/s\)=(\S+)") 10 vy_pattern = re.compile("m_water_vy\(m/s\)=(\S+)") 12 vx_pattern = re.compile("m_water_vx\(m/s\)=(\S+)\s+(\S+) secs ago") 13 vy_pattern = re.compile("m_water_vy\(m/s\)=(\S+)\s+(\S+) secs ago") 14 invalid_lapse = "1e+308" 11 15 12 16 isNorth = lambda phi: (phi >= (3*cmath.pi/8)) and (phi <= (5*cmath.pi/8)) … … 21 25 ((phi <= 0) and (phi <= (-7*cmath.pi/8))) 22 26 23 24 logs = glob(log_pattern) 27 logs = [] 28 for log_pattern in log_patterns: 29 logs.extend(glob(log_pattern)) 25 30 logs.sort() 26 31 logs.reverse() … … 37 42 match = vx_pattern.search(line0) 38 43 if match: 39 vx = match.groups()[0] 44 vx,lapse = match.groups() 45 if lapse == invalid_lapse: 46 continue 40 47 match = vy_pattern.search(line1) 41 48 if match: 42 vy = match.groups()[0] 49 vy,lapse = match.groups() 50 if lapse == invalid_lapse: 51 continue 43 52 currents.append((stamp,complex(float(vx),float(vy)))) 44 53 break … … 57 66 NW = [stamp for stamp,current in currents if isNWest(current[1])] 58 67 59 print "Number of surfacings :",len(currents)68 print "Number of surfacings with valid vx,vy:",len(currents) 60 69 print "Current distribution:" 61 print "North: % s%%" % (float(len(N))/len(currents))62 print "Northeast: % s%%" % (float(len(NE))/len(currents))63 print "East: % s%%" % (float(len(E))/len(currents))64 print "Southeast: % s%%" % (float(len(SE))/len(currents))65 print "South: % s%%" % (float(len(S))/len(currents))66 print "Southwest: % s%%" % (float(len(SW))/len(currents))67 print "West: % s%%" % (float(len(W))/len(currents))68 print "Northwest: % s%%" % (float(len(NW))/len(currents))70 print "North: %.2f%%" % (float(len(N))/len(currents)) 71 print "Northeast: %.2f%%" % (float(len(NE))/len(currents)) 72 print "East: %.2f%%" % (float(len(E))/len(currents)) 73 print "Southeast: %.2f%%" % (float(len(SE))/len(currents)) 74 print "South: %.2f%%" % (float(len(S))/len(currents)) 75 print "Southwest: %.2f%%" % (float(len(SW))/len(currents)) 76 print "West: %.2f%%" % (float(len(W))/len(currents)) 77 print "Northwest: %.2f%%" % (float(len(NW))/len(currents)) 69 78 print 70 79 print "Cartesian currents:"