@@ -12,15 +12,15 objReader = Voltage.VoltageReader() | |||||
12 |
|
12 | |||
13 |
|
13 | |||
14 | path = '/home/roj-idl71/Data/RAWDATA/DP_Faraday/' |
|
14 | path = '/home/roj-idl71/Data/RAWDATA/DP_Faraday/' | |
|
15 | #path = '/remote/puma/2011_03/DP_Faraday' | |||
|
16 | ||||
|
17 | ||||
15 | startDateTime = datetime.datetime(2011,3,11,16,0,0) |
|
18 | startDateTime = datetime.datetime(2011,3,11,16,0,0) | |
16 |
endDateTime = datetime.datetime(2011,3,1 |
|
19 | endDateTime = datetime.datetime(2011,3,12,20,1,0) | |
17 | set = None |
|
|||
18 | expLabel = '' |
|
|||
19 | ext = '*.r' |
|
|||
20 |
|
20 | |||
21 | t0 = time.time() |
|
21 | t0 = time.time() | |
22 | objReader.setup(path, startDateTime, endDateTime) |
|
22 | objReader.setup(path, startDateTime, endDateTime) | |
23 |
|
|
23 | print time.time() - t0 | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | while(not(objReader.noMoreFiles)): |
|
26 | while(not(objReader.noMoreFiles)): |
@@ -105,53 +105,74 class VoltageReader(DataReader): | |||||
105 | startUtSeconds = time.mktime(startDateTime.timetuple()) |
|
105 | startUtSeconds = time.mktime(startDateTime.timetuple()) | |
106 | endUtSeconds = time.mktime(endDateTime.timetuple()) |
|
106 | endUtSeconds = time.mktime(endDateTime.timetuple()) | |
107 |
|
107 | |||
108 | startYear = startDateTime.timetuple().tm_year |
|
108 | # startYear = startDateTime.timetuple().tm_year | |
109 | endYear = endDateTime.timetuple().tm_year |
|
109 | # endYear = endDateTime.timetuple().tm_year | |
|
110 | # | |||
|
111 | # startDoy = startDateTime.timetuple().tm_yday | |||
|
112 | # endDoy = endDateTime.timetuple().tm_yday | |||
|
113 | # | |||
|
114 | # yearRange = range(startYear,endYear+1) | |||
|
115 | # | |||
|
116 | # doyDoubleList = [] | |||
|
117 | # if startYear == endYear: | |||
|
118 | # doyList = range(startDoy,endDoy+1) | |||
|
119 | # else: | |||
|
120 | # for year in yearRange: | |||
|
121 | # if (year == startYear): | |||
|
122 | # doyDoubleList.append(range(startDoy,365+1)) | |||
|
123 | # elif (year == endYear): | |||
|
124 | # doyDoubleList.append(range(1,endDoy+1)) | |||
|
125 | # else: | |||
|
126 | # doyDoubleList.append(range(1,365+1)) | |||
|
127 | # doyList = [] | |||
|
128 | # for list in doyDoubleList: | |||
|
129 | # doyList = doyList + list | |||
|
130 | # | |||
|
131 | # dirList = [] | |||
|
132 | # for thisPath in os.listdir(path): | |||
|
133 | # if os.path.isdir(os.path.join(path,thisPath)): | |||
|
134 | # #dirList.append(os.path.join(path,thisPath)) | |||
|
135 | # dirList.append(thisPath) | |||
|
136 | # | |||
|
137 | # pathList = [] | |||
|
138 | # pathDict = {} | |||
|
139 | # for year in yearRange: | |||
|
140 | # for doy in doyList: | |||
|
141 | # match = fnmatch.filter(dirList, 'D' + '%4.4d%3.3d' % (year,doy)) | |||
|
142 | # if len(match) == 0: | |||
|
143 | # match = fnmatch.filter(dirList, 'd' + '%4.4d%3.3d' % (year,doy)) | |||
|
144 | # if len(match) == 0: continue | |||
|
145 | # if expLabel == '': | |||
|
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])] = [] | |||
|
149 | # else: | |||
|
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))] = [] | |||
110 |
|
153 | |||
111 | startDoy = startDateTime.timetuple().tm_yday |
|
154 | ||
112 | endDoy = endDateTime.timetuple().tm_yday |
|
155 | dirList = [] | |
113 |
|
||||
114 | yearRange = range(startYear,endYear+1) |
|
|||
115 |
|
||||
116 | doyDoubleList = [] |
|
|||
117 | if startYear == endYear: |
|
|||
118 | doyList = range(startDoy,endDoy+1) |
|
|||
119 | else: |
|
|||
120 | for year in yearRange: |
|
|||
121 | if (year == startYear): |
|
|||
122 | doyDoubleList.append(range(startDoy,365+1)) |
|
|||
123 | elif (year == endYear): |
|
|||
124 | doyDoubleList.append(range(1,endDoy+1)) |
|
|||
125 | else: |
|
|||
126 | doyDoubleList.append(range(1,365+1)) |
|
|||
127 | doyList = [] |
|
|||
128 | for list in doyDoubleList: |
|
|||
129 | doyList = doyList + list |
|
|||
130 |
|
||||
131 | doyPathList = [] |
|
|||
132 | for thisPath in os.listdir(path): |
|
156 | for thisPath in os.listdir(path): | |
133 | if os.path.isdir(os.path.join(path,thisPath)): |
|
157 | if os.path.isdir(os.path.join(path,thisPath)): | |
134 |
|
|
158 | dirList.append(thisPath) | |
135 | doyPathList.append(thisPath) |
|
159 | ||
136 |
|
||||
137 | pathList = [] |
|
160 | pathList = [] | |
138 | pathDict = {} |
|
|||
139 | for year in yearRange: |
|
|||
140 | for doy in doyList: |
|
|||
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 |
|
|||
145 | if expLabel == '': |
|
|||
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])] = [] |
|
|||
149 | else: |
|
|||
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))] = [] |
|
|||
153 |
|
161 | |||
|
162 | thisDateTime = startDateTime | |||
154 |
|
163 | |||
|
164 | while(thisDateTime <= endDateTime): | |||
|
165 | year = thisDateTime.timetuple().tm_year | |||
|
166 | doy = thisDateTime.timetuple().tm_yday | |||
|
167 | ||||
|
168 | match = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy)) | |||
|
169 | if len(match) == 0: | |||
|
170 | thisDateTime += datetime.timedelta(1) | |||
|
171 | continue | |||
|
172 | ||||
|
173 | pathList.append(os.path.join(path,match[0],expLabel)) | |||
|
174 | thisDateTime += datetime.timedelta(1) | |||
|
175 | ||||
155 | filenameList = [] |
|
176 | filenameList = [] | |
156 | for thisPath in pathList: |
|
177 | for thisPath in pathList: | |
157 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
178 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
@@ -335,10 +356,9 class VoltageReader(DataReader): | |||||
335 | return 0 |
|
356 | return 0 | |
336 |
|
357 | |||
337 | def getData(self): |
|
358 | def getData(self): | |
338 |
"""Obtiene un unidad de datos del buffer de lectura y es copiada a la clase " |
|
359 | """Obtiene un unidad de datos del buffer de lectura y es copiada a la clase "Voltage" | |
339 | con todos los parametros asociados a este. cuando no hay datos en el buffer de |
|
360 | con todos los parametros asociados a este. cuando no hay datos en el buffer de | |
340 | lectura es necesario hacer una nueva lectura de los bloques de datos |
|
361 | lectura es necesario hacer una nueva lectura de los bloques de datos usando "readNextBlock" | |
341 | "__readBlock" |
|
|||
342 | """ |
|
362 | """ | |
343 | self.flagResetProcessing = 0 |
|
363 | self.flagResetProcessing = 0 | |
344 |
|
364 |
General Comments 0
You need to be logged in to leave comments.
Login now