@@ -679,8 +679,12 class ProcUnitConf(): | |||||
679 | ''' |
|
679 | ''' | |
680 |
|
680 | |||
681 | className = eval(self.name) |
|
681 | className = eval(self.name) | |
|
682 | #print(self.name) | |||
682 | kwargs = self.getKwargs() |
|
683 | kwargs = self.getKwargs() | |
|
684 | #print(kwargs) | |||
|
685 | #print("mark_a") | |||
683 | procUnitObj = className(self.id, self.inputId, self.project_id, self.err_queue, self.lock, 'ProcUnit', **kwargs) |
|
686 | procUnitObj = className(self.id, self.inputId, self.project_id, self.err_queue, self.lock, 'ProcUnit', **kwargs) | |
|
687 | #print("mark_b") | |||
684 | log.success('creating process...', self.name) |
|
688 | log.success('creating process...', self.name) | |
685 |
|
689 | |||
686 | for opConfObj in self.opConfObjList: |
|
690 | for opConfObj in self.opConfObjList: | |
@@ -768,6 +772,7 class ReadUnitConf(ProcUnitConf): | |||||
768 | self.datatype = datatype |
|
772 | self.datatype = datatype | |
769 | if path != '': |
|
773 | if path != '': | |
770 | self.path = os.path.abspath(path) |
|
774 | self.path = os.path.abspath(path) | |
|
775 | print (self.path) | |||
771 | self.startDate = startDate |
|
776 | self.startDate = startDate | |
772 | self.endDate = endDate |
|
777 | self.endDate = endDate | |
773 | self.startTime = startTime |
|
778 | self.startTime = startTime |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -643,11 +643,10 class Plot(Operation): | |||||
643 | '{}{}_{}.png'.format( |
|
643 | '{}{}_{}.png'.format( | |
644 | self.CODE, |
|
644 | self.CODE, | |
645 | label, |
|
645 | label, | |
646 | self.getDateTime(self.data.max_time).strftime( |
|
646 | self.getDateTime(self.data.max_time).strftime('%Y%m%d_%H%M%S'), | |
647 | '%Y%m%d_%H%M%S' |
|
|||
648 | ), |
|
|||
649 | ) |
|
647 | ) | |
650 | ) |
|
648 | ) | |
|
649 | ||||
651 | log.log('Saving figure: {}'.format(figname), self.name) |
|
650 | log.log('Saving figure: {}'.format(figname), self.name) | |
652 | if not os.path.isdir(os.path.dirname(figname)): |
|
651 | if not os.path.isdir(os.path.dirname(figname)): | |
653 | os.makedirs(os.path.dirname(figname)) |
|
652 | os.makedirs(os.path.dirname(figname)) | |
@@ -807,4 +806,3 class Plot(Operation): | |||||
807 | self.__plot() |
|
806 | self.__plot() | |
808 | if self.data and self.pause: |
|
807 | if self.data and self.pause: | |
809 | figpause(10) |
|
808 | figpause(10) | |
810 |
|
@@ -21,9 +21,10 except: | |||||
21 |
|
21 | |||
22 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader |
|
22 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader | |
23 | from schainpy.model.data.jrodata import Voltage |
|
23 | from schainpy.model.data.jrodata import Voltage | |
24 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
24 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator | |
25 | from numpy import imag |
|
25 | from numpy import imag | |
26 |
|
26 | |||
|
27 | @MPDecorator | |||
27 | class AMISRReader(ProcessingUnit): |
|
28 | class AMISRReader(ProcessingUnit): | |
28 | ''' |
|
29 | ''' | |
29 | classdocs |
|
30 | classdocs | |
@@ -52,7 +53,7 class AMISRReader(ProcessingUnit): | |||||
52 | self.amisrFilePointer = None |
|
53 | self.amisrFilePointer = None | |
53 |
|
54 | |||
54 |
|
55 | |||
55 | self.dataset = None |
|
56 | #self.dataset = None | |
56 |
|
57 | |||
57 |
|
58 | |||
58 |
|
59 | |||
@@ -79,6 +80,7 class AMISRReader(ProcessingUnit): | |||||
79 |
self.__filename_online = None |
|
80 | self.__filename_online = None | |
80 | #Is really necessary create the output object in the initializer |
|
81 | #Is really necessary create the output object in the initializer | |
81 | self.dataOut = Voltage() |
|
82 | self.dataOut = Voltage() | |
|
83 | self.dataOut.error=False | |||
82 |
|
84 | |||
83 | def setup(self,path=None, |
|
85 | def setup(self,path=None, | |
84 |
startDate=None, |
|
86 | startDate=None, | |
@@ -93,6 +95,8 class AMISRReader(ProcessingUnit): | |||||
93 | nBaud = 0, |
|
95 | nBaud = 0, | |
94 | online=False): |
|
96 | online=False): | |
95 |
|
97 | |||
|
98 | #print ("T",path) | |||
|
99 | ||||
96 | self.timezone = timezone |
|
100 | self.timezone = timezone | |
97 | self.all = all |
|
101 | self.all = all | |
98 | self.online = online |
|
102 | self.online = online | |
@@ -112,7 +116,6 class AMISRReader(ProcessingUnit): | |||||
112 |
|
116 | |||
113 | if not(self.filenameList): |
|
117 | if not(self.filenameList): | |
114 | print("There is no files into the folder: %s"%(path)) |
|
118 | print("There is no files into the folder: %s"%(path)) | |
115 |
|
||||
116 | sys.exit(-1) |
|
119 | sys.exit(-1) | |
117 |
|
120 | |||
118 | self.fileIndex = -1 |
|
121 | self.fileIndex = -1 | |
@@ -252,20 +255,22 class AMISRReader(ProcessingUnit): | |||||
252 | fp = h5py.File(filename,'r') |
|
255 | fp = h5py.File(filename,'r') | |
253 | time_str = fp.get('Time/RadacTimeString') |
|
256 | time_str = fp.get('Time/RadacTimeString') | |
254 |
|
257 | |||
255 | startDateTimeStr_File = time_str[0][0].split('.')[0] |
|
258 | startDateTimeStr_File = time_str[0][0].decode('UTF-8').split('.')[0] | |
|
259 | #startDateTimeStr_File = "2019-12-16 09:21:11" | |||
256 | junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S') |
|
260 | junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S') | |
257 | startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) |
|
261 | startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) | |
258 |
|
262 | |||
259 |
endDateTimeStr_File = |
|
263 | #endDateTimeStr_File = "2019-12-16 11:10:11" | |
|
264 | endDateTimeStr_File = time_str[-1][-1].decode('UTF-8').split('.')[0] | |||
260 | junk = time.strptime(endDateTimeStr_File, '%Y-%m-%d %H:%M:%S') |
|
265 | junk = time.strptime(endDateTimeStr_File, '%Y-%m-%d %H:%M:%S') | |
261 | endDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) |
|
266 | endDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) | |
262 |
|
267 | |||
263 | fp.close() |
|
268 | fp.close() | |
264 |
|
269 | |||
|
270 | #print("check time", startDateTime_File) | |||
265 | if self.timezone == 'lt': |
|
271 | if self.timezone == 'lt': | |
266 | startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300) |
|
272 | startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300) | |
267 | endDateTime_File = endDateTime_File - datetime.timedelta(minutes = 300) |
|
273 | endDateTime_File = endDateTime_File - datetime.timedelta(minutes = 300) | |
268 |
|
||||
269 | if (endDateTime_File>=startDateTime_Reader and endDateTime_File<endDateTime_Reader): |
|
274 | if (endDateTime_File>=startDateTime_Reader and endDateTime_File<endDateTime_Reader): | |
270 | #self.filenameList.remove(filename) |
|
275 | #self.filenameList.remove(filename) | |
271 | filter_filenameList.append(filename) |
|
276 | filter_filenameList.append(filename) | |
@@ -378,6 +383,7 class AMISRReader(ProcessingUnit): | |||||
378 | if not(idFile < len(self.filenameList)): |
|
383 | if not(idFile < len(self.filenameList)): | |
379 | self.flagNoMoreFiles = 1 |
|
384 | self.flagNoMoreFiles = 1 | |
380 | print("No more Files") |
|
385 | print("No more Files") | |
|
386 | self.dataOut.error = True | |||
381 | return 0 |
|
387 | return 0 | |
382 |
|
388 | |||
383 | filename = self.filenameList[idFile] |
|
389 | filename = self.filenameList[idFile] | |
@@ -426,8 +432,10 class AMISRReader(ProcessingUnit): | |||||
426 | re = buffer[:,:,:,0] |
|
432 | re = buffer[:,:,:,0] | |
427 | im = buffer[:,:,:,1] |
|
433 | im = buffer[:,:,:,1] | |
428 | dataset = re + im*1j |
|
434 | dataset = re + im*1j | |
|
435 | ||||
429 | self.radacTime = self.amisrFilePointer.get('Raw11/Data/RadacHeader/RadacTime') |
|
436 | self.radacTime = self.amisrFilePointer.get('Raw11/Data/RadacHeader/RadacTime') | |
430 | timeset = self.radacTime[:,0] |
|
437 | timeset = self.radacTime[:,0] | |
|
438 | ||||
431 | return dataset,timeset |
|
439 | return dataset,timeset | |
432 |
|
440 | |||
433 | def reshapeData(self): |
|
441 | def reshapeData(self): | |
@@ -439,7 +447,7 class AMISRReader(ProcessingUnit): | |||||
439 | nsamples = self.nsa |
|
447 | nsamples = self.nsa | |
440 |
|
448 | |||
441 | #Dimensions : nChannels, nProfiles, nSamples |
|
449 | #Dimensions : nChannels, nProfiles, nSamples | |
442 | new_block = numpy.empty((nblocks, nchan, self.newProfiles, nsamples), dtype="complex64") |
|
450 | new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64") | |
443 | ############################################ |
|
451 | ############################################ | |
444 |
|
452 | |||
445 | for thisChannel in range(nchan): |
|
453 | for thisChannel in range(nchan): | |
@@ -458,7 +466,7 class AMISRReader(ProcessingUnit): | |||||
458 | def fillJROHeader(self): |
|
466 | def fillJROHeader(self): | |
459 |
|
467 | |||
460 | #fill radar controller header |
|
468 | #fill radar controller header | |
461 |
self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ipp |
|
469 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ipp=self.__ippKm, | |
462 | txA=self.__txA, |
|
470 | txA=self.__txA, | |
463 | txB=0, |
|
471 | txB=0, | |
464 | nWindows=1, |
|
472 | nWindows=1, | |
@@ -470,14 +478,12 class AMISRReader(ProcessingUnit): | |||||
470 | code = self.__code, |
|
478 | code = self.__code, | |
471 | fClock=1) |
|
479 | fClock=1) | |
472 |
|
480 | |||
473 |
|
||||
474 |
|
||||
475 | #fill system header |
|
481 | #fill system header | |
476 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, |
|
482 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, | |
477 | nProfiles=self.newProfiles, |
|
483 | nProfiles=self.newProfiles, | |
478 | nChannels=len(self.__channelList), |
|
484 | nChannels=len(self.__channelList), | |
479 | adcResolution=14, |
|
485 | adcResolution=14, | |
480 | pciDioBusWith=32) |
|
486 | pciDioBusWidth=32) | |
481 |
|
487 | |||
482 | self.dataOut.type = "Voltage" |
|
488 | self.dataOut.type = "Voltage" | |
483 |
|
489 | |||
@@ -533,7 +539,6 class AMISRReader(ProcessingUnit): | |||||
533 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt |
|
539 | #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt | |
534 |
|
540 | |||
535 | self.dataOut.frequency = self.__frequency |
|
541 | self.dataOut.frequency = self.__frequency | |
536 |
|
||||
537 | self.dataOut.realtime = self.online |
|
542 | self.dataOut.realtime = self.online | |
538 | pass |
|
543 | pass | |
539 |
|
544 | |||
@@ -546,11 +551,13 class AMISRReader(ProcessingUnit): | |||||
546 |
|
551 | |||
547 | if not(newFile): |
|
552 | if not(newFile): | |
548 | return 0 |
|
553 | return 0 | |
549 |
|
||||
550 | #if self.__firstFile: |
|
554 | #if self.__firstFile: | |
551 | self.readAMISRHeader(self.amisrFilePointer) |
|
555 | self.readAMISRHeader(self.amisrFilePointer) | |
|
556 | ||||
552 | self.createBuffers() |
|
557 | self.createBuffers() | |
|
558 | ||||
553 | self.fillJROHeader() |
|
559 | self.fillJROHeader() | |
|
560 | ||||
554 | #self.__firstFile = False |
|
561 | #self.__firstFile = False | |
555 |
|
562 | |||
556 |
|
563 | |||
@@ -560,7 +567,7 class AMISRReader(ProcessingUnit): | |||||
560 | if self.endDate!=None: |
|
567 | if self.endDate!=None: | |
561 | endDateTime_Reader = datetime.datetime.combine(self.endDate,self.endTime) |
|
568 | endDateTime_Reader = datetime.datetime.combine(self.endDate,self.endTime) | |
562 | time_str = self.amisrFilePointer.get('Time/RadacTimeString') |
|
569 | time_str = self.amisrFilePointer.get('Time/RadacTimeString') | |
563 | startDateTimeStr_File = time_str[0][0].split('.')[0] |
|
570 | startDateTimeStr_File = time_str[0][0].decode('UTF-8').split('.')[0] | |
564 | junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S') |
|
571 | junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S') | |
565 | startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) |
|
572 | startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) | |
566 | if self.timezone == 'lt': |
|
573 | if self.timezone == 'lt': | |
@@ -592,7 +599,7 class AMISRReader(ProcessingUnit): | |||||
592 | return 0 |
|
599 | return 0 | |
593 |
|
600 | |||
594 |
|
601 | |||
595 |
if self.dataset is None: # setear esta condicion cuando no hayan datos por leer |
|
602 | if self.dataset is None: # setear esta condicion cuando no hayan datos por leer | |
596 |
self.dataOut.flagNoData = True |
|
603 | self.dataOut.flagNoData = True | |
597 | return 0 |
|
604 | return 0 | |
598 |
|
605 | |||
@@ -600,13 +607,26 class AMISRReader(ProcessingUnit): | |||||
600 |
|
607 | |||
601 | self.dataOut.data = self.jrodataset[:,self.profileIndex,:] |
|
608 | self.dataOut.data = self.jrodataset[:,self.profileIndex,:] | |
602 |
|
609 | |||
|
610 | #print("R_t",self.timeset) | |||
|
611 | ||||
603 | #self.dataOut.utctime = self.jrotimeset[self.profileIndex] |
|
612 | #self.dataOut.utctime = self.jrotimeset[self.profileIndex] | |
604 | #verificar basic header de jro data y ver si es compatible con este valor |
|
613 | #verificar basic header de jro data y ver si es compatible con este valor | |
605 | #self.dataOut.utctime = self.timeset + (self.profileIndex * self.ippSeconds * self.nchannels) |
|
614 | #self.dataOut.utctime = self.timeset + (self.profileIndex * self.ippSeconds * self.nchannels) | |
606 | indexprof = numpy.mod(self.profileIndex, self.newProfiles) |
|
615 | indexprof = numpy.mod(self.profileIndex, self.newProfiles) | |
607 | indexblock = self.profileIndex/self.newProfiles |
|
616 | indexblock = self.profileIndex/self.newProfiles | |
608 | #print indexblock, indexprof |
|
617 | #print (indexblock, indexprof) | |
609 | self.dataOut.utctime = self.timeset[indexblock] + (indexprof * self.ippSeconds * self.nchannels) |
|
618 | diffUTC = 1.8e4 #UTC diference from peru in seconds --Joab | |
|
619 | diffUTC = 0 | |||
|
620 | t_comp = (indexprof * self.ippSeconds * self.nchannels) + diffUTC # | |||
|
621 | #cambio posible 18/02/2020 | |||
|
622 | ||||
|
623 | ||||
|
624 | ||||
|
625 | #print("utc :",indexblock," __ ",t_comp) | |||
|
626 | #print(numpy.shape(self.timeset)) | |||
|
627 | self.dataOut.utctime = self.timeset[numpy.int_(indexblock)] + t_comp | |||
|
628 | #self.dataOut.utctime = self.timeset[self.profileIndex] + t_comp | |||
|
629 | #print(self.dataOut.utctime) | |||
610 | self.dataOut.profileIndex = self.profileIndex |
|
630 | self.dataOut.profileIndex = self.profileIndex | |
611 | self.dataOut.flagNoData = False |
|
631 | self.dataOut.flagNoData = False | |
612 | # if indexprof == 0: |
|
632 | # if indexprof == 0: |
@@ -717,7 +717,7 class ParamWriter(Operation): | |||||
717 |
|
717 | |||
718 | if os.path.exists(fullpath): |
|
718 | if os.path.exists(fullpath): | |
719 | filesList = os.listdir( fullpath ) |
|
719 | filesList = os.listdir( fullpath ) | |
720 | filesList = [k for k in filesList if 'M' in k] |
|
720 | ##filesList = [k for k in filesList if 'M' in k] | |
721 | if len( filesList ) > 0: |
|
721 | if len( filesList ) > 0: | |
722 | filesList = sorted( filesList, key=str.lower ) |
|
722 | filesList = sorted( filesList, key=str.lower ) | |
723 | filen = filesList[-1] |
|
723 | filen = filesList[-1] |
@@ -298,7 +298,6 def MPDecorator(BaseClass): | |||||
298 | if self.inputId is None: |
|
298 | if self.inputId is None: | |
299 | self.lock.wait() |
|
299 | self.lock.wait() | |
300 | self.sender.send_multipart([str(id).encode(), pickle.dumps(data)]) |
|
300 | self.sender.send_multipart([str(id).encode(), pickle.dumps(data)]) | |
301 |
|
||||
302 | def runReader(self): |
|
301 | def runReader(self): | |
303 | ''' |
|
302 | ''' | |
304 | Run fuction for read units |
|
303 | Run fuction for read units | |
@@ -327,7 +326,6 def MPDecorator(BaseClass): | |||||
327 | continue |
|
326 | continue | |
328 |
|
327 | |||
329 | self.publish(self.dataOut, self.id) |
|
328 | self.publish(self.dataOut, self.id) | |
330 |
|
||||
331 |
if self.dataOut.error: |
|
329 | if self.dataOut.error: | |
332 | break |
|
330 | break | |
333 |
|
331 | |||
@@ -402,7 +400,6 def MPDecorator(BaseClass): | |||||
402 | self.runProc() |
|
400 | self.runProc() | |
403 | else: |
|
401 | else: | |
404 | self.runReader() |
|
402 | self.runReader() | |
405 |
|
||||
406 | elif self.typeProc is "Operation": |
|
403 | elif self.typeProc is "Operation": | |
407 |
|
404 | |||
408 | self.subscribe() |
|
405 | self.subscribe() |
@@ -175,6 +175,7 class ParametersProc(ProcessingUnit): | |||||
175 |
self.dataOut.utctimeInit = self.dataIn.utctime |
|
175 | self.dataOut.utctimeInit = self.dataIn.utctime | |
176 |
self.dataOut.paramInterval = self.dataIn.timeInterval |
|
176 | self.dataOut.paramInterval = self.dataIn.timeInterval | |
177 |
|
177 | |||
|
178 | ||||
178 |
return |
|
179 | return | |
179 |
|
180 | |||
180 |
|
181 | |||
@@ -3854,4 +3855,3 class SMOperations(): | |||||
3854 |
# error[indInvalid1] = 13 |
|
3855 | # error[indInvalid1] = 13 | |
3855 |
# |
|
3856 | # | |
3856 |
# return heights, error |
|
3857 | # return heights, error | |
3857 | No newline at end of file |
|
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -606,7 +606,6 class Decoder(Operation): | |||||
606 |
|
606 | |||
607 | self.nCode = len(code) |
|
607 | self.nCode = len(code) | |
608 | self.nBaud = len(code[0]) |
|
608 | self.nBaud = len(code[0]) | |
609 |
|
||||
610 | if (osamp != None) and (osamp >1): |
|
609 | if (osamp != None) and (osamp >1): | |
611 | self.osamp = osamp |
|
610 | self.osamp = osamp | |
612 | self.code = numpy.repeat(code, repeats=self.osamp, axis=1) |
|
611 | self.code = numpy.repeat(code, repeats=self.osamp, axis=1) |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
General Comments 0
You need to be logged in to leave comments.
Login now