26 | | |
---|
27 | | try: |
---|
28 | | rawDataHandle = openAnything.openAnything(filein) |
---|
29 | | rawDataString = rawDataHandle.read() |
---|
30 | | rawDataHandle.close() |
---|
31 | | except: |
---|
32 | | raise IOError("Failure to read raw data.") |
---|
33 | | |
---|
34 | | rawDataObject = a.rawData.RawData(rawDataString) |
---|
35 | | formattedDataObject = a.formattedData.FormattedData(rawDataObject) |
---|
36 | | arrayDataObject = a.ArrayData(formattedDataObject) |
---|
37 | | |
---|
38 | | beginStamp = arrayDataObject.beginStamp |
---|
39 | | endStamp = arrayDataObject.endStamp |
---|
40 | | numIntervals = arrayDataObject.numIntervals |
---|
41 | | timeInterval = arrayDataObject.timeInterval |
---|
42 | | timeInterval = (((float(timeInterval.days) * 24.0) + |
---|
43 | | (timeInterval.seconds / 3600.0)) * 60.0) |
---|
44 | | minAltitude = arrayDataObject.minAltitude |
---|
45 | | altInterval = arrayDataObject.altInterval |
---|
46 | | |
---|
47 | | def makePcolor(vector, title, fileout, cbLabel): |
---|
48 | | fig = p.figure(1) |
---|
49 | | axe = fig.add_subplot(1, 1, 1) |
---|
50 | | pc = axe.pcolor(vector) |
---|
51 | | |
---|
52 | | axe.set_xlabel('Time (min)') |
---|
53 | | axe.set_ylabel('Altitude (m)') |
---|
54 | | axe.set_xbound(upper=numIntervals) |
---|
55 | | |
---|
56 | | xticks = axe.get_xticks() |
---|
57 | | xticklabels = [str(x * timeInterval) |
---|
58 | | for x in xticks] |
---|
59 | | axe.set_xticklabels(xticklabels) |
---|
60 | | |
---|
61 | | yticks = axe.get_yticks() |
---|
62 | | yticklabels = [str(y * altInterval + minAltitude) |
---|
63 | | for y in yticks] |
---|
64 | | axe.set_yticklabels(yticklabels) |
---|
65 | | |
---|
66 | | axe.set_title(title) |
---|
67 | | cb = p.colorbar(pc) |
---|
68 | | cb.set_label(cbLabel) |
---|
69 | | |
---|
70 | | fig.savefig(os.path.join(pathout, fileout)) |
---|
71 | | fig.clear() |
---|
72 | | |
---|
73 | | return 0 |
---|
74 | | |
---|
75 | | uComponents = arrayDataObject.uComponents |
---|
76 | | maskedUComponents = n.ma.masked_where(n.isnan(uComponents), |
---|
77 | | uComponents) |
---|
78 | | makePcolor(maskedUComponents.T, |
---|
79 | | 'U Component of Wind Veloctiy\nFrom %s To %s' % |
---|
80 | | (beginStamp, endStamp), |
---|
81 | | 'uComponents.png', |
---|
82 | | 'Speed (cm/sec)') |
---|
83 | | |
---|
84 | | vComponents = arrayDataObject.vComponents |
---|
85 | | maskedVComponents = n.ma.masked_where(n.isnan(vComponents), |
---|
86 | | vComponents) |
---|
87 | | makePcolor(maskedVComponents.T, |
---|
88 | | 'V Component of Wind Veloctiy\nFrom %s To %s' % |
---|
89 | | (beginStamp, endStamp), |
---|
90 | | 'vComponents.png', |
---|
91 | | 'Speed (cm/sec)') |
---|
92 | | |
---|
93 | | wComponents = arrayDataObject.wComponents |
---|
94 | | maskedWComponents = n.ma.masked_where(n.isnan(wComponents), |
---|
95 | | wComponents) |
---|
96 | | makePcolor(maskedWComponents.T, |
---|
97 | | 'W Component of Wind Veloctiy\nFrom %s To %s' % |
---|
98 | | (beginStamp, endStamp), |
---|
99 | | 'wComponents.png', |
---|
100 | | 'Speed (cm/sec)') |
---|
101 | | |
---|
102 | | echoStrengths = arrayDataObject.echoStrengths |
---|
103 | | maskedEchoStrenths = n.ma.masked_where(n.isnan(echoStrengths), |
---|
104 | | echoStrengths) |
---|
105 | | makePcolor(maskedEchoStrenths.T, |
---|
106 | | 'Echo Strength\nFrom %s To %s' % |
---|
107 | | (beginStamp, endStamp), |
---|
108 | | 'echoStrengths.png', |
---|
109 | | 'Strength (no units)') |
---|
110 | | |
---|
| 26 | |
---|
| 27 | try: |
---|
| 28 | rawDataHandle = openAnything.openAnything(filein) |
---|
| 29 | rawDataString = rawDataHandle.read() |
---|
| 30 | rawDataHandle.close() |
---|
| 31 | except: |
---|
| 32 | raise IOError("Failure to read raw data.") |
---|
| 33 | |
---|
| 34 | rawDataObject = a.rawData.RawData(rawDataString) |
---|
| 35 | formattedDataObject = a.formattedData.FormattedData(rawDataObject) |
---|
| 36 | arrayDataObject = a.ArrayData(formattedDataObject) |
---|
| 37 | |
---|
| 38 | beginStamp = arrayDataObject.beginStamp |
---|
| 39 | endStamp = arrayDataObject.endStamp |
---|
| 40 | numIntervals = arrayDataObject.numIntervals |
---|
| 41 | timeInterval = arrayDataObject.timeInterval |
---|
| 42 | timeInterval = (((float(timeInterval.days) * 24.0) + |
---|
| 43 | (timeInterval.seconds / 3600.0)) * 60.0) |
---|
| 44 | minAltitude = arrayDataObject.minAltitude |
---|
| 45 | altInterval = arrayDataObject.altInterval |
---|
| 46 | |
---|
| 47 | def makePcolor(vector, title, fileout, cbLabel): |
---|
| 74 | |
---|
| 75 | uComponents = arrayDataObject.uComponents |
---|
| 76 | maskedUComponents = n.ma.masked_where(n.isnan(uComponents), |
---|
| 77 | uComponents) |
---|
| 78 | makePcolor(maskedUComponents.T, |
---|
| 79 | 'U Component of Wind Veloctiy\nFrom %s To %s' % |
---|
| 80 | (beginStamp, endStamp), |
---|
| 81 | 'uComponents.png', |
---|
| 82 | 'Speed (cm/sec)') |
---|
| 83 | |
---|
| 84 | vComponents = arrayDataObject.vComponents |
---|
| 85 | maskedVComponents = n.ma.masked_where(n.isnan(vComponents), |
---|
| 86 | vComponents) |
---|
| 87 | makePcolor(maskedVComponents.T, |
---|
| 88 | 'V Component of Wind Veloctiy\nFrom %s To %s' % |
---|
| 89 | (beginStamp, endStamp), |
---|
| 90 | 'vComponents.png', |
---|
| 91 | 'Speed (cm/sec)') |
---|
| 92 | |
---|
| 93 | wComponents = arrayDataObject.wComponents |
---|
| 94 | maskedWComponents = n.ma.masked_where(n.isnan(wComponents), |
---|
| 95 | wComponents) |
---|
| 96 | makePcolor(maskedWComponents.T, |
---|
| 97 | 'W Component of Wind Veloctiy\nFrom %s To %s' % |
---|
| 98 | (beginStamp, endStamp), |
---|
| 99 | 'wComponents.png', |
---|
| 100 | 'Speed (cm/sec)') |
---|
| 101 | |
---|
| 102 | echoStrengths = arrayDataObject.echoStrengths |
---|
| 103 | maskedEchoStrenths = n.ma.masked_where(n.isnan(echoStrengths), |
---|
| 104 | echoStrengths) |
---|
| 105 | makePcolor(maskedEchoStrenths.T, |
---|
| 106 | 'Echo Strength\nFrom %s To %s' % |
---|
| 107 | (beginStamp, endStamp), |
---|
| 108 | 'echoStrengths.png', |
---|
| 109 | 'Strength (no units)') |
---|
| 110 | |
---|
| 111 | fig = p.figure(1) |
---|
| 112 | axe = fig.add_subplot(1, 1, 1) |
---|
| 113 | qv = axe.quiver(maskedUComponents, |
---|
| 114 | maskedVComponents, |
---|
| 115 | maskedWComponents) |
---|
| 116 | axe.set_xlabel('Time (min)') |
---|
| 117 | axe.set_ylabel('Altitude (m)') |
---|
| 118 | axe.set_xbound(upper=numIntervals) |
---|
| 119 | xticks = axe.get_xticks() |
---|
| 120 | xticklabels = [str(x * timeInterval) |
---|
| 121 | for x in xticks] |
---|
| 122 | axe.set_xticklabels(xticklabels) |
---|
| 123 | yticks = axe.get_yticks() |
---|
| 124 | yticklabels = [str(y * altInterval + minAltitude) |
---|
| 125 | for y in yticks] |
---|
| 126 | axe.set_yticklabels(yticklabels) |
---|
| 127 | axe.set_title('Wind Velocty\nFrom %s To %s' % |
---|
| 128 | (beginStamp, endStamp)) |
---|
| 129 | cb = p.colorbar(qv) |
---|
| 130 | cb.set_label('W Component Speed (cm/sec)') |
---|
| 131 | fig.savefig(os.path.join(pathout, 'quiver.png')) |
---|
| 132 | fig.clear() |
---|
| 133 | |
---|
| 134 | return 0 |
---|