##// 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 539 class JRODataReader(JRODataIO):
540 540
541
541 firstTime = True
542 542 online = 0
543 543
544 544 realtime = 0
@@ -575,7 +575,7 class JRODataReader(JRODataIO):
575 575
576 576 selBlocktime = None
577 577
578
578 onlineWithDate = False
579 579 def __init__(self):
580 580
581 581 """
@@ -609,7 +609,6 class JRODataReader(JRODataIO):
609 609 expLabel='',
610 610 ext='.r',
611 611 walk=True):
612
613 612 self.filenameList = []
614 613 self.datetimeList = []
615 614
@@ -663,9 +662,10 class JRODataReader(JRODataIO):
663 662 self.filenameList = filenameList
664 663 self.datetimeList = datetimeList
665 664
665
666 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 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 694 if not os.path.isdir(path):
693 695 return None, None, None, None, None, None
694 696
@@ -789,6 +791,7 class JRODataReader(JRODataIO):
789 791 Excepciones:
790 792 Si un determinado file no puede ser abierto
791 793 """
794
792 795 nFiles = 0
793 796 fileOk_flag = False
794 797 firstTime_flag = True
@@ -861,13 +864,34 class JRODataReader(JRODataIO):
861 864 def setNextFile(self):
862 865 if self.fp != None:
863 866 self.fp.close()
864
865 867 if self.online:
866 868 newFile = self.__setNextFileOnline()
867 869 else:
868 870 newFile = self.__setNextFileOffline()
869
870 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 895 print '[Reading] No more files to read'
872 896 return 0
873 897
@@ -1021,12 +1045,9 class JRODataReader(JRODataIO):
1021 1045 while True:
1022 1046 if not(self.__setNewBlock()):
1023 1047 return 0
1024
1025 1048 if not(self.readBlock()):
1026 1049 return 0
1027
1028 1050 self.getBasicHeader()
1029
1030 1051 if not isTimeInRange(self.dataOut.datatime.time(), self.startTime, self.endTime):
1031 1052
1032 1053 print "[Reading] Block No. %d/%d -> %s [Skipping]" %(self.nReadBlocks,
@@ -1035,7 +1056,6 class JRODataReader(JRODataIO):
1035 1056 continue
1036 1057
1037 1058 break
1038
1039 1059 print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
1040 1060 self.processingHeaderObj.dataBlocksPerFile,
1041 1061 self.dataOut.datatime.ctime())
@@ -1251,9 +1271,45 class JRODataReader(JRODataIO):
1251 1271 if path == None:
1252 1272 raise ValueError, "[Reading] The path is not valid"
1253 1273
1274
1254 1275 if ext == None:
1255 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 1313 if online:
1258 1314 print "[Reading] Searching files in online mode..."
1259 1315
@@ -1263,13 +1319,11 class JRODataReader(JRODataIO):
1263 1319 ext=ext,
1264 1320 walk=walk,
1265 1321 startDate=startDate,
1266 endDate=endDate,
1267 startTime=startTime, endTime=endTime,
1322 startTime=startTime,
1268 1323 set=set)
1269 1324
1270 1325 if fullpath:
1271 1326 break
1272
1273 1327 print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1)
1274 1328 sleep( self.delay )
1275 1329
@@ -1310,6 +1364,7 class JRODataReader(JRODataIO):
1310 1364 basename, ext = os.path.splitext(file_name)
1311 1365 last_set = int(basename[-3:])
1312 1366
1367
1313 1368 self.online = online
1314 1369 self.realtime = realtime
1315 1370 self.delay = delay
@@ -1320,6 +1375,7 class JRODataReader(JRODataIO):
1320 1375 self.startTime = startTime
1321 1376 self.endTime = endTime
1322 1377
1378
1323 1379 #Added-----------------
1324 1380 self.selBlocksize = blocksize
1325 1381 self.selBlocktime = blocktime
1 NO CONTENT: modified file
@@ -623,6 +623,7 class SendToServer(ProcessingUnit):
623 623 filenameList = glob.glob1(thisFolder, '*%s' %self.ext)
624 624
625 625 if len(filenameList) < 1:
626
626 627 continue
627 628
628 629 for thisFile in filenameList:
@@ -18,7 +18,7 controllerObj.setup(id = '002', name='script02', description="JASMET Meteor Dete
18 18 # path = '/mnt/jars/2016_08/NOCHE'
19 19 # path = '/media/joscanoa/DATA_JASMET/JASMET/2016_08/DIA'
20 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 23 #Path para los graficos
24 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 27 pathfile = os.path.join(os.environ['HOME'],'Pictures/JASMET30/201608/meteor')
28 28
29 29 #Fechas para busqueda de archivos
30 startDate = '2016/08/29'
31 endDate = '2016/09/11'
30 startDate = '2010/08/29'
31 endDate = '2017/09/11'
32 32 #Horas para busqueda de archivos
33 33 startTime = '00:00:00'
34 34 endTime = '23:59:59'
@@ -60,38 +60,40 opObj00.addParameter(name='channelList', value='0,1,2,3,4', format='intlist')
60 60 opObj01 = procUnitConfObj0.addOperation(name='setRadarFrequency')
61 61 opObj01.addParameter(name='frequency', value='30.e6', format='float')
62 62
63 opObj01 = procUnitConfObj0.addOperation(name='interpolateHeights')
64 opObj01.addParameter(name='topLim', value='73', format='int')
65 opObj01.addParameter(name='botLim', value='71', format='int')
63 # opObj01 = procUnitConfObj0.addOperation(name='interpolateHeights')
64 # opObj01.addParameter(name='topLim', value='73', format='int')
65 # opObj01.addParameter(name='botLim', value='71', format='int')
66 66
67 67 opObj02 = procUnitConfObj0.addOperation(name='Decoder', optype='other')
68 68
69 69 opObj03 = procUnitConfObj0.addOperation(name='CohInt', optype='other')
70 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 80 #--------------------------- Parameters Processing Unit ------------------------------------
73 81
74 procUnitConfObj1 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj0.getId())
75 #
76 opObj10 = procUnitConfObj1.addOperation(name='SMDetection', optype='other')
77 opObj10.addParameter(name='azimuth', value='45', format='float')
78 opObj10.addParameter(name='hmin', value='60', format='float')
79 opObj10.addParameter(name='hmax', value='120', format='float')
82 # procUnitConfObj1 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj0.getId())
83 # #
84 # opObj10 = procUnitConfObj1.addOperation(name='SMDetection', optype='other')
85 # opObj10.addParameter(name='azimuth', value='45', format='float')
86 # opObj10.addParameter(name='hmin', value='60', format='float')
87 # opObj10.addParameter(name='hmax', value='120', format='float')
80 88
81 opObj12 = procUnitConfObj1.addOperation(name='ParamWriter', optype='other')
82 opObj12.addParameter(name='path', value=pathfile)
83 opObj12.addParameter(name='blocksPerFile', value='1000', format='int')
84 opObj12.addParameter(name='metadataList',value='type,heightList,paramInterval,timeZone',format='list')
85 opObj12.addParameter(name='dataList',value='data_param,utctime',format='list')
86 opObj12.addParameter(name='mode',value='2',format='int')
89 # opObj12 = procUnitConfObj1.addOperation(name='ParamWriter', optype='other')
90 # opObj12.addParameter(name='path', value=pathfile)
91 # opObj12.addParameter(name='blocksPerFile', value='1000', format='int')
92 # opObj12.addParameter(name='metadataList',value='type,heightList,paramInterval,timeZone',format='list')
93 # opObj12.addParameter(name='dataList',value='data_param,utctime',format='list')
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 97 controllerObj.createObjects()
96 98 controllerObj.connectObjects()
97 99 controllerObj.run() No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now