##// END OF EJS Templates
El modulo de búsqueda de archivos fue corregido
Miguel Valdez -
r12:d0fb1dc19c25
parent child
Show More
@@ -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,11,20,1,0)
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 #print time.time() - t0
23 print time.time() - t0
24
24
25
25
26 while(not(objReader.noMoreFiles)):
26 while(not(objReader.noMoreFiles)):
@@ -105,52 +105,73 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
110 #
111 startDoy = startDateTime.timetuple().tm_yday
111 # startDoy = startDateTime.timetuple().tm_yday
112 endDoy = endDateTime.timetuple().tm_yday
112 # endDoy = endDateTime.timetuple().tm_yday
113
113 #
114 yearRange = range(startYear,endYear+1)
114 # yearRange = range(startYear,endYear+1)
115
115 #
116 doyDoubleList = []
116 # doyDoubleList = []
117 if startYear == endYear:
117 # if startYear == endYear:
118 doyList = range(startDoy,endDoy+1)
118 # doyList = range(startDoy,endDoy+1)
119 else:
119 # else:
120 for year in yearRange:
120 # for year in yearRange:
121 if (year == startYear):
121 # if (year == startYear):
122 doyDoubleList.append(range(startDoy,365+1))
122 # doyDoubleList.append(range(startDoy,365+1))
123 elif (year == endYear):
123 # elif (year == endYear):
124 doyDoubleList.append(range(1,endDoy+1))
124 # doyDoubleList.append(range(1,endDoy+1))
125 else:
125 # else:
126 doyDoubleList.append(range(1,365+1))
126 # doyDoubleList.append(range(1,365+1))
127 doyList = []
127 # doyList = []
128 for list in doyDoubleList:
128 # for list in doyDoubleList:
129 doyList = doyList + list
129 # doyList = doyList + list
130
130 #
131 doyPathList = []
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))] = []
153
154
155 dirList = []
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 #doyPathList.append(os.path.join(path,thisPath))
158 dirList.append(thisPath)
135 doyPathList.append(thisPath)
136
159
137 pathList = []
160 pathList = []
138 pathDict = {}
161
139 for year in yearRange:
162 thisDateTime = startDateTime
140 for doy in doyList:
163
141 match = fnmatch.filter(doyPathList, 'D' + '%4.4d%3.3d' % (year,doy))
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))
142 if len(match) == 0:
169 if len(match) == 0:
143 match = fnmatch.filter(doyPathList, 'd' + '%4.4d%3.3d' % (year,doy))
170 thisDateTime += datetime.timedelta(1)
144 if len(match) == 0: continue
171 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
172
173 pathList.append(os.path.join(path,match[0],expLabel))
174 thisDateTime += datetime.timedelta(1)
154
175
155 filenameList = []
176 filenameList = []
156 for thisPath in pathList:
177 for thisPath in pathList:
@@ -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 "Data"
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