@@ -722,6 +722,29 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
722 |
|
722 | |||
723 | return 0 |
|
723 | return 0 | |
724 |
|
724 | |||
|
725 | def waitDataBlock(self,pointer_location): | |||
|
726 | ||||
|
727 | currentPointer = pointer_location | |||
|
728 | ||||
|
729 | neededSize = self.processingHeaderObj.blockSize #+ self.basicHeaderSize | |||
|
730 | ||||
|
731 | for nTries in range( self.nTries ): | |||
|
732 | self.fp.close() | |||
|
733 | self.fp = open( self.filename, 'rb' ) | |||
|
734 | self.fp.seek( currentPointer ) | |||
|
735 | ||||
|
736 | self.fileSize = os.path.getsize( self.filename ) | |||
|
737 | currentSize = self.fileSize - currentPointer | |||
|
738 | ||||
|
739 | if ( currentSize >= neededSize ): | |||
|
740 | return 1 | |||
|
741 | ||||
|
742 | print "\tWaiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries+1) | |||
|
743 | time.sleep( self.delay ) | |||
|
744 | ||||
|
745 | return 0 | |||
|
746 | ||||
|
747 | ||||
725 | def __jumpToLastBlock(self): |
|
748 | def __jumpToLastBlock(self): | |
726 |
|
749 | |||
727 | if not(self.__isFirstTimeOnline): |
|
750 | if not(self.__isFirstTimeOnline): | |
@@ -1499,14 +1522,18 class VoltageReader(JRODataReader): | |||||
1499 | Exceptions: |
|
1522 | Exceptions: | |
1500 | Si un bloque leido no es un bloque valido |
|
1523 | Si un bloque leido no es un bloque valido | |
1501 | """ |
|
1524 | """ | |
1502 |
|
1525 | current_pointer_location = self.fp.tell() | ||
1503 | junk = numpy.fromfile( self.fp, self.dtype, self.blocksize ) |
|
1526 | junk = numpy.fromfile( self.fp, self.dtype, self.blocksize ) | |
1504 |
|
1527 | |||
1505 | try: |
|
1528 | try: | |
1506 | junk = junk.reshape( (self.processingHeaderObj.profilesPerBlock, self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels) ) |
|
1529 | junk = junk.reshape( (self.processingHeaderObj.profilesPerBlock, self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels) ) | |
1507 | except: |
|
1530 | except: | |
1508 | print "The read block (%3d) has not enough data" %self.nReadBlocks |
|
1531 | #print "The read block (%3d) has not enough data" %self.nReadBlocks | |
1509 |
|
|
1532 | ||
|
1533 | if self.waitDataBlock(pointer_location=current_pointer_location): | |||
|
1534 | junk = numpy.fromfile( self.fp, self.dtype, self.blocksize ) | |||
|
1535 | junk = junk.reshape( (self.processingHeaderObj.profilesPerBlock, self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels) ) | |||
|
1536 | # return 0 | |||
1510 |
|
1537 | |||
1511 | junk = numpy.transpose(junk, (2,0,1)) |
|
1538 | junk = numpy.transpose(junk, (2,0,1)) | |
1512 | self.datablock = junk['real'] + junk['imag']*1j |
|
1539 | self.datablock = junk['real'] + junk['imag']*1j |
General Comments 0
You need to be logged in to leave comments.
Login now