##// END OF EJS Templates
Fix reading files in online mode
Juan C. Espinoza -
r1217:f42f79a936d7
parent child
Show More
@@ -86,7 +86,8 DATA_STRUCTURE = numpy.dtype([
86 @MPDecorator
86 @MPDecorator
87 class BLTRParamReader(JRODataReader, ProcessingUnit):
87 class BLTRParamReader(JRODataReader, ProcessingUnit):
88 '''
88 '''
89 Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files
89 Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR
90 from *.sswma files
90 '''
91 '''
91
92
92 ext = '.sswma'
93 ext = '.sswma'
@@ -144,12 +145,11 class BLTRParamReader(JRODataReader, ProcessingUnit):
144 '''
145 '''
145
146
146 for n in range(self.nTries):
147 for n in range(self.nTries):
147 if n > 0:
148 log.warning(
148 log.warning(
149 "Waiting %0.2f seconds for the next file, try %03d ..." % (self.delay, n+1),
149 "Waiting %0.2f sec for the next file, try %03d ..." % (self.delay, self.nTries + 1),
150 self.name
150 self.name
151 )
151 )
152 time.sleep(self.delay)
152 time.sleep(self.delay)
153 file_list = os.listdir(self.path)
153 file_list = os.listdir(self.path)
154 file_list.sort()
154 file_list.sort()
155 if file_list:
155 if file_list:
@@ -178,9 +178,6 class BLTRParamReader(JRODataReader, ProcessingUnit):
178 fileList0 = glob.glob1(path, "*%s" % ext)
178 fileList0 = glob.glob1(path, "*%s" % ext)
179 fileList0.sort()
179 fileList0.sort()
180
180
181 #self.fileList = []
182 #self.dateFileList = []
183
184 for thisFile in fileList0:
181 for thisFile in fileList0:
185 year = thisFile[-14:-10]
182 year = thisFile[-14:-10]
186 if not isNumber(year):
183 if not isNumber(year):
@@ -201,7 +198,6 class BLTRParamReader(JRODataReader, ProcessingUnit):
201 continue
198 continue
202
199
203 yield thisFile
200 yield thisFile
204 # self.dateFileList.append(dateFile)
205
201
206 return
202 return
207
203
@@ -216,7 +212,6 class BLTRParamReader(JRODataReader, ProcessingUnit):
216 try:
212 try:
217 filename = next(self.fileList)
213 filename = next(self.fileList)
218 except StopIteration:
214 except StopIteration:
219 print('Noooo files')
220 self.flagNoMoreFiles = 1
215 self.flagNoMoreFiles = 1
221 return 0
216 return 0
222
217
@@ -241,7 +236,7 class BLTRParamReader(JRODataReader, ProcessingUnit):
241 def readNextBlock(self):
236 def readNextBlock(self):
242
237
243 while True:
238 while True:
244 if self.counter_records == self.nrecords:
239 if not self.online and self.counter_records == self.nrecords:
245 self.flagIsNewFile = 1
240 self.flagIsNewFile = 1
246 if not self.setNextFile():
241 if not self.setNextFile():
247 return 0
242 return 0
@@ -267,9 +262,9 class BLTRParamReader(JRODataReader, ProcessingUnit):
267 continue
262 continue
268 break
263 break
269
264
270 log.log('Reading Record No. {}/{} -> {}'.format(
265 log.log('Reading Record No. {} -> {}'.format(
271 self.counter_records,
266 self.counter_records,
272 self.nrecords,
267 # self.nrecords,
273 self.datatime.ctime()), 'BLTRParamReader')
268 self.datatime.ctime()), 'BLTRParamReader')
274
269
275 return 1
270 return 1
@@ -328,10 +323,12 class BLTRParamReader(JRODataReader, ProcessingUnit):
328
323
329 def readData(self):
324 def readData(self):
330 '''
325 '''
331 Reading and filtering data block record of BLTR rawdata file, filtering is according to status_value.
326 Reading and filtering data block record of BLTR rawdata file,
327 filtering is according to status_value.
332
328
333 Input:
329 Input:
334 status_value - Array data is set to NAN for values that are not equal to status_value
330 status_value - Array data is set to NAN for values that are not
331 equal to status_value
335
332
336 '''
333 '''
337 self.nchannels = int(self.nchannels)
334 self.nchannels = int(self.nchannels)
General Comments 0
You need to be logged in to leave comments. Login now