##// END OF EJS Templates
cambios para online offline
José Chávez -
r1019:42311705b9c8
parent child
Show More
@@ -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,9 +662,10 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 = "", ext = None, walk=True, set=None, startDate=None, endDate=None):
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
@@ -689,6 +689,8 class JRODataReader(JRODataIO):
689
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
@@ -789,6 +791,7 class JRODataReader(JRODataIO):
789 Excepciones:
791 Excepciones:
790 Si un determinado file no puede ser abierto
792 Si un determinado file no puede ser abierto
791 """
793 """
794
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())
@@ -1251,9 +1271,45 class JRODataReader(JRODataIO):
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"
1253
1273
1274
1254 if ext == None:
1275 if ext == None:
1255 ext = self.ext
1276 ext = self.ext
1256
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:])
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
@@ -1263,13 +1319,11 class JRODataReader(JRODataIO):
1263 ext=ext,
1319 ext=ext,
1264 walk=walk,
1320 walk=walk,
1265 startDate=startDate,
1321 startDate=startDate,
1266 endDate=endDate,
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
@@ -1310,6 +1364,7 class JRODataReader(JRODataIO):
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
@@ -1320,6 +1375,7 class JRODataReader(JRODataIO):
1320 self.startTime = startTime
1375 self.startTime = startTime
1321 self.endTime = endTime
1376 self.endTime = endTime
1322
1377
1378
1323 #Added-----------------
1379 #Added-----------------
1324 self.selBlocksize = blocksize
1380 self.selBlocksize = blocksize
1325 self.selBlocktime = blocktime
1381 self.selBlocktime = blocktime
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -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 = '2016/08/29'
30 startDate = '2010/08/29'
31 endDate = '2016/09/11'
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