##// END OF EJS Templates
Fix bugs in madrigal module
Juan C. Espinoza -
r1073:9fc44081e2dc
parent child
Show More
@@ -306,6 +306,8 class MADReader(JRODataReader, ProcessingUnit):
306 dum = []
306 dum = []
307 if self.ext == '.txt':
307 if self.ext == '.txt':
308 dt = self.data[self.counter_records][:6].astype(int)
308 dt = self.data[self.counter_records][:6].astype(int)
309 if datetime.datetime(dt[0], dt[1], dt[2], dt[3], dt[4], dt[5]).date() > self.datatime.date():
310 self.flagDiscontinuousBlock = 1
309 self.datatime = datetime.datetime(dt[0], dt[1], dt[2], dt[3], dt[4], dt[5])
311 self.datatime = datetime.datetime(dt[0], dt[1], dt[2], dt[3], dt[4], dt[5])
310 while True:
312 while True:
311 dt = self.data[self.counter_records][:6].astype(int)
313 dt = self.data[self.counter_records][:6].astype(int)
@@ -318,8 +320,6 class MADReader(JRODataReader, ProcessingUnit):
318 break
320 break
319 continue
321 continue
320 self.intervals.add((datatime-self.datatime).seconds)
322 self.intervals.add((datatime-self.datatime).seconds)
321 if datatime.date() > self.datatime.date():
322 self.flagDiscontinuousBlock = 1
323 break
323 break
324 elif self.ext == '.hdf5':
324 elif self.ext == '.hdf5':
325 datatime = datetime.datetime.utcfromtimestamp(
325 datatime = datetime.datetime.utcfromtimestamp(
@@ -527,8 +527,17 class MADWriter(Operation):
527 heights = self.dataOut.heightList
527 heights = self.dataOut.heightList
528
528
529 if self.ext == '.dat':
529 if self.ext == '.dat':
530 invalid = numpy.isnan(self.dataOut.data_output)
530 for key, value in self.twoDDict.items():
531 self.dataOut.data_output[invalid] = self.missing
531 if isinstance(value, str):
532 data = getattr(self.dataOut, value)
533 invalid = numpy.isnan(data)
534 data[invalid] = self.missing
535 elif isinstance(value, (tuple, list)):
536 attr, key = value
537 data = getattr(self.dataOut, attr)
538 invalid = numpy.isnan(data)
539 data[invalid] = self.missing
540
532 out = {}
541 out = {}
533 for key, value in self.twoDDict.items():
542 for key, value in self.twoDDict.items():
534 key = key.lower()
543 key = key.lower()
@@ -586,7 +595,7 class MADWriter(Operation):
586 self.fp.append(rec)
595 self.fp.append(rec)
587 if self.ext == '.hdf5' and self.counter % 500 == 0 and self.counter > 0:
596 if self.ext == '.hdf5' and self.counter % 500 == 0 and self.counter > 0:
588 self.fp.dump()
597 self.fp.dump()
589 if self.counter % 10 == 0 and self.counter > 0:
598 if self.counter % 100 == 0 and self.counter > 0:
590 log.log(
599 log.log(
591 'Writing {} records'.format(
600 'Writing {} records'.format(
592 self.counter),
601 self.counter),
General Comments 0
You need to be logged in to leave comments. Login now