@@ -0,0 +1,17 | |||
|
1 | ''' | |
|
2 | Created on Feb 7, 2012 | |
|
3 | ||
|
4 | @author: roj-idl71 | |
|
5 | ''' | |
|
6 | ||
|
7 | class VoltagePlot(object): | |
|
8 | ''' | |
|
9 | classdocs | |
|
10 | ''' | |
|
11 | ||
|
12 | ||
|
13 | def __init__(self): | |
|
14 | ''' | |
|
15 | Constructor | |
|
16 | ''' | |
|
17 | pass No newline at end of file |
@@ -10,6 +10,11 class Spectrum: | |||
|
10 | 10 | showPowerProfile = True |
|
11 | 11 | |
|
12 | 12 | __szchar = 0.7 |
|
13 | __xrange = None | |
|
14 | __yrange = None | |
|
15 | __zrange = None | |
|
16 | specObj = BasicGraph() | |
|
17 | ||
|
13 | 18 | |
|
14 | 19 | def __init__(self): |
|
15 | 20 | |
@@ -175,13 +180,22 class CrossSpectrum: | |||
|
175 | 180 | showPowerProfile = True |
|
176 | 181 | |
|
177 | 182 | __szchar = 0.7 |
|
183 | __showPhase = False | |
|
184 | __xrange = None | |
|
185 | __yrange = None | |
|
186 | __zrange = None | |
|
187 | m_BasicGraph= BasicGraph() | |
|
188 | ||
|
178 | 189 | def __init__(self): |
|
179 | 190 | pass |
|
180 | ||
|
181 | def setup(self): | |
|
191 | ||
|
192 | def setup(self, subpage, title, xlabel, ylabel, colormap, showColorbar, showPowerProfile): | |
|
182 | 193 | pass |
|
183 | ||
|
184 | def plotData(self): | |
|
194 | ||
|
195 | def setRanges(self, xrange, yrange, zrange): | |
|
196 | pass | |
|
197 | ||
|
198 | def plotData(self, data, xmin, xmax, ymin, ymax, zmin, zmax): | |
|
185 | 199 | pass |
|
186 | 200 | |
|
187 | 201 | if __name__ == '__main__': |
@@ -4,28 +4,31 Created on 23/01/2012 | |||
|
4 | 4 | @author: danielangelsuarezmunoz |
|
5 | 5 | ''' |
|
6 | 6 | |
|
7 |
import Voltage |
|
|
7 | import Voltage | |
|
8 | 8 | import datetime |
|
9 | 9 | import time |
|
10 | 10 | |
|
11 |
objReader = Voltage |
|
|
11 | objReader = Voltage.VoltageReader() | |
|
12 | 12 | |
|
13 | path = '/Users/danielangelsuarezmunoz/Documents/Projects' | |
|
14 | startDateTime = datetime.datetime(2007,1,1,16,0,0) | |
|
15 |
|
|
|
13 | ||
|
14 | path = '/home/roj-idl71/Data/RAWDATA/DP_Faraday/' | |
|
15 | startDateTime = datetime.datetime(2011,3,11,16,0,0) | |
|
16 | endDateTime = datetime.datetime(2011,3,11,20,1,0) | |
|
16 | 17 | set = None |
|
17 | 18 | expLabel = '' |
|
18 | 19 | ext = '*.r' |
|
19 | 20 | |
|
20 | 21 | t0 = time.time() |
|
21 |
objReader.setup(path, startDateTime, endDateTime |
|
|
22 | print time.time() - t0 | |
|
22 | objReader.setup(path, startDateTime, endDateTime) | |
|
23 | #print time.time() - t0 | |
|
23 | 24 | |
|
24 | 25 | |
|
25 | 26 | while(not(objReader.noMoreFiles)): |
|
26 | 27 | |
|
27 | 28 | objReader.getData() |
|
29 | # if objReader.flagIsNewFile: | |
|
30 | # print objReader.m_BasicHeader.dataBlock | |
|
28 | 31 | #print objReader.objStructShortHeader.dataBlock |
|
29 |
#print time.localtime(objReader. |
|
|
32 | #print time.localtime(objReader.m_BasicHeader.utc) | |
|
30 | 33 | |
|
31 | 34 | No newline at end of file |
@@ -17,23 +17,23 from Data import DataReader | |||
|
17 | 17 | from Data import DataWriter |
|
18 | 18 | |
|
19 | 19 | path = os.path.split(os.getcwd())[0] |
|
20 |
sys.path.append( |
|
|
20 | sys.path.append(path) | |
|
21 | 21 | |
|
22 | from Voltage import Voltage | |
|
22 | from Model.Voltage import Voltage | |
|
23 | 23 | |
|
24 | 24 | class VoltageReader(DataReader): |
|
25 | 25 | |
|
26 |
__idFile = |
|
|
26 | __idFile = None | |
|
27 | 27 | |
|
28 |
__fp = |
|
|
28 | __fp = None | |
|
29 | 29 | |
|
30 |
__startDateTime = |
|
|
30 | __startDateTime = None | |
|
31 | 31 | |
|
32 |
__endDateTime = |
|
|
32 | __endDateTime = None | |
|
33 | 33 | |
|
34 |
__dataType = |
|
|
34 | __dataType = None | |
|
35 | 35 | |
|
36 |
__ |
|
|
36 | __fileSizeByHeader = 0 | |
|
37 | 37 | |
|
38 | 38 | __pathList = [] |
|
39 | 39 | |
@@ -51,9 +51,9 class VoltageReader(DataReader): | |||
|
51 | 51 | |
|
52 | 52 | online = 0 |
|
53 | 53 | |
|
54 |
filename = |
|
|
54 | filename = None | |
|
55 | 55 | |
|
56 |
fileSize = |
|
|
56 | fileSize = None | |
|
57 | 57 | |
|
58 | 58 | firstHeaderSize = 0 |
|
59 | 59 | |
@@ -73,8 +73,11 class VoltageReader(DataReader): | |||
|
73 | 73 | |
|
74 | 74 | __buffer_id = 9999 |
|
75 | 75 | |
|
76 | def __init__(self, m_Voltage): | |
|
76 | def __init__(self, m_Voltage = None): | |
|
77 | 77 | |
|
78 | if m_Voltage == None: | |
|
79 | m_Voltage = Voltage() | |
|
80 | ||
|
78 | 81 | self.m_Voltage = m_Voltage |
|
79 | 82 | |
|
80 | 83 | def __rdSystemHeader(self,fp=None): |
@@ -95,7 +98,9 class VoltageReader(DataReader): | |||
|
95 | 98 | |
|
96 | 99 | self.m_ProcessingHeader.read(fp) |
|
97 | 100 | |
|
98 |
def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = " |
|
|
101 | def __searchFiles(self,path, startDateTime, endDateTime, set=None, expLabel = "", ext = ".r"): | |
|
102 | ||
|
103 | print "Searching files ..." | |
|
99 | 104 | |
|
100 | 105 | startUtSeconds = time.mktime(startDateTime.timetuple()) |
|
101 | 106 | endUtSeconds = time.mktime(endDateTime.timetuple()) |
@@ -106,50 +111,51 class VoltageReader(DataReader): | |||
|
106 | 111 | startDoy = startDateTime.timetuple().tm_yday |
|
107 | 112 | endDoy = endDateTime.timetuple().tm_yday |
|
108 | 113 | |
|
109 |
range |
|
|
114 | yearRange = range(startYear,endYear+1) | |
|
110 | 115 | |
|
111 |
|
|
|
116 | doyDoubleList = [] | |
|
112 | 117 | if startYear == endYear: |
|
113 | 118 | doyList = range(startDoy,endDoy+1) |
|
114 | 119 | else: |
|
115 |
for year in range |
|
|
120 | for year in yearRange: | |
|
116 | 121 | if (year == startYear): |
|
117 |
|
|
|
122 | doyDoubleList.append(range(startDoy,365+1)) | |
|
118 | 123 | elif (year == endYear): |
|
119 |
|
|
|
124 | doyDoubleList.append(range(1,endDoy+1)) | |
|
120 | 125 | else: |
|
121 |
|
|
|
126 | doyDoubleList.append(range(1,365+1)) | |
|
122 | 127 | doyList = [] |
|
123 |
for list in |
|
|
128 | for list in doyDoubleList: | |
|
124 | 129 | doyList = doyList + list |
|
125 | 130 | |
|
126 |
|
|
|
131 | doyPathList = [] | |
|
127 | 132 | for thisPath in os.listdir(path): |
|
128 | 133 | if os.path.isdir(os.path.join(path,thisPath)): |
|
129 |
# |
|
|
130 |
|
|
|
134 | #doyPathList.append(os.path.join(path,thisPath)) | |
|
135 | doyPathList.append(thisPath) | |
|
131 | 136 | |
|
132 | 137 | pathList = [] |
|
133 |
|
|
|
134 |
for year in range |
|
|
138 | pathDict = {} | |
|
139 | for year in yearRange: | |
|
135 | 140 | for doy in doyList: |
|
136 |
|
|
|
137 |
if len( |
|
|
138 | continue | |
|
141 | match = fnmatch.filter(doyPathList, 'D' + '%4.4d%3.3d' % (year,doy)) | |
|
142 | if len(match) == 0: | |
|
143 | match = fnmatch.filter(doyPathList, 'd' + '%4.4d%3.3d' % (year,doy)) | |
|
144 | if len(match) == 0: continue | |
|
139 | 145 | if expLabel == '': |
|
140 |
pathList.append(os.path.join(path, |
|
|
141 |
|
|
|
142 |
|
|
|
146 | pathList.append(os.path.join(path,match[0])) | |
|
147 | pathDict.setdefault(os.path.join(path,match[0])) | |
|
148 | pathDict[os.path.join(path,match[0])] = [] | |
|
143 | 149 | else: |
|
144 |
pathList.append(os.path.join(path,os.path.join( |
|
|
145 |
|
|
|
146 |
|
|
|
150 | pathList.append(os.path.join(path,os.path.join(match[0],expLabel))) | |
|
151 | pathDict.setdefault(os.path.join(path,os.path.join(match[0],expLabel))) | |
|
152 | pathDict[os.path.join(path,os.path.join(match[0],expLabel))] = [] | |
|
147 | 153 | |
|
148 | 154 | |
|
149 | 155 | filenameList = [] |
|
150 | 156 | for thisPath in pathList: |
|
151 | fileList = glob.glob1(thisPath, ext) | |
|
152 |
# |
|
|
157 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
|
158 | #pathDict[thisPath].append(fileList) | |
|
153 | 159 | fileList.sort() |
|
154 | 160 | for file in fileList: |
|
155 | 161 | filename = os.path.join(thisPath,file) |
@@ -218,7 +224,7 class VoltageReader(DataReader): | |||
|
218 | 224 | tmp = 0 |
|
219 | 225 | |
|
220 | 226 | self.__dataType = tmp |
|
221 |
self.__ |
|
|
227 | self.__fileSizeByHeader = self.m_ProcessingHeader.dataBlocksPerFile * self.m_ProcessingHeader.blockSize + self.firstHeaderSize + self.basicHeaderSize*(self.m_ProcessingHeader.dataBlocksPerFile - 1) | |
|
222 | 228 | |
|
223 | 229 | def __setNextFileOnline(self): |
|
224 | 230 | return 0 |
@@ -265,6 +271,9 class VoltageReader(DataReader): | |||
|
265 | 271 | |
|
266 | 272 | def __setNewBlock(self): |
|
267 | 273 | |
|
274 | if self.__fp == None: | |
|
275 | return 0 | |
|
276 | ||
|
268 | 277 | if self.__flagIsNewFile: |
|
269 | 278 | return 1 |
|
270 | 279 | |
@@ -337,18 +346,18 class VoltageReader(DataReader): | |||
|
337 | 346 | self.readNextBlock() |
|
338 | 347 | |
|
339 | 348 | if self.noMoreFiles == 1: |
|
340 |
print ' |
|
|
349 | print 'Process finished' | |
|
341 | 350 | return None |
|
342 | 351 | |
|
343 | 352 | data = self.__buffer[self.__buffer_id,:,:] |
|
344 | 353 | time = 111 |
|
345 | 354 | |
|
346 | self.m_Voltage.data = data | |
|
347 | self.m_Voltage.timeProfile = time | |
|
348 | self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() | |
|
349 | self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() | |
|
350 | self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() | |
|
351 | self.m_Voltage.m_SystemHeader = self.m_systemHeader.copy() | |
|
355 | # self.m_Voltage.data = data | |
|
356 | # self.m_Voltage.timeProfile = time | |
|
357 | # self.m_Voltage.m_BasicHeader = self.m_BasicHeader.copy() | |
|
358 | # self.m_Voltage.m_ProcessingHeader = self.m_ProcessingHeader.copy() | |
|
359 | # self.m_Voltage.m_RadarControllerHeader = self.m_RadarControllerHeader.copy() | |
|
360 | # self.m_Voltage.m_SystemHeader = self.m_systemHeader.copy() | |
|
352 | 361 | |
|
353 | 362 | self.__buffer_id += 1 |
|
354 | 363 | |
@@ -363,6 +372,8 class VoltageReader(DataReader): | |||
|
363 | 372 | pathList, filenameList = self.__searchFiles(path, startDateTime, endDateTime, set, expLabel, ext) |
|
364 | 373 | |
|
365 | 374 | if len(filenameList) == 0: |
|
375 | self.__fp = None | |
|
376 | self.noMoreFiles = 1 | |
|
366 | 377 | print 'Do not exist files in range: %s - %s'%(startDateTime.ctime(), endDateTime.ctime()) |
|
367 | 378 | return 0 |
|
368 | 379 |
General Comments 0
You need to be logged in to leave comments.
Login now