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