@@ -538,7 +538,7 class JRODataIO: | |||||
538 |
|
538 | |||
539 | class JRODataReader(JRODataIO): |
|
539 | class JRODataReader(JRODataIO): | |
540 |
|
540 | |||
541 |
|
541 | firstTime = True | ||
542 | online = 0 |
|
542 | online = 0 | |
543 |
|
543 | |||
544 | realtime = 0 |
|
544 | realtime = 0 | |
@@ -575,7 +575,7 class JRODataReader(JRODataIO): | |||||
575 |
|
575 | |||
576 | selBlocktime = None |
|
576 | selBlocktime = None | |
577 |
|
577 | |||
578 |
|
578 | onlineWithDate = False | ||
579 | def __init__(self): |
|
579 | def __init__(self): | |
580 |
|
580 | |||
581 | """ |
|
581 | """ | |
@@ -609,7 +609,6 class JRODataReader(JRODataIO): | |||||
609 | expLabel='', |
|
609 | expLabel='', | |
610 | ext='.r', |
|
610 | ext='.r', | |
611 | walk=True): |
|
611 | walk=True): | |
612 |
|
||||
613 | self.filenameList = [] |
|
612 | self.filenameList = [] | |
614 | self.datetimeList = [] |
|
613 | self.datetimeList = [] | |
615 |
|
614 | |||
@@ -663,32 +662,35 class JRODataReader(JRODataIO): | |||||
663 | self.filenameList = filenameList |
|
662 | self.filenameList = filenameList | |
664 | self.datetimeList = datetimeList |
|
663 | self.datetimeList = datetimeList | |
665 |
|
664 | |||
|
665 | ||||
666 | return pathList, filenameList |
|
666 | return pathList, filenameList | |
667 |
|
667 | |||
668 |
def __searchFilesOnLine(self, path, expLabel |
|
668 | def __searchFilesOnLine(self, path, expLabel="", ext=None, walk=True, set=None, startDate=None, startTime=None): | |
669 |
|
669 | |||
670 | """ |
|
670 | """ | |
671 | Busca el ultimo archivo de la ultima carpeta (determinada o no por startDateTime) y |
|
671 | Busca el ultimo archivo de la ultima carpeta (determinada o no por startDateTime) y | |
672 | devuelve el archivo encontrado ademas de otros datos. |
|
672 | devuelve el archivo encontrado ademas de otros datos. | |
673 |
|
||||
674 | Input: |
|
|||
675 | path : carpeta donde estan contenidos los files que contiene data |
|
|||
676 |
|
||||
677 | expLabel : Nombre del subexperimento (subfolder) |
|
|||
678 |
|
||||
679 | ext : extension de los files |
|
|||
680 |
|
||||
681 | walk : Si es habilitado no realiza busquedas dentro de los subdirectorios (doypath) |
|
|||
682 |
|
||||
683 | Return: |
|
|||
684 | directory : eL directorio donde esta el file encontrado |
|
|||
685 | filename : el ultimo file de una determinada carpeta |
|
|||
686 | year : el anho |
|
|||
687 | doy : el numero de dia del anho |
|
|||
688 | set : el set del archivo |
|
|||
689 |
|
673 | |||
|
674 | Input: | |||
|
675 | path : carpeta donde estan contenidos los files que contiene data | |||
|
676 | ||||
|
677 | expLabel : Nombre del subexperimento (subfolder) | |||
|
678 | ||||
|
679 | ext : extension de los files | |||
|
680 | ||||
|
681 | walk : Si es habilitado no realiza busquedas dentro de los subdirectorios (doypath) | |||
|
682 | ||||
|
683 | Return: | |||
|
684 | directory : eL directorio donde esta el file encontrado | |||
|
685 | filename : el ultimo file de una determinada carpeta | |||
|
686 | year : el anho | |||
|
687 | doy : el numero de dia del anho | |||
|
688 | set : el set del archivo | |||
|
689 | ||||
690 |
|
690 | |||
691 | """ |
|
691 | """ | |
|
692 | pathList = None | |||
|
693 | filenameList = None | |||
692 | if not os.path.isdir(path): |
|
694 | if not os.path.isdir(path): | |
693 | return None, None, None, None, None, None |
|
695 | return None, None, None, None, None, None | |
694 |
|
696 | |||
@@ -735,7 +737,7 class JRODataReader(JRODataIO): | |||||
735 | year = int( filename[1:5] ) |
|
737 | year = int( filename[1:5] ) | |
736 | doy = int( filename[5:8] ) |
|
738 | doy = int( filename[5:8] ) | |
737 | set = int( filename[8:11] ) |
|
739 | set = int( filename[8:11] ) | |
738 |
|
740 | |||
739 | return fullpath, foldercounter, filename, year, doy, set |
|
741 | return fullpath, foldercounter, filename, year, doy, set | |
740 |
|
742 | |||
741 | def __setNextFileOffline(self): |
|
743 | def __setNextFileOffline(self): | |
@@ -746,7 +748,7 class JRODataReader(JRODataIO): | |||||
746 | idFile += 1 |
|
748 | idFile += 1 | |
747 | if not(idFile < len(self.filenameList)): |
|
749 | if not(idFile < len(self.filenameList)): | |
748 | self.flagNoMoreFiles = 1 |
|
750 | self.flagNoMoreFiles = 1 | |
749 |
|
|
751 | # print "[Reading] No more Files" | |
750 | return 0 |
|
752 | return 0 | |
751 |
|
753 | |||
752 | filename = self.filenameList[idFile] |
|
754 | filename = self.filenameList[idFile] | |
@@ -764,31 +766,32 class JRODataReader(JRODataIO): | |||||
764 | self.fileSize = fileSize |
|
766 | self.fileSize = fileSize | |
765 | self.fp = fp |
|
767 | self.fp = fp | |
766 |
|
768 | |||
767 |
# |
|
769 | #print "[Reading] Setting the file: %s"%self.filename | |
768 |
|
770 | |||
769 | return 1 |
|
771 | return 1 | |
770 |
|
772 | |||
771 | def __setNextFileOnline(self): |
|
773 | def __setNextFileOnline(self): | |
772 | """ |
|
774 | """ | |
773 | Busca el siguiente file que tenga suficiente data para ser leida, dentro de un folder especifico, si |
|
775 | Busca el siguiente file que tenga suficiente data para ser leida, dentro de un folder especifico, si | |
774 | no encuentra un file valido espera un tiempo determinado y luego busca en los posibles n files |
|
776 | no encuentra un file valido espera un tiempo determinado y luego busca en los posibles n files | |
775 | siguientes. |
|
777 | siguientes. | |
|
778 | ||||
|
779 | Affected: | |||
|
780 | self.flagIsNewFile | |||
|
781 | self.filename | |||
|
782 | self.fileSize | |||
|
783 | self.fp | |||
|
784 | self.set | |||
|
785 | self.flagNoMoreFiles | |||
|
786 | ||||
|
787 | Return: | |||
|
788 | 0 : si luego de una busqueda del siguiente file valido este no pudo ser encontrado | |||
|
789 | 1 : si el file fue abierto con exito y esta listo a ser leido | |||
776 |
|
790 | |||
777 |
|
|
791 | Excepciones: | |
778 | self.flagIsNewFile |
|
792 | Si un determinado file no puede ser abierto | |
779 | self.filename |
|
793 | """ | |
780 | self.fileSize |
|
|||
781 | self.fp |
|
|||
782 | self.set |
|
|||
783 | self.flagNoMoreFiles |
|
|||
784 |
|
||||
785 | Return: |
|
|||
786 | 0 : si luego de una busqueda del siguiente file valido este no pudo ser encontrado |
|
|||
787 | 1 : si el file fue abierto con exito y esta listo a ser leido |
|
|||
788 |
|
794 | |||
789 | Excepciones: |
|
|||
790 | Si un determinado file no puede ser abierto |
|
|||
791 | """ |
|
|||
792 | nFiles = 0 |
|
795 | nFiles = 0 | |
793 | fileOk_flag = False |
|
796 | fileOk_flag = False | |
794 | firstTime_flag = True |
|
797 | firstTime_flag = True | |
@@ -861,13 +864,34 class JRODataReader(JRODataIO): | |||||
861 | def setNextFile(self): |
|
864 | def setNextFile(self): | |
862 | if self.fp != None: |
|
865 | if self.fp != None: | |
863 | self.fp.close() |
|
866 | self.fp.close() | |
864 |
|
||||
865 | if self.online: |
|
867 | if self.online: | |
866 | newFile = self.__setNextFileOnline() |
|
868 | newFile = self.__setNextFileOnline() | |
867 | else: |
|
869 | else: | |
868 | newFile = self.__setNextFileOffline() |
|
870 | newFile = self.__setNextFileOffline() | |
869 |
|
||||
870 | if not(newFile): |
|
871 | if not(newFile): | |
|
872 | if self.onlineWithDate is True: | |||
|
873 | self.onlineWithDate=False | |||
|
874 | self.online = True | |||
|
875 | self.firstTime = False | |||
|
876 | self.setup( | |||
|
877 | path=self.path, | |||
|
878 | startDate=self.startDate, | |||
|
879 | endDate=self.endDate, | |||
|
880 | startTime=self.startTime , | |||
|
881 | endTime=self.endTime, | |||
|
882 | set=self.set, | |||
|
883 | expLabel=self.expLabel, | |||
|
884 | ext=self.ext, | |||
|
885 | online=self.online, | |||
|
886 | delay=self.delay, | |||
|
887 | walk=self.walk, | |||
|
888 | getblock=self.getblock, | |||
|
889 | nTxs=self.nTxs, | |||
|
890 | realtime=self.realtime, | |||
|
891 | blocksize=self.blocksize, | |||
|
892 | blocktime=self.blocktime | |||
|
893 | ) | |||
|
894 | return 1 | |||
871 | print '[Reading] No more files to read' |
|
895 | print '[Reading] No more files to read' | |
872 | return 0 |
|
896 | return 0 | |
873 |
|
897 | |||
@@ -1021,12 +1045,9 class JRODataReader(JRODataIO): | |||||
1021 | while True: |
|
1045 | while True: | |
1022 | if not(self.__setNewBlock()): |
|
1046 | if not(self.__setNewBlock()): | |
1023 | return 0 |
|
1047 | return 0 | |
1024 |
|
||||
1025 | if not(self.readBlock()): |
|
1048 | if not(self.readBlock()): | |
1026 | return 0 |
|
1049 | return 0 | |
1027 |
|
||||
1028 | self.getBasicHeader() |
|
1050 | self.getBasicHeader() | |
1029 |
|
||||
1030 | if not isTimeInRange(self.dataOut.datatime.time(), self.startTime, self.endTime): |
|
1051 | if not isTimeInRange(self.dataOut.datatime.time(), self.startTime, self.endTime): | |
1031 |
|
1052 | |||
1032 | print "[Reading] Block No. %d/%d -> %s [Skipping]" %(self.nReadBlocks, |
|
1053 | print "[Reading] Block No. %d/%d -> %s [Skipping]" %(self.nReadBlocks, | |
@@ -1035,7 +1056,6 class JRODataReader(JRODataIO): | |||||
1035 | continue |
|
1056 | continue | |
1036 |
|
1057 | |||
1037 | break |
|
1058 | break | |
1038 |
|
||||
1039 | print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, |
|
1059 | print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks, | |
1040 | self.processingHeaderObj.dataBlocksPerFile, |
|
1060 | self.processingHeaderObj.dataBlocksPerFile, | |
1041 | self.dataOut.datatime.ctime()) |
|
1061 | self.dataOut.datatime.ctime()) | |
@@ -1250,26 +1270,60 class JRODataReader(JRODataIO): | |||||
1250 |
|
1270 | |||
1251 | if path == None: |
|
1271 | if path == None: | |
1252 | raise ValueError, "[Reading] The path is not valid" |
|
1272 | raise ValueError, "[Reading] The path is not valid" | |
|
1273 | ||||
1253 |
|
1274 | |||
1254 | if ext == None: |
|
1275 | if ext == None: | |
1255 | ext = self.ext |
|
1276 | ext = self.ext | |
|
1277 | ||||
|
1278 | self.path = path | |||
|
1279 | self.startDate = startDate | |||
|
1280 | self.endDate = endDate | |||
|
1281 | self.startTime = startTime | |||
|
1282 | self.endTime = endTime | |||
|
1283 | self.set = set | |||
|
1284 | self.expLabel = expLabel | |||
|
1285 | self.ext = ext | |||
|
1286 | self.online = online | |||
|
1287 | self.delay = delay | |||
|
1288 | self.walk = walk | |||
|
1289 | self.getblock = getblock | |||
|
1290 | self.nTxs = nTxs | |||
|
1291 | self.realtime = realtime | |||
|
1292 | self.blocksize = blocksize | |||
|
1293 | self.blocktime = blocktime | |||
|
1294 | ||||
|
1295 | ||||
|
1296 | if self.firstTime is True: | |||
|
1297 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |||
|
1298 | startTime=startTime, endTime=endTime, | |||
|
1299 | set=set, expLabel=expLabel, ext=ext, | |||
|
1300 | walk=walk) | |||
|
1301 | filenameList = filenameList[:-1] | |||
|
1302 | ||||
|
1303 | if pathList is not None and filenameList is not None and online: | |||
|
1304 | self.onlineWithDate = True | |||
|
1305 | online = False | |||
|
1306 | self.fileIndex = -1 | |||
|
1307 | self.pathList = pathList | |||
|
1308 | self.filenameList = filenameList | |||
|
1309 | file_name = os.path.basename(filenameList[-1]) | |||
|
1310 | basename, ext = os.path.splitext(file_name) | |||
|
1311 | last_set = int(basename[-3:]) | |||
1256 |
|
1312 | |||
1257 | if online: |
|
1313 | if online: | |
1258 | print "[Reading] Searching files in online mode..." |
|
1314 | print "[Reading] Searching files in online mode..." | |
1259 |
|
1315 | |||
1260 |
for nTries in range( |
|
1316 | for nTries in range(self.nTries): | |
1261 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, |
|
1317 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, | |
1262 | expLabel=expLabel, |
|
1318 | expLabel=expLabel, | |
1263 | ext=ext, |
|
1319 | ext=ext, | |
1264 | walk=walk, |
|
1320 | walk=walk, | |
1265 | startDate=startDate, |
|
1321 | startDate=startDate, | |
1266 |
|
|
1322 | startTime=startTime, | |
1267 | startTime=startTime, endTime=endTime, |
|
|||
1268 | set=set) |
|
1323 | set=set) | |
1269 |
|
1324 | |||
1270 | if fullpath: |
|
1325 | if fullpath: | |
1271 | break |
|
1326 | break | |
1272 |
|
||||
1273 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) |
|
1327 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) | |
1274 | sleep( self.delay ) |
|
1328 | sleep( self.delay ) | |
1275 |
|
1329 | |||
@@ -1283,7 +1337,7 class JRODataReader(JRODataIO): | |||||
1283 | self.path = path |
|
1337 | self.path = path | |
1284 | self.foldercounter = foldercounter |
|
1338 | self.foldercounter = foldercounter | |
1285 | last_set = None |
|
1339 | last_set = None | |
1286 |
|
1340 | |||
1287 | else: |
|
1341 | else: | |
1288 | print "[Reading] Searching files in offline mode ..." |
|
1342 | print "[Reading] Searching files in offline mode ..." | |
1289 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, |
|
1343 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |
@@ -1309,7 +1363,8 class JRODataReader(JRODataIO): | |||||
1309 | file_name = os.path.basename(filenameList[-1]) |
|
1363 | file_name = os.path.basename(filenameList[-1]) | |
1310 | basename, ext = os.path.splitext(file_name) |
|
1364 | basename, ext = os.path.splitext(file_name) | |
1311 | last_set = int(basename[-3:]) |
|
1365 | last_set = int(basename[-3:]) | |
1312 |
|
1366 | |||
|
1367 | ||||
1313 | self.online = online |
|
1368 | self.online = online | |
1314 | self.realtime = realtime |
|
1369 | self.realtime = realtime | |
1315 | self.delay = delay |
|
1370 | self.delay = delay | |
@@ -1319,6 +1374,7 class JRODataReader(JRODataIO): | |||||
1319 | self.nTxs = nTxs |
|
1374 | self.nTxs = nTxs | |
1320 | self.startTime = startTime |
|
1375 | self.startTime = startTime | |
1321 | self.endTime = endTime |
|
1376 | self.endTime = endTime | |
|
1377 | ||||
1322 |
|
1378 | |||
1323 | #Added----------------- |
|
1379 | #Added----------------- | |
1324 | self.selBlocksize = blocksize |
|
1380 | self.selBlocksize = blocksize | |
@@ -1339,7 +1395,7 class JRODataReader(JRODataIO): | |||||
1339 | return |
|
1395 | return | |
1340 |
|
1396 | |||
1341 | # self.getBasicHeader() |
|
1397 | # self.getBasicHeader() | |
1342 |
|
1398 | |||
1343 | if last_set != None: |
|
1399 | if last_set != None: | |
1344 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock |
|
1400 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock | |
1345 | return |
|
1401 | return | |
@@ -1360,7 +1416,7 class JRODataReader(JRODataIO): | |||||
1360 |
|
1416 | |||
1361 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs |
|
1417 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs | |
1362 |
|
1418 | |||
1363 | # self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs |
|
1419 | # self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs | |
1364 |
|
1420 | |||
1365 |
|
1421 | |||
1366 | def getFirstHeader(self): |
|
1422 | def getFirstHeader(self): | |
@@ -1415,7 +1471,7 class JRODataReader(JRODataIO): | |||||
1415 |
|
1471 | |||
1416 | if not(self.isConfig): |
|
1472 | if not(self.isConfig): | |
1417 |
|
1473 | |||
1418 | # self.dataOut = dataOut |
|
1474 | # self.dataOut = dataOut | |
1419 | self.setup(**kwargs) |
|
1475 | self.setup(**kwargs) | |
1420 | self.isConfig = True |
|
1476 | self.isConfig = True | |
1421 |
|
1477 | |||
@@ -1538,7 +1594,7 class JRODataWriter(JRODataIO): | |||||
1538 | None |
|
1594 | None | |
1539 | """ |
|
1595 | """ | |
1540 |
|
1596 | |||
1541 | # CALCULAR PARAMETROS |
|
1597 | # CALCULAR PARAMETROS | |
1542 |
|
1598 | |||
1543 | sizeLongHeader = self.systemHeaderObj.size + self.radarControllerHeaderObj.size + self.processingHeaderObj.size |
|
1599 | sizeLongHeader = self.systemHeaderObj.size + self.radarControllerHeaderObj.size + self.processingHeaderObj.size | |
1544 | self.basicHeaderObj.size = self.basicHeaderSize + sizeLongHeader |
|
1600 | self.basicHeaderObj.size = self.basicHeaderSize + sizeLongHeader |
@@ -177,13 +177,13 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
177 |
|
177 | |||
178 | def getBlockDimension(self): |
|
178 | def getBlockDimension(self): | |
179 | """ |
|
179 | """ | |
180 | Obtiene la cantidad de puntos a leer por cada bloque de datos |
|
180 | Obtiene la cantidad de puntos a leer por cada bloque de datos | |
181 |
|
181 | |||
182 | Affected: |
|
182 | Affected: | |
183 | self.blocksize |
|
183 | self.blocksize | |
184 |
|
184 | |||
185 | Return: |
|
185 | Return: | |
186 | None |
|
186 | None | |
187 | """ |
|
187 | """ | |
188 | pts2read = self.processingHeaderObj.profilesPerBlock * self.processingHeaderObj.nHeights * self.systemHeaderObj.nChannels |
|
188 | pts2read = self.processingHeaderObj.profilesPerBlock * self.processingHeaderObj.nHeights * self.systemHeaderObj.nChannels | |
189 | self.blocksize = pts2read |
|
189 | self.blocksize = pts2read | |
@@ -191,26 +191,26 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
191 |
|
191 | |||
192 | def readBlock(self): |
|
192 | def readBlock(self): | |
193 | """ |
|
193 | """ | |
194 | readBlock lee el bloque de datos desde la posicion actual del puntero del archivo |
|
194 | readBlock lee el bloque de datos desde la posicion actual del puntero del archivo | |
195 | (self.fp) y actualiza todos los parametros relacionados al bloque de datos |
|
195 | (self.fp) y actualiza todos los parametros relacionados al bloque de datos | |
196 | (metadata + data). La data leida es almacenada en el buffer y el contador del buffer |
|
196 | (metadata + data). La data leida es almacenada en el buffer y el contador del buffer | |
197 | es seteado a 0 |
|
197 | es seteado a 0 | |
198 |
|
||||
199 | Inputs: |
|
|||
200 | None |
|
|||
201 |
|
198 | |||
202 | Return: |
|
199 | Inputs: | |
203 | None |
|
200 | None | |
204 |
|
201 | |||
205 |
|
|
202 | Return: | |
206 | self.profileIndex |
|
203 | None | |
207 | self.datablock |
|
|||
208 | self.flagIsNewFile |
|
|||
209 | self.flagIsNewBlock |
|
|||
210 | self.nTotalBlocks |
|
|||
211 |
|
204 | |||
212 | Exceptions: |
|
205 | Affected: | |
213 | Si un bloque leido no es un bloque valido |
|
206 | self.profileIndex | |
|
207 | self.datablock | |||
|
208 | self.flagIsNewFile | |||
|
209 | self.flagIsNewBlock | |||
|
210 | self.nTotalBlocks | |||
|
211 | ||||
|
212 | Exceptions: | |||
|
213 | Si un bloque leido no es un bloque valido | |||
214 | """ |
|
214 | """ | |
215 | current_pointer_location = self.fp.tell() |
|
215 | current_pointer_location = self.fp.tell() | |
216 | junk = numpy.fromfile( self.fp, self.dtype, self.blocksize ) |
|
216 | junk = numpy.fromfile( self.fp, self.dtype, self.blocksize ) | |
@@ -303,39 +303,39 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
303 |
|
303 | |||
304 | def getData(self): |
|
304 | def getData(self): | |
305 | """ |
|
305 | """ | |
306 | getData obtiene una unidad de datos del buffer de lectura, un perfil, y la copia al objeto self.dataOut |
|
306 | getData obtiene una unidad de datos del buffer de lectura, un perfil, y la copia al objeto self.dataOut | |
307 | del tipo "Voltage" con todos los parametros asociados a este (metadata). cuando no hay datos |
|
307 | del tipo "Voltage" con todos los parametros asociados a este (metadata). cuando no hay datos | |
308 | en el buffer de lectura es necesario hacer una nueva lectura de los bloques de datos usando |
|
308 | en el buffer de lectura es necesario hacer una nueva lectura de los bloques de datos usando | |
309 | "readNextBlock" |
|
309 | "readNextBlock" | |
310 |
|
||||
311 | Ademas incrementa el contador del buffer "self.profileIndex" en 1. |
|
|||
312 |
|
||||
313 | Return: |
|
|||
314 |
|
||||
315 | Si el flag self.getByBlock ha sido seteado el bloque completo es copiado a self.dataOut y el self.profileIndex |
|
|||
316 | es igual al total de perfiles leidos desde el archivo. |
|
|||
317 |
|
||||
318 | Si self.getByBlock == False: |
|
|||
319 |
|
310 | |||
320 | self.dataOut.data = buffer[:, thisProfile, :] |
|
311 | Ademas incrementa el contador del buffer "self.profileIndex" en 1. | |
321 |
|
||||
322 | shape = [nChannels, nHeis] |
|
|||
323 |
|
||||
324 | Si self.getByBlock == True: |
|
|||
325 |
|
312 | |||
326 | self.dataOut.data = buffer[:, :, :] |
|
313 | Return: | |
327 |
|
||||
328 | shape = [nChannels, nProfiles, nHeis] |
|
|||
329 |
|
314 | |||
330 | Variables afectadas: |
|
315 | Si el flag self.getByBlock ha sido seteado el bloque completo es copiado a self.dataOut y el self.profileIndex | |
331 | self.dataOut |
|
316 | es igual al total de perfiles leidos desde el archivo. | |
332 | self.profileIndex |
|
|||
333 |
|
317 | |||
334 | Affected: |
|
318 | Si self.getByBlock == False: | |
335 |
|
|
319 | ||
336 | self.profileIndex |
|
320 | self.dataOut.data = buffer[:, thisProfile, :] | |
337 | self.flagDiscontinuousBlock |
|
321 | ||
338 | self.flagIsNewBlock |
|
322 | shape = [nChannels, nHeis] | |
|
323 | ||||
|
324 | Si self.getByBlock == True: | |||
|
325 | ||||
|
326 | self.dataOut.data = buffer[:, :, :] | |||
|
327 | ||||
|
328 | shape = [nChannels, nProfiles, nHeis] | |||
|
329 | ||||
|
330 | Variables afectadas: | |||
|
331 | self.dataOut | |||
|
332 | self.profileIndex | |||
|
333 | ||||
|
334 | Affected: | |||
|
335 | self.dataOut | |||
|
336 | self.profileIndex | |||
|
337 | self.flagDiscontinuousBlock | |||
|
338 | self.flagIsNewBlock | |||
339 | """ |
|
339 | """ | |
340 |
|
340 | |||
341 | if self.flagNoMoreFiles: |
|
341 | if self.flagNoMoreFiles: | |
@@ -362,10 +362,10 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
362 | if not self.getByBlock: |
|
362 | if not self.getByBlock: | |
363 |
|
363 | |||
364 | """ |
|
364 | """ | |
365 | Return profile by profile |
|
365 | Return profile by profile | |
366 |
|
366 | |||
367 | If nTxs > 1 then one profile is divided by nTxs and number of total |
|
367 | If nTxs > 1 then one profile is divided by nTxs and number of total | |
368 | blocks is increased by nTxs (nProfiles *= nTxs) |
|
368 | blocks is increased by nTxs (nProfiles *= nTxs) | |
369 | """ |
|
369 | """ | |
370 | self.dataOut.flagDataAsBlock = False |
|
370 | self.dataOut.flagDataAsBlock = False | |
371 | self.dataOut.data = self.datablock[:,self.profileIndex,:] |
|
371 | self.dataOut.data = self.datablock[:,self.profileIndex,:] | |
@@ -373,26 +373,26 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
373 |
|
373 | |||
374 | self.profileIndex += 1 |
|
374 | self.profileIndex += 1 | |
375 |
|
375 | |||
376 | # elif self.selBlocksize==None or self.selBlocksize==self.dataOut.nProfiles: |
|
376 | # elif self.selBlocksize==None or self.selBlocksize==self.dataOut.nProfiles: | |
377 | # """ |
|
377 | # """ | |
378 | # Return all block |
|
378 | # Return all block | |
379 | # """ |
|
379 | # """ | |
380 | # self.dataOut.flagDataAsBlock = True |
|
380 | # self.dataOut.flagDataAsBlock = True | |
381 | # self.dataOut.data = self.datablock |
|
381 | # self.dataOut.data = self.datablock | |
382 | # self.dataOut.profileIndex = self.dataOut.nProfiles - 1 |
|
382 | # self.dataOut.profileIndex = self.dataOut.nProfiles - 1 | |
383 | # |
|
383 | # | |
384 | # self.profileIndex = self.dataOut.nProfiles |
|
384 | # self.profileIndex = self.dataOut.nProfiles | |
385 |
|
385 | |||
386 | else: |
|
386 | else: | |
387 | """ |
|
387 | """ | |
388 | Return a block |
|
388 | Return a block | |
389 | """ |
|
389 | """ | |
390 | if self.selBlocksize == None: self.selBlocksize = self.dataOut.nProfiles |
|
390 | if self.selBlocksize == None: self.selBlocksize = self.dataOut.nProfiles | |
391 | if self.selBlocktime != None: |
|
391 | if self.selBlocktime != None: | |
392 | if self.dataOut.nCohInt is not None: |
|
392 | if self.dataOut.nCohInt is not None: | |
393 | nCohInt = self.dataOut.nCohInt |
|
393 | nCohInt = self.dataOut.nCohInt | |
394 | else: |
|
394 | else: | |
395 |
nCohInt = 1 |
|
395 | nCohInt = 1 | |
396 | self.selBlocksize = int(self.dataOut.nProfiles*round(self.selBlocktime/(nCohInt*self.dataOut.ippSeconds*self.dataOut.nProfiles))) |
|
396 | self.selBlocksize = int(self.dataOut.nProfiles*round(self.selBlocktime/(nCohInt*self.dataOut.ippSeconds*self.dataOut.nProfiles))) | |
397 |
|
397 | |||
398 | self.dataOut.data = self.datablock[:,self.profileIndex:self.profileIndex+self.selBlocksize,:] |
|
398 | self.dataOut.data = self.datablock[:,self.profileIndex:self.profileIndex+self.selBlocksize,:] | |
@@ -429,7 +429,7 class VoltageReader(JRODataReader, ProcessingUnit): | |||||
429 | self.getBasicHeader() |
|
429 | self.getBasicHeader() | |
430 |
|
430 | |||
431 | self.dataOut.realtime = self.online |
|
431 | self.dataOut.realtime = self.online | |
432 |
|
432 | |||
433 | return self.dataOut.data |
|
433 | return self.dataOut.data | |
434 |
|
434 | |||
435 | class VoltageWriter(JRODataWriter, Operation): |
|
435 | class VoltageWriter(JRODataWriter, Operation): |
@@ -168,13 +168,13 class Remote(Thread): | |||||
168 | return 0 |
|
168 | return 0 | |
169 |
|
169 | |||
170 | self.mutex.acquire() |
|
170 | self.mutex.acquire() | |
171 | # init = time.time() |
|
171 | # init = time.time() | |
172 | # |
|
172 | # | |
173 | # while(self.bussy): |
|
173 | # while(self.bussy): | |
174 | # sleep(0.1) |
|
174 | # sleep(0.1) | |
175 | # if time.time() - init > 2*self.period: |
|
175 | # if time.time() - init > 2*self.period: | |
176 | # return 0 |
|
176 | # return 0 | |
177 |
|
177 | |||
178 | self.fileList = fileList |
|
178 | self.fileList = fileList | |
179 | self.mutex.release() |
|
179 | self.mutex.release() | |
180 | return 1 |
|
180 | return 1 | |
@@ -198,7 +198,7 class Remote(Thread): | |||||
198 | if self.stopFlag: |
|
198 | if self.stopFlag: | |
199 | break |
|
199 | break | |
200 |
|
200 | |||
201 | # self.bussy = True |
|
201 | # self.bussy = True | |
202 | self.mutex.acquire() |
|
202 | self.mutex.acquire() | |
203 |
|
203 | |||
204 | print "[Remote Server] Opening %s" %self.__server |
|
204 | print "[Remote Server] Opening %s" %self.__server | |
@@ -623,6 +623,7 class SendToServer(ProcessingUnit): | |||||
623 | filenameList = glob.glob1(thisFolder, '*%s' %self.ext) |
|
623 | filenameList = glob.glob1(thisFolder, '*%s' %self.ext) | |
624 |
|
624 | |||
625 | if len(filenameList) < 1: |
|
625 | if len(filenameList) < 1: | |
|
626 | ||||
626 | continue |
|
627 | continue | |
627 |
|
628 | |||
628 | for thisFile in filenameList: |
|
629 | for thisFile in filenameList: |
@@ -18,7 +18,7 controllerObj.setup(id = '002', name='script02', description="JASMET Meteor Dete | |||||
18 | # path = '/mnt/jars/2016_08/NOCHE' |
|
18 | # path = '/mnt/jars/2016_08/NOCHE' | |
19 | # path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/DIA' |
|
19 | # path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/DIA' | |
20 | # path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/NOCHE' |
|
20 | # path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/NOCHE' | |
21 | path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/DIA' |
|
21 | path = '/home/nanosat/data/jasmet' | |
22 |
|
22 | |||
23 | #Path para los graficos |
|
23 | #Path para los graficos | |
24 | pathfig = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/graphics') |
|
24 | pathfig = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/graphics') | |
@@ -27,8 +27,8 pathfig = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/graphics') | |||||
27 | pathfile = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/meteor') |
|
27 | pathfile = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/meteor') | |
28 |
|
28 | |||
29 | #Fechas para busqueda de archivos |
|
29 | #Fechas para busqueda de archivos | |
30 |
startDate = '201 |
|
30 | startDate = '2010/08/29' | |
31 |
endDate = '201 |
|
31 | endDate = '2017/09/11' | |
32 | #Horas para busqueda de archivos |
|
32 | #Horas para busqueda de archivos | |
33 | startTime = '00:00:00' |
|
33 | startTime = '00:00:00' | |
34 | endTime = '23:59:59' |
|
34 | endTime = '23:59:59' | |
@@ -60,38 +60,40 opObj00.addParameter(name='channelList', value='0,1,2,3,4', format='intlist') | |||||
60 | opObj01 = procUnitConfObj0.addOperation(name='setRadarFrequency') |
|
60 | opObj01 = procUnitConfObj0.addOperation(name='setRadarFrequency') | |
61 | opObj01.addParameter(name='frequency', value='30.e6', format='float') |
|
61 | opObj01.addParameter(name='frequency', value='30.e6', format='float') | |
62 |
|
62 | |||
63 | opObj01 = procUnitConfObj0.addOperation(name='interpolateHeights') |
|
63 | # opObj01 = procUnitConfObj0.addOperation(name='interpolateHeights') | |
64 | opObj01.addParameter(name='topLim', value='73', format='int') |
|
64 | # opObj01.addParameter(name='topLim', value='73', format='int') | |
65 | opObj01.addParameter(name='botLim', value='71', format='int') |
|
65 | # opObj01.addParameter(name='botLim', value='71', format='int') | |
66 |
|
66 | |||
67 | opObj02 = procUnitConfObj0.addOperation(name='Decoder', optype='other') |
|
67 | opObj02 = procUnitConfObj0.addOperation(name='Decoder', optype='other') | |
68 |
|
68 | |||
69 | opObj03 = procUnitConfObj0.addOperation(name='CohInt', optype='other') |
|
69 | opObj03 = procUnitConfObj0.addOperation(name='CohInt', optype='other') | |
70 | opObj03.addParameter(name='n', value='2', format='int') |
|
70 | opObj03.addParameter(name='n', value='2', format='int') | |
71 |
|
71 | |||
|
72 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObj0.getId()) | |||
|
73 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |||
|
74 | opObj11.addParameter(name='id', value='237', format='int') | |||
|
75 | opObj11.addParameter(name='xmin', value='9.0', format='float') | |||
|
76 | opObj11.addParameter(name='xmax', value='16.0', format='float') | |||
|
77 | opObj11.addParameter(name='zmin', value='15.0', format='float') | |||
|
78 | opObj11.addParameter(name='zmax', value='50.0', format='float') | |||
|
79 | ||||
72 | #--------------------------- Parameters Processing Unit ------------------------------------ |
|
80 | #--------------------------- Parameters Processing Unit ------------------------------------ | |
73 |
|
81 | |||
74 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj0.getId()) |
|
82 | # procUnitConfObj1 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj0.getId()) | |
75 | # |
|
83 | # # | |
76 | opObj10 = procUnitConfObj1.addOperation(name='SMDetection', optype='other') |
|
84 | # opObj10 = procUnitConfObj1.addOperation(name='SMDetection', optype='other') | |
77 | opObj10.addParameter(name='azimuth', value='45', format='float') |
|
85 | # opObj10.addParameter(name='azimuth', value='45', format='float') | |
78 | opObj10.addParameter(name='hmin', value='60', format='float') |
|
86 | # opObj10.addParameter(name='hmin', value='60', format='float') | |
79 | opObj10.addParameter(name='hmax', value='120', format='float') |
|
87 | # opObj10.addParameter(name='hmax', value='120', format='float') | |
80 |
|
88 | |||
81 | opObj12 = procUnitConfObj1.addOperation(name='ParamWriter', optype='other') |
|
89 | # opObj12 = procUnitConfObj1.addOperation(name='ParamWriter', optype='other') | |
82 | opObj12.addParameter(name='path', value=pathfile) |
|
90 | # opObj12.addParameter(name='path', value=pathfile) | |
83 | opObj12.addParameter(name='blocksPerFile', value='1000', format='int') |
|
91 | # opObj12.addParameter(name='blocksPerFile', value='1000', format='int') | |
84 | opObj12.addParameter(name='metadataList',value='type,heightList,paramInterval,timeZone',format='list') |
|
92 | # opObj12.addParameter(name='metadataList',value='type,heightList,paramInterval,timeZone',format='list') | |
85 | opObj12.addParameter(name='dataList',value='data_param,utctime',format='list') |
|
93 | # opObj12.addParameter(name='dataList',value='data_param,utctime',format='list') | |
86 | opObj12.addParameter(name='mode',value='2',format='int') |
|
94 | # opObj12.addParameter(name='mode',value='2',format='int') | |
87 |
|
95 | |||
88 | #-------------------------------------------------------------------------------------------------- |
|
96 | #-------------------------------------------------------------------------------------------------- | |
89 |
|
||||
90 | print "Escribiendo el archivo XML" |
|
|||
91 | controllerObj.writeXml("JASMET02.xml") |
|
|||
92 | print "Leyendo el archivo XML" |
|
|||
93 | controllerObj.readXml("JASMET02.xml") |
|
|||
94 |
|
||||
95 | controllerObj.createObjects() |
|
97 | controllerObj.createObjects() | |
96 | controllerObj.connectObjects() |
|
98 | controllerObj.connectObjects() | |
97 | controllerObj.run() No newline at end of file |
|
99 | controllerObj.run() |
General Comments 0
You need to be logged in to leave comments.
Login now