##// END OF EJS Templates
Cambio en la lectura de archivos, se incluyó detección de cambio de experimento
joabAM -
r1373:fa4c334951aa
parent child
Show More
@@ -1,658 +1,660
1 1 '''
2 2 Created on Set 9, 2015
3 3
4 4 @author: roj-idl71 Karim Kuyeng
5 5 '''
6 6
7 7 import os
8 8 import sys
9 9 import glob
10 10 import fnmatch
11 11 import datetime
12 12 import time
13 13 import re
14 14 import h5py
15 15 import numpy
16 16
17 17 try:
18 18 from gevent import sleep
19 19 except:
20 20 from time import sleep
21 21
22 22 from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader
23 23 from schainpy.model.data.jrodata import Voltage
24 24 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
25 25 from numpy import imag
26 26
27 27
28 28 class AMISRReader(ProcessingUnit):
29 29 '''
30 30 classdocs
31 31 '''
32 32
33 33 def __init__(self):
34 34 '''
35 35 Constructor
36 36 '''
37 37
38 38 ProcessingUnit.__init__(self)
39 39
40 40 self.set = None
41 41 self.subset = None
42 42 self.extension_file = '.h5'
43 43 self.dtc_str = 'dtc'
44 44 self.dtc_id = 0
45 45 self.status = True
46 46 self.isConfig = False
47 47 self.dirnameList = []
48 48 self.filenameList = []
49 49 self.fileIndex = None
50 50 self.flagNoMoreFiles = False
51 51 self.flagIsNewFile = 0
52 52 self.filename = ''
53 53 self.amisrFilePointer = None
54 54 self.realBeamCode = []
55 55
56 #self.dataset = None
57
56 self.dataShape = None
58 57
59 58
60 59
61 60 self.profileIndex = 0
62 61
63 62
64 63 self.beamCodeByFrame = None
65 64 self.radacTimeByFrame = None
66 65
67 66 self.dataset = None
68 67
69 68
70 69
71 70
72 71 self.__firstFile = True
73 72
74 73 self.buffer = None
75 74
76 75
77 76 self.timezone = 'ut'
78 77
79 78 self.__waitForNewFile = 20
80 79 self.__filename_online = None
81 80 #Is really necessary create the output object in the initializer
82 81 self.dataOut = Voltage()
83 82 self.dataOut.error=False
84 83
85 84
86 85 def setup(self,path=None,
87 86 startDate=None,
88 87 endDate=None,
89 88 startTime=None,
90 89 endTime=None,
91 90 walk=True,
92 91 timezone='ut',
93 92 all=0,
94 93 code = None,
95 94 nCode = 0,
96 95 nBaud = 0,
97 96 online=False):
98 97
99 98
100 99
101 100 self.timezone = timezone
102 101 self.all = all
103 102 self.online = online
104 103
105 104 self.code = code
106 105 self.nCode = int(nCode)
107 106 self.nBaud = int(nBaud)
108 107
109 108
110 109
111 110 #self.findFiles()
112 111 if not(online):
113 112 #Busqueda de archivos offline
114 113 self.searchFilesOffLine(path, startDate, endDate, startTime, endTime, walk)
115 114 else:
116 115 self.searchFilesOnLine(path, startDate, endDate, startTime,endTime,walk)
117 116
118 117 if not(self.filenameList):
119 118 print("There is no files into the folder: %s"%(path))
120 119 sys.exit(-1)
121 120
122 self.fileIndex = -1
121 self.fileIndex = 0
123 122
124 123 self.readNextFile(online)
125 124
126 125 '''
127 126 Add code
128 127 '''
129 128 self.isConfig = True
130 129 # print("Setup Done")
131 130 pass
132 131
133 132
134 133 def readAMISRHeader(self,fp):
134
135 if self.isConfig :
136 newShape = fp.get('Raw11/Data/Samples/Data').shape
137 if self.dataShape != newShape:
138 print("\nERROR, NEW FILE IS A DIFFERENT EXPERIMENT \n")
139 return 0
140 else:
141 self.dataShape = fp.get('Raw11/Data/Samples/Data').shape
142
143
135 144 header = 'Raw11/Data/RadacHeader'
136 145 self.beamCodeByPulse = fp.get(header+'/BeamCode') # LIST OF BEAMS PER PROFILE, TO BE USED ON REARRANGE
137 146 if (self.startDate> datetime.date(2021, 7, 15)): #Se cambió la forma de extracción de Apuntes el 17
138 147 self.beamcodeFile = fp['Setup/Beamcodefile'][()].decode()
139 148 self.trueBeams = self.beamcodeFile.split("\n")
140 149 self.trueBeams.pop()#remove last
141 150 [self.realBeamCode.append(x) for x in self.trueBeams if x not in self.realBeamCode]
142 151 self.beamCode = [int(x, 16) for x in self.realBeamCode]
143 152 else:
144 153 _beamCode= fp.get('Raw11/Data/Beamcodes') #se usa la manera previa al cambio de apuntes
145 154 self.beamCode = _beamCode[0,:]
146 155
147 156
148 157 #self.code = fp.get(header+'/Code') # NOT USE FOR THIS
149 158 self.frameCount = fp.get(header+'/FrameCount')# NOT USE FOR THIS
150 159 self.modeGroup = fp.get(header+'/ModeGroup')# NOT USE FOR THIS
151 160 self.nsamplesPulse = fp.get(header+'/NSamplesPulse')# TO GET NSA OR USING DATA FOR THAT
152 161 self.pulseCount = fp.get(header+'/PulseCount')# NOT USE FOR THIS
153 162 self.radacTime = fp.get(header+'/RadacTime')# 1st TIME ON FILE ANDE CALCULATE THE REST WITH IPP*nindexprofile
154 163 self.timeCount = fp.get(header+'/TimeCount')# NOT USE FOR THIS
155 164 self.timeStatus = fp.get(header+'/TimeStatus')# NOT USE FOR THIS
156 165 self.rangeFromFile = fp.get('Raw11/Data/Samples/Range')
157 166 self.frequency = fp.get('Rx/Frequency')
158 167 txAus = fp.get('Raw11/Data/Pulsewidth')
159 168
160 169
161 170 self.nblocks = self.pulseCount.shape[0] #nblocks
162 171
163 172 self.nprofiles = self.pulseCount.shape[1] #nprofile
164 173 self.nsa = self.nsamplesPulse[0,0] #ngates
165 174 self.nchannels = len(self.beamCode)
166 175 self.ippSeconds = (self.radacTime[0][1] -self.radacTime[0][0]) #Ipp in seconds
167 176 #self.__waitForNewFile = self.nblocks # wait depending on the number of blocks since each block is 1 sec
168 177 self.__waitForNewFile = self.nblocks * self.nprofiles * self.ippSeconds # wait until new file is created
169 178
170 179 #filling radar controller header parameters
171 180 self.__ippKm = self.ippSeconds *.15*1e6 # in km
172 181 self.__txA = (txAus.value)*.15 #(ipp[us]*.15km/1us) in km
173 182 self.__txB = 0
174 183 nWindows=1
175 184 self.__nSamples = self.nsa
176 185 self.__firstHeight = self.rangeFromFile[0][0]/1000 #in km
177 186 self.__deltaHeight = (self.rangeFromFile[0][1] - self.rangeFromFile[0][0])/1000
178 187
179 188 #for now until understand why the code saved is different (code included even though code not in tuf file)
180 189 #self.__codeType = 0
181 190 # self.__nCode = None
182 191 # self.__nBaud = None
183 192 self.__code = self.code
184 193 self.__codeType = 0
185 194 if self.code != None:
186 195 self.__codeType = 1
187 196 self.__nCode = self.nCode
188 197 self.__nBaud = self.nBaud
189 198 #self.__code = 0
190 199
191 200 #filling system header parameters
192 201 self.__nSamples = self.nsa
193 202 self.newProfiles = self.nprofiles/self.nchannels
194 203 self.__channelList = list(range(self.nchannels))
195 204
196 205 self.__frequency = self.frequency[0][0]
197 206
198 207
208 return 1
209
199 210
200 211 def createBuffers(self):
201 212
202 213 pass
203 214
204 215 def __setParameters(self,path='', startDate='',endDate='',startTime='', endTime='', walk=''):
205 216 self.path = path
206 217 self.startDate = startDate
207 218 self.endDate = endDate
208 219 self.startTime = startTime
209 220 self.endTime = endTime
210 221 self.walk = walk
211 222
212 223 def __checkPath(self):
213 224 if os.path.exists(self.path):
214 225 self.status = 1
215 226 else:
216 227 self.status = 0
217 228 print('Path:%s does not exists'%self.path)
218 229
219 230 return
220 231
221 232
222 233 def __selDates(self, amisr_dirname_format):
223 234 try:
224 235 year = int(amisr_dirname_format[0:4])
225 236 month = int(amisr_dirname_format[4:6])
226 237 dom = int(amisr_dirname_format[6:8])
227 238 thisDate = datetime.date(year,month,dom)
228 239
229 240 if (thisDate>=self.startDate and thisDate <= self.endDate):
230 241 return amisr_dirname_format
231 242 except:
232 243 return None
233 244
234 245
235 246 def __findDataForDates(self,online=False):
236 247
237 248 if not(self.status):
238 249 return None
239 250
240 251 pat = '\d+.\d+'
241 252 dirnameList = [re.search(pat,x) for x in os.listdir(self.path)]
242 253 dirnameList = [x for x in dirnameList if x!=None]
243 254 dirnameList = [x.string for x in dirnameList]
244 255 if not(online):
245 256 dirnameList = [self.__selDates(x) for x in dirnameList]
246 257 dirnameList = [x for x in dirnameList if x!=None]
247 258 if len(dirnameList)>0:
248 259 self.status = 1
249 260 self.dirnameList = dirnameList
250 261 self.dirnameList.sort()
251 262 else:
252 263 self.status = 0
253 264 return None
254 265
255 266 def __getTimeFromData(self):
256 267 startDateTime_Reader = datetime.datetime.combine(self.startDate,self.startTime)
257 268 endDateTime_Reader = datetime.datetime.combine(self.endDate,self.endTime)
258 269
259 270 print('Filtering Files from %s to %s'%(startDateTime_Reader, endDateTime_Reader))
260 271 print('........................................')
261 272 filter_filenameList = []
262 273 self.filenameList.sort()
263 274 #for i in range(len(self.filenameList)-1):
264 275 for i in range(len(self.filenameList)):
265 276 filename = self.filenameList[i]
266 277 fp = h5py.File(filename,'r')
267 278 time_str = fp.get('Time/RadacTimeString')
268 279
269 280 startDateTimeStr_File = time_str[0][0].decode('UTF-8').split('.')[0]
270 281 #startDateTimeStr_File = "2019-12-16 09:21:11"
271 282 junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S')
272 283 startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec)
273 284
274 285 #endDateTimeStr_File = "2019-12-16 11:10:11"
275 286 endDateTimeStr_File = time_str[-1][-1].decode('UTF-8').split('.')[0]
276 287 junk = time.strptime(endDateTimeStr_File, '%Y-%m-%d %H:%M:%S')
277 288 endDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec)
278 289
279 290 fp.close()
280 291
281 292 #print("check time", startDateTime_File)
282 293 if self.timezone == 'lt':
283 294 startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300)
284 295 endDateTime_File = endDateTime_File - datetime.timedelta(minutes = 300)
285 296 if (endDateTime_File>=startDateTime_Reader and endDateTime_File<endDateTime_Reader):
286 297 #self.filenameList.remove(filename)
287 298 filter_filenameList.append(filename)
288 299
289 300 if (endDateTime_File>=endDateTime_Reader):
290 301 break
291 302
292 303
293 304 filter_filenameList.sort()
294 305 self.filenameList = filter_filenameList
295 306 return 1
296 307
297 308 def __filterByGlob1(self, dirName):
298 309 filter_files = glob.glob1(dirName, '*.*%s'%self.extension_file)
299 310 filter_files.sort()
300 311 filterDict = {}
301 312 filterDict.setdefault(dirName)
302 313 filterDict[dirName] = filter_files
303 314 return filterDict
304 315
305 316 def __getFilenameList(self, fileListInKeys, dirList):
306 317 for value in fileListInKeys:
307 318 dirName = list(value.keys())[0]
308 319 for file in value[dirName]:
309 320 filename = os.path.join(dirName, file)
310 321 self.filenameList.append(filename)
311 322
312 323
313 324 def __selectDataForTimes(self, online=False):
314 325 #aun no esta implementado el filtro for tiempo
315 326 if not(self.status):
316 327 return None
317 328
318 329 dirList = [os.path.join(self.path,x) for x in self.dirnameList]
319 330
320 331 fileListInKeys = [self.__filterByGlob1(x) for x in dirList]
321 332
322 333 self.__getFilenameList(fileListInKeys, dirList)
323 334 if not(online):
324 335 #filtro por tiempo
325 336 if not(self.all):
326 337 self.__getTimeFromData()
327 338
328 339 if len(self.filenameList)>0:
329 340 self.status = 1
330 341 self.filenameList.sort()
331 342 else:
332 343 self.status = 0
333 344 return None
334 345
335 346 else:
336 347 #get the last file - 1
337 348 self.filenameList = [self.filenameList[-2]]
338 349 new_dirnameList = []
339 350 for dirname in self.dirnameList:
340 351 junk = numpy.array([dirname in x for x in self.filenameList])
341 352 junk_sum = junk.sum()
342 353 if junk_sum > 0:
343 354 new_dirnameList.append(dirname)
344 355 self.dirnameList = new_dirnameList
345 356 return 1
346 357
347 358 def searchFilesOnLine(self, path, startDate, endDate, startTime=datetime.time(0,0,0),
348 359 endTime=datetime.time(23,59,59),walk=True):
349 360
350 361 if endDate ==None:
351 362 startDate = datetime.datetime.utcnow().date()
352 363 endDate = datetime.datetime.utcnow().date()
353 364
354 365 self.__setParameters(path=path, startDate=startDate, endDate=endDate,startTime = startTime,endTime=endTime, walk=walk)
355 366
356 367 self.__checkPath()
357 368
358 369 self.__findDataForDates(online=True)
359 370
360 371 self.dirnameList = [self.dirnameList[-1]]
361 372
362 373 self.__selectDataForTimes(online=True)
363 374
364 375 return
365 376
366 377
367 378 def searchFilesOffLine(self,
368 379 path,
369 380 startDate,
370 381 endDate,
371 382 startTime=datetime.time(0,0,0),
372 383 endTime=datetime.time(23,59,59),
373 384 walk=True):
374 385
375 386 self.__setParameters(path, startDate, endDate, startTime, endTime, walk)
376 387
377 388 self.__checkPath()
378 389
379 390 self.__findDataForDates()
380 391
381 392 self.__selectDataForTimes()
382 393
383 394 for i in range(len(self.filenameList)):
384 395 print("%s" %(self.filenameList[i]))
385 396
386 397 return
387 398
388 399 def __setNextFileOffline(self):
389 idFile = self.fileIndex
390
391 while (True):
392 idFile += 1
393 if not(idFile < len(self.filenameList)):
394 self.flagNoMoreFiles = 1
395 print("No more Files")
396 return 0
397
398 filename = self.filenameList[idFile]
399 400
400 amisrFilePointer = h5py.File(filename,'r')
401
402 break
401 try:
402 self.filename = self.filenameList[self.fileIndex]
403 self.amisrFilePointer = h5py.File(self.filename,'r')
404 self.fileIndex += 1
405 except:
406 self.flagNoMoreFiles = 1
407 print("No more Files")
408 return 0
403 409
404 410 self.flagIsNewFile = 1
405 self.fileIndex = idFile
406 self.filename = filename
407
408 self.amisrFilePointer = amisrFilePointer
409
410 411 print("Setting the file: %s"%self.filename)
411 412
412 413 return 1
413 414
414 415
415 416 def __setNextFileOnline(self):
416 417 filename = self.filenameList[0]
417 418 if self.__filename_online != None:
418 419 self.__selectDataForTimes(online=True)
419 420 filename = self.filenameList[0]
420 421 wait = 0
421 422 #self.__waitForNewFile=5 ## DEBUG:
422 423 while self.__filename_online == filename:
423 424 print('waiting %d seconds to get a new file...'%(self.__waitForNewFile))
424 425 if wait == 5:
425 426 self.flagNoMoreFiles = 1
426 427 return 0
427 428 sleep(self.__waitForNewFile)
428 429 self.__selectDataForTimes(online=True)
429 430 filename = self.filenameList[0]
430 431 wait += 1
431 432
432 433 self.__filename_online = filename
433 434
434 435 self.amisrFilePointer = h5py.File(filename,'r')
435 436 self.flagIsNewFile = 1
436 437 self.filename = filename
437 438 print("Setting the file: %s"%self.filename)
438 439 return 1
439 440
440 441
441 442 def readData(self):
442 443 buffer = self.amisrFilePointer.get('Raw11/Data/Samples/Data')
443 444 re = buffer[:,:,:,0]
444 445 im = buffer[:,:,:,1]
445 446 dataset = re + im*1j
446 447
447 448 self.radacTime = self.amisrFilePointer.get('Raw11/Data/RadacHeader/RadacTime')
448 449 timeset = self.radacTime[:,0]
449 450
450 451 return dataset,timeset
451 452
452 453 def reshapeData(self):
453 454 #self.beamCodeByPulse, self.beamCode, self.nblocks, self.nprofiles, self.nsa,
454 455 channels = self.beamCodeByPulse[0,:]
455 456 nchan = self.nchannels
456 457 #self.newProfiles = self.nprofiles/nchan #must be defined on filljroheader
457 458 nblocks = self.nblocks
458 459 nsamples = self.nsa
459 460
460 461 #Dimensions : nChannels, nProfiles, nSamples
461 462 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
462 463 ############################################
463 464
464 465 for thisChannel in range(nchan):
465 466 new_block[:,thisChannel,:,:] = self.dataset[:,numpy.where(channels==self.beamCode[thisChannel])[0],:]
466 467
467 468
468 469 new_block = numpy.transpose(new_block, (1,0,2,3))
469 470 new_block = numpy.reshape(new_block, (nchan,-1, nsamples))
470 471
471 472 return new_block
472 473
473 474 def updateIndexes(self):
474 475
475 476 pass
476 477
477 478 def fillJROHeader(self):
478 479
479 480 #fill radar controller header
480 481 self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ipp=self.__ippKm,
481 482 txA=self.__txA,
482 483 txB=0,
483 484 nWindows=1,
484 485 nHeights=self.__nSamples,
485 486 firstHeight=self.__firstHeight,
486 487 deltaHeight=self.__deltaHeight,
487 488 codeType=self.__codeType,
488 489 nCode=self.__nCode, nBaud=self.__nBaud,
489 490 code = self.__code,
490 491 fClock=1)
491 492
492 493 #fill system header
493 494 self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples,
494 495 nProfiles=self.newProfiles,
495 496 nChannels=len(self.__channelList),
496 497 adcResolution=14,
497 498 pciDioBusWidth=32)
498 499
499 500 self.dataOut.type = "Voltage"
500 501
501 502 self.dataOut.data = None
502 503
503 504 self.dataOut.dtype = numpy.dtype([('real','<i8'),('imag','<i8')])
504 505
505 506 # self.dataOut.nChannels = 0
506 507
507 508 # self.dataOut.nHeights = 0
508 509
509 510 self.dataOut.nProfiles = self.newProfiles*self.nblocks
510 511
511 512 #self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth
512 513 ranges = numpy.reshape(self.rangeFromFile.value,(-1))
513 514 self.dataOut.heightList = ranges/1000.0 #km
514 515
515 516
516 517 self.dataOut.channelList = self.__channelList
517 518
518 519 self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights
519 520
520 521 # self.dataOut.channelIndexList = None
521 522
522 523 self.dataOut.flagNoData = True
523 524
524 525 #Set to TRUE if the data is discontinuous
525 526 self.dataOut.flagDiscontinuousBlock = False
526 527
527 528 self.dataOut.utctime = None
528 529
529 530 #self.dataOut.timeZone = -5 #self.__timezone/60 #timezone like jroheader, difference in minutes between UTC and localtime
530 531 if self.timezone == 'lt':
531 532 self.dataOut.timeZone = time.timezone / 60. #get the timezone in minutes
532 533 else:
533 534 self.dataOut.timeZone = 0 #by default time is UTC
534 535
535 536 self.dataOut.dstFlag = 0
536 537
537 538 self.dataOut.errorCount = 0
538 539
539 540 self.dataOut.nCohInt = 1
540 541
541 542 self.dataOut.flagDecodeData = False #asumo que la data esta decodificada
542 543
543 544 self.dataOut.flagDeflipData = False #asumo que la data esta sin flip
544 545
545 546 self.dataOut.flagShiftFFT = False
546 547
547 548 self.dataOut.ippSeconds = self.ippSeconds
548 549
549 550 #Time interval between profiles
550 551 #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt
551 552
552 553 self.dataOut.frequency = self.__frequency
553 554 self.dataOut.realtime = self.online
554 555 pass
555 556
556 557 def readNextFile(self,online=False):
557 558
558 559 if not(online):
559 560 newFile = self.__setNextFileOffline()
560 561 else:
561 562 newFile = self.__setNextFileOnline()
562 563
563 564 if not(newFile):
564 565 self.dataOut.error = True
565 566 return 0
566 #if self.__firstFile:
567 self.readAMISRHeader(self.amisrFilePointer)
568 567
569 self.createBuffers()
568 if not self.readAMISRHeader(self.amisrFilePointer):
569 self.dataOut.error = True
570 return 0
570 571
572 self.createBuffers()
571 573 self.fillJROHeader()
572 574
573 575 #self.__firstFile = False
574 576
575 577
576 578
577 579 self.dataset,self.timeset = self.readData()
578 580
579 581 if self.endDate!=None:
580 582 endDateTime_Reader = datetime.datetime.combine(self.endDate,self.endTime)
581 583 time_str = self.amisrFilePointer.get('Time/RadacTimeString')
582 584 startDateTimeStr_File = time_str[0][0].decode('UTF-8').split('.')[0]
583 585 junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S')
584 586 startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec)
585 587 if self.timezone == 'lt':
586 588 startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300)
587 589 if (startDateTime_File>endDateTime_Reader):
588 590 return 0
589 591
590 592 self.jrodataset = self.reshapeData()
591 593 #----self.updateIndexes()
592 594 self.profileIndex = 0
593 595
594 596 return 1
595 597
596 598
597 599 def __hasNotDataInBuffer(self):
598 600 if self.profileIndex >= (self.newProfiles*self.nblocks):
599 601 return 1
600 602 return 0
601 603
602 604
603 605 def getData(self):
604 606
605 607 if self.flagNoMoreFiles:
606 608 self.dataOut.flagNoData = True
607 609 return 0
608 610
609 611 if self.__hasNotDataInBuffer():
610 612 if not (self.readNextFile(self.online)):
611 613 return 0
612 614
613 615
614 616 if self.dataset is None: # setear esta condicion cuando no hayan datos por leer
615 617 self.dataOut.flagNoData = True
616 618 return 0
617 619
618 620 #self.dataOut.data = numpy.reshape(self.jrodataset[self.profileIndex,:],(1,-1))
619 621
620 622 self.dataOut.data = self.jrodataset[:,self.profileIndex,:]
621 623
622 624 #print("R_t",self.timeset)
623 625
624 626 #self.dataOut.utctime = self.jrotimeset[self.profileIndex]
625 627 #verificar basic header de jro data y ver si es compatible con este valor
626 628 #self.dataOut.utctime = self.timeset + (self.profileIndex * self.ippSeconds * self.nchannels)
627 629 indexprof = numpy.mod(self.profileIndex, self.newProfiles)
628 630 indexblock = self.profileIndex/self.newProfiles
629 631 #print (indexblock, indexprof)
630 632 diffUTC = 1.8e4 #UTC diference from peru in seconds --Joab
631 633 diffUTC = 0
632 634 t_comp = (indexprof * self.ippSeconds * self.nchannels) + diffUTC #
633 635
634 636 #print("utc :",indexblock," __ ",t_comp)
635 637 #print(numpy.shape(self.timeset))
636 638 self.dataOut.utctime = self.timeset[numpy.int_(indexblock)] + t_comp
637 639 #self.dataOut.utctime = self.timeset[self.profileIndex] + t_comp
638 640 #print(self.dataOut.utctime)
639 641 self.dataOut.profileIndex = self.profileIndex
640 642 self.dataOut.flagNoData = False
641 643 # if indexprof == 0:
642 644 # print self.dataOut.utctime
643 645
644 646 self.profileIndex += 1
645 647
646 648 return self.dataOut.data
647 649
648 650
649 651 def run(self, **kwargs):
650 652 '''
651 653 This method will be called many times so here you should put all your code
652 654 '''
653 655 #print("running kamisr")
654 656 if not self.isConfig:
655 657 self.setup(**kwargs)
656 658 self.isConfig = True
657 659
658 660 self.getData()
@@ -1,203 +1,203
1 1
2 2 import os, sys
3 3 import time
4 4 import datetime
5 5
6 6 path = os.path.dirname(os.getcwd())
7 7 path = os.path.dirname(path)
8 8 sys.path.insert(0, path)
9 9
10 10 from schainpy.controller import Project
11 11
12 12 def main():
13 13
14 14
15 15 desc = "AMISR EEJ Experiment"
16 16 filename = "amisr_reader.xml"
17 17 xmin = '07'
18 18 xmax = '18' #-> el plot genera +1 en la hora, es decir aparece 18 como máximo
19 19 ymin = '0'
20 20 ymax = '300'
21 21 dbmin = '45' #'60'#'55' #'40' #noise esf eej
22 22 dbmax = '65' #'70' #'55'
23 23 showSPC = '1' #view plot Spectra
24 24 showRTI = '1' #view plot RTI
25 25 showNOISE = '1' #view plot NOISE
26 26 localtime='1' #para ajustar el horario en las gráficas '0' para dejar en utc
27 27 code = '1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,1'
28 28 nCode = '1'
29 29 nBaud = '28'
30 30 nosamp = '1' # oversample for EEJ
31 31 today = time.strftime("%Y/%m/%d")
32 32 #startDate=today
33 33 #endDate=today
34 34 startDate='2021/07/11'
35 35 endDate='2021/07/11'
36 36 #inPath= '/home/soporte/dataAMISR_test/'
37 37 inPath= '/home/soporte/dataAMISR/'
38 38 inPath= '/media/soporte/UARS_4T_D02/AMISR_DATA/2021/'
39 #inPath = '/mnt/data_amisr'
39 #inPath = '/home/soporte/'
40 40 outPath = '/home/soporte/Data/EEJ'
41 41
42 42 ##.......................................................................................
43 43 ##.......................................................................................
44 44
45 45 #l = startDate.split('/') #adding day of the year to outPath
46 46 l = startDate.split('/')
47 47 datelist = datetime.date(int(l[0]),int(l[1]),int(l[2]))
48 48 DOY = datelist.timetuple().tm_yday
49 49 outPath= outPath+"/EEJ"+l[0]+str(DOY)
50 50 if os.path.exists(outPath):
51 51 print("outPath", outPath)
52 52 else :
53 53 os.mkdir(outPath)
54 54 print("Creating...", outPath)
55 55
56 56 ##.......................................................................................
57 57 ##.......................................................................................
58 58 controllerObj = Project()
59 59 controllerObj.setup(id = '11', name='eej_proc', description=desc)
60 60 ##.......................................................................................
61 61 ##.......................................................................................
62 62 readUnitConfObj = controllerObj.addReadUnit(datatype='AMISRReader',
63 63 path=inPath,
64 64 startDate=startDate,#startDate, #'2014/10/07',
65 65 endDate=endDate, #endDate '2014/10/07',
66 startTime='07:01:30',#'07:00:00',
66 startTime='17:55:30',#'07:00:00',
67 67 endTime='19:00:00',#'15:00:00',
68 68 walk=1,
69 69 code = code,
70 70 nCode = nCode,
71 71 nBaud = nBaud,
72 72 timezone='lt',
73 73 online=0)
74 74
75 75
76 #AMISR Processing Unit
77 ##.......................................................................................
78 ##.......................................................................................
76 # #AMISR Processing Unit
77 # ##.......................................................................................
78 # ##.......................................................................................
79 79 procUnitConfObj0 = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId())
80 80 opObj10 = procUnitConfObj0.addOperation(name='setAttribute')
81 81 opObj10.addParameter(name='frequency', value='445.09e6')
82 82 # opObj10 = procUnitConfObj0.addOperation(name='setRadarFrequency')
83 83 # opObj10.addParameter(name='frequency', value='445e6', format='float')
84 84
85 85
86 86 opObj01 = procUnitConfObj0.addOperation(name='Decoder', optype='other')
87 87 opObj01.addParameter(name='code', value=code, format='floatlist')
88 88 opObj01.addParameter(name='nCode', value=nCode, format='int')
89 89 opObj01.addParameter(name='nBaud', value=nBaud, format='int')
90 90 opObj01.addParameter(name='osamp', value=nosamp, format='int')
91 91
92 92
93 93 # opObj02 = procUnitConfObj0.addOperation(name='CohInt', optype='other')
94 94 # opObj02.addParameter(name='n', value='2', format='int')
95 95
96
97
98 ##.......................................................................................
99 ##.......................................................................................
96 #
97 #
98 # ##.......................................................................................
99 # ##.......................................................................................
100 100
101 101 procUnitConfObj1 = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObj0.getId())
102 102 procUnitConfObj1.addParameter(name='nFFTPoints', value='16', format='int')
103 103
104 104
105 105 opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other')
106 106 opObj11.addParameter(name='n', value='150', format='int') #300?
107 107
108 108 ## Remove DC signal
109 109 opObj11 = procUnitConfObj1.addOperation(name='removeDC')
110 110 ##.......................................................................................
111 111 ##.......................................................................................
112 112
113 113 # opObj13 = procUnitConfObj1.addOperation(name='getNoise' , optype ='self')
114 114 # opObj13.addParameter(name='minHei', value='100', format='float')
115 115 # opObj13.addParameter(name='maxHei', value='280', format='float')
116 116
117 117
118 118 #
119 119 opObj12 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external')
120 120 opObj12.addParameter(name='id', value='21', format='int')
121 121 opObj12.addParameter(name= 'xaxis', value='velocity')
122 122 opObj12.addParameter(name='ymax', value=ymax, format='int')
123 123 opObj12.addParameter(name='showprofile', value='1', format='int')
124 124 opObj12.addParameter(name='wintitle', value='AMISR Beam 0', format='str')
125 125 opObj12.addParameter(name='zmin', value=dbmin, format='int')
126 126 opObj12.addParameter(name='zmax', value=dbmax, format='int')
127 127 opObj12.addParameter(name='save', value=outPath+'/plots', format='str')
128 128 opObj12.addParameter(name='colormap', value='jet', format='str')
129 129 opObj12.addParameter(name='localtime', value=localtime,format='int')
130 130 opObj12.addParameter(name='show', value = showSPC, format='int')
131 131
132 132
133 133 ##Generate *.pdata from AMISR data
134 134 ##.......................................................................................
135 135 ##.......................................................................................
136 136 opObj13 = procUnitConfObj1.addOperation(name='SpectraWriter', optype='external')
137 137 opObj13.addParameter(name='path', value=outPath)
138 138 opObj13.addParameter(name='blocksPerFile', value='10', format='int')
139 139
140 140
141 141 opObj14 = procUnitConfObj1.addOperation(name='NoisePlot', optype='external')
142 142 opObj14.addParameter(name='id', value='3', format='int')
143 143 opObj14.addParameter(name='wintitle', value='title0', format='str')
144 144 opObj14.addParameter(name='showprofile', value='0', format='int')
145 145 opObj14.addParameter(name='tmin', value=xmin, format='int')
146 146 opObj14.addParameter(name='tmax', value=xmax, format='int')
147 147 opObj14.addParameter(name='ymin', value=dbmin, format='int')
148 148 opObj14.addParameter(name='ymax', value=dbmax, format='int')
149 149 opObj14.addParameter(name='save', value=outPath, format='str')
150 150 opObj14.addParameter(name='localtime', value=localtime,format='int')
151 151 opObj14.addParameter(name='show', value = showNOISE, format='int')
152 152
153 #
153 # #
154 154 opObj15 = procUnitConfObj1.addOperation(name='RTIPlot', optype='external')
155 155 opObj15.addParameter(name='id', value='2', format='int')
156 156 opObj15.addParameter(name='localtime', value=localtime,format='int')
157 157 opObj15.addParameter(name='wintitle', value='RTI', format='str')
158 158 opObj15.addParameter(name='tmin', value=xmin, format='int')
159 159 opObj15.addParameter(name='tmax', value=xmax, format='int') #max value =23
160 160 opObj15.addParameter(name='ymin', value=ymin, format='int')
161 161 opObj15.addParameter(name='zmin', value=dbmin, format='int')
162 162 opObj15.addParameter(name='zmax', value=dbmax, format='int')
163 163 opObj15.addParameter(name='showprofile', value='0', format='int')
164 164 opObj15.addParameter(name='save', value=outPath+'/plots', format='str')
165 165 opObj15.addParameter(name='colormap', value='jet', format='str')
166 166 opObj15.addParameter(name='show', value = showRTI, format='int')
167 167
168 168
169 169
170 170 ##.......................................................................................
171 171 ##.......................................................................................
172 172
173 173 procUnitConfObj2 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj1.getId())
174 174 opObj16 = procUnitConfObj2.addOperation(name='SpectralMoments', optype='other')
175 175
176 176
177 177 #Using HDFWriter::::
178 ##.......................................................................................
179 ##.......................................................................................
178 #.......................................................................................
179 #.......................................................................................
180 180 opObj17 = procUnitConfObj2.addOperation(name='HDFWriter', optype='external')
181 181 opObj17.addParameter(name='path', value=outPath)
182 182 opObj17.addParameter(name='blocksPerFile', value='10', format='int')
183 183 opObj17.addParameter(name='metadataList',value='type,inputUnit,heightList',format='list')
184 184 opObj17.addParameter(name='dataList',value='moments,data_SNR,utctime',format='list')
185 185
186 186
187 187
188 188 ##.......................................................................................
189 189 ##.......................................................................................
190 190 #print("Escribiendo el archivo XML",controllerObj.writeXml(outPath +'/'+filename))
191 191
192 192 controllerObj.start()
193 193
194 194 #print("Leyendo el archivo XML",controllerObj.readXml(outPath +'/'+filename))
195 195
196 196 ##.......................................................................................
197 197 ##.......................................................................................
198 198
199 199 if __name__ == '__main__':
200 200 import time
201 201 start_time = time.time()
202 202 main()
203 203 print("--- %s seconds ---" % (time.time() - start_time))
@@ -1,231 +1,205
1 1 import os, sys
2 2 import time
3 3 import datetime
4 4
5 5
6 6 path = os.path.dirname(os.getcwd())
7 7 path = os.path.dirname(path)
8 8 sys.path.insert(0, path)
9 9
10 10 from schainpy.controller import Project
11 11
12 12 def main():
13 13 desc = "AMISR Experiment"
14 14
15 15 filename = "amisr_reader.xml"
16 16
17 17 controllerObj = Project()
18 18
19 19 controllerObj.setup(id = '10', name='eej_proc', description=desc)
20 20
21 21
22 22 #path = os.path.join(os.environ['HOME'],'amisr')
23 23 # path = '/media/signalchain/HD-PXU2/AMISR_JULIA_MODE'
24 24 # path = '/media/soporte/E9F4-F053/AMISR/Data/NoiseTest/EEJ'
25 25 # path = '/media/soporte/E9F4-F053/AMISR/Data/ESF'
26 26 #path = '/mnt/data_amisr'
27 27
28 #path = '/media/soporte/AMISR_104'
28 path = '/home/soporte/Data/EEJ/EEJ2021192'
29 29 #figpath = os.path.join(os.environ['HOME'],'Pictures/amisr/test/proc/esf')
30 30 #figpath = '/media/soporte/E9F4-F053/AMISR/Data/JULIA/ESF'
31 figpath = '/home/soporte/Data/EEJ'
31 figpath = '/home/soporte/Data/OutTest/EEJ'
32 32
33 33
34 34 xmin = '07'
35 xmax = '17' #-> el plot genera +1 en la hora, es decir aparece 18 como máximo
35 xmax = '18' #-> el plot genera +1 en la hora, es decir aparece 18 como máximo
36 36 ymin = '0'
37 37 ymax = '300'
38 38 dbmin = '45' #'60'#'55' #'40' #noise esf eej
39 39 dbmax = '65' #'70' #'55'
40 40 showSPC = '1' #view plot Spectra
41 41 showRTI = '1' #view plot RTI
42 42 showNOISE = '0' #view plot NOISE
43 43 localtime='1' #para ajustar el horario en las gráficas '0' para dejar en utc
44 44
45 45 code = '1,-1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,1,-1,1'
46 46 nCode = '1'
47 47 nBaud = '28'
48 48
49 49 nosamp = '1' # oversample for EEJ
50 50
51 51 str0 = datetime.date.today()
52 52 str1 = str0 + datetime.timedelta(days=1)
53 53 str2 = str0 - datetime.timedelta(days=1)
54 54 today = str0.strftime("%Y/%m/%d")
55 55 tomorrow = str1.strftime("%Y/%m/%d")
56 56 yesterday = str2.strftime("%Y/%m/%d")
57 57
58 58 #print(today,yesterday,tomorrow)
59 59 #path= '/home/soporte/dataAMISR_test/'
60 path= '/home/soporte/dataAMISR/'
61 60 #path= '/home/soporte/dataAMISR/'
62 61 #path='/home/soporte/Documentos/' #
63 62
64 readUnitConfObj = controllerObj.addReadUnit(datatype='AMISRReader',
63 readUnitConfObj = controllerObj.addReadUnit(datatype='Spectra',
65 64 path=path,
66 startDate="2019/12/16",#yesterday, #'2014/10/07',
67 endDate="2019/12/16", #'2014/10/07',
68 startTime='08:00:00',#'07:00:00',
69 endTime='08:58:00',#'15:00:00',
70 walk=0,
71 code = code,
72 nCode = nCode,
73 nBaud = nBaud,
65 startDate='2021/07/11',
66 endDate='2021/07/11',
67 startTime='07:01:30',#'07:00:00',
68 endTime='18:00:00',#'15:00:00',
69 walk=1,
74 70 timezone='lt',
75 71 online=0)
76 72
77 73 #AMISR Processing Unit
78 procUnitConfObj0 = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId())
79 74
80 opObj10 = procUnitConfObj0.addOperation(name='setRadarFrequency')
81 opObj10.addParameter(name='frequency', value='445e6', format='float')
82 75
83 76
84 opObj01 = procUnitConfObj0.addOperation(name='Decoder', optype='other')
85 opObj01.addParameter(name='code', value=code, format='floatlist')
86 opObj01.addParameter(name='nCode', value=nCode, format='int')
87 opObj01.addParameter(name='nBaud', value=nBaud, format='int')
88 opObj01.addParameter(name='osamp', value=nosamp, format='int')
89
90
91 # opObj02 = procUnitConfObj0.addOperation(name='CohInt', optype='other')
92 # opObj02.addParameter(name='n', value='5', format='int')
93
94
95
96
97 procUnitConfObj1 = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObj0.getId())
98 procUnitConfObj1.addParameter(name='nFFTPoints', value='16', format='int')
77 proc_spectra = controllerObj.addProcUnit(datatype='SpectraProc', inputId=readUnitConfObj.getId())
78 proc_spectra.addParameter(name='nFFTPoints', value='16', format='int')
99 79 #procUnitConfObj1.addParameter(name='frequency', value='445e6', format='float') #no lo acepta
100 80
101 81
102 opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other')
103 opObj11.addParameter(name='n', value='150', format='int') #300 normal value
104
105 opObj11 = procUnitConfObj1.addOperation(name='removeDC')
82 # op1 = proc_spectra.addOperation(name='IncohInt', optype='other')
83 # op1.addParameter(name='n', value='150', format='int') #300 normal value
106 84
85 #op2 = proc_spectra.addOperation(name='removeDC')
107 86
87 op2 = proc_spectra.addOperation(name='CrossSpectraPlot', optype='external')
88 op2.addParameter(name='id', value='10', format='int')
89 op2.addParameter(name='save', value=figpath, format='str')
90 #op2.addParameter(name='zmin', value='10.0', format='float')
91 #op2.addParameter(name='zmax', value='35.0', format='float')
108 92 # #
109 # opObj12 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='external')
110 # opObj12.addParameter(name='id', value='21', format='int')
111 # opObj12.addParameter(name='xaxis', value='velocity')
112 # opObj12.addParameter(name='ymax', value=ymax, format='int')
113 # opObj12.addParameter(name='showprofile', value='1', format='int')
114 # opObj12.addParameter(name='wintitle', value='AMISR Beam 0', format='str')
115 # opObj12.addParameter(name='zmin', value=dbmin, format='int')
116 # opObj12.addParameter(name='zmax', value=dbmax, format='int')
117 # opObj12.addParameter(name='save', value=figpath, format='str')
118 # opObj12.addParameter(name='colormap', value='jet', format='str')
119 # opObj12.addParameter(name='localtime', value=localtime,format='int')
120 # opObj12.addParameter(name='show', value = showSPC, format='int')
121 #
122 opObj13 = procUnitConfObj1.addOperation(name='getNoise' , optype ='self')
123 opObj13.addParameter(name='minHei', value='100', format='float')
124 opObj13.addParameter(name='maxHei', value='280', format='float')
125 #
126 #
127 #
93
94 op3 = proc_spectra.addOperation(name='SpectraPlot', optype='external')
95 op3.addParameter(name='id', value='21', format='int')
96 op3.addParameter(name='xaxis', value='velocity')
97 op3.addParameter(name='ymax', value=ymax, format='int')
98 op3.addParameter(name='showprofile', value='1', format='int')
99 op3.addParameter(name='wintitle', value='AMISR Beam 0', format='str')
100 op3.addParameter(name='zmin', value=dbmin, format='int')
101 op3.addParameter(name='zmax', value=dbmax, format='int')
102 op3.addParameter(name='save', value=figpath, format='str')
103 op3.addParameter(name='colormap', value='jet', format='str')
104 op3.addParameter(name='localtime', value=localtime,format='int')
105 op3.addParameter(name='show', value = showSPC, format='int')
128 106 #
129 # ##Generate *.pdata from AMISR data
130 # opObj13 = procUnitConfObj1.addOperation(name='SpectraWriter', optype='external')
131 # opObj13.addParameter(name='path', value=figpath+'SpectraPlot')
132 # opObj13.addParameter(name='blocksPerFile', value='10', format='int')
133 # # opObj11.addParameter(name='datatype', value="4", format="int") #no incluir,x revisar
107
134 108
135 109 # opObj31 = procUnitConfObj1.addOperation(name='selectChannels')
136 110 # opObj31.addParameter(name='channelList', value='6,7,8,9', format='intlist')
137 111 #
138 opObj15 = procUnitConfObj1.addOperation(name='RTIPlot', optype='external')
139 opObj15.addParameter(name='id', value='2', format='int')
140 opObj15.addParameter(name='localtime', value=localtime,format='int')
141 opObj15.addParameter(name='wintitle', value='RTI', format='str')
142 #opObj15.addParameter(name='xmin', value=xmin, format='int')
143 opObj15.addParameter(name='xmax', value=xmax, format='int') #max value =23
144 opObj15.addParameter(name='ymin', value=ymin, format='int')
145 #opObj15.addParameter(name='ymax', value=ymax, format='int')
146 opObj15.addParameter(name='zmin', value=dbmin, format='int')
147 opObj15.addParameter(name='zmax', value=dbmax, format='int')
148 opObj15.addParameter(name='showprofile', value='1', format='int')
149 opObj15.addParameter(name='show', value = showRTI, format='int') #
150 #opObj15.addParameter(name='timerange', value=str(24*60*60), format='int')#conflicto datetime
151 opObj15.addParameter(name='save', value=figpath+'/plots', format='str')
152 #opObj15.addParameter(name='figpath', value = figpath+'/plots', format='str')#no es necesario
153 opObj15.addParameter(name='colormap', value='jet', format='str')
154 opObj15.addParameter(name='channels', value='2,4', format='intlist')
112 op4 = proc_spectra.addOperation(name='RTIPlot', optype='external')
113 op4.addParameter(name='id', value='2', format='int')
114 op4.addParameter(name='localtime', value=localtime,format='int')
115 op4.addParameter(name='wintitle', value='RTI', format='str')
116 #op4.addParameter(name='xmin', value=xmin, format='int')
117 op4.addParameter(name='xmax', value=xmax, format='int') #max value =23
118 op4.addParameter(name='ymin', value=ymin, format='int')
119 #op4.addParameter(name='ymax', value=ymax, format='int')
120 op4.addParameter(name='zmin', value=dbmin, format='int')
121 op4.addParameter(name='zmax', value=dbmax, format='int')
122 op4.addParameter(name='showprofile', value='1', format='int')
123 op4.addParameter(name='show', value = showRTI, format='int') #
124 #op4.addParameter(name='timerange', value=str(24*60*60), format='int')#conflicto datetime
125 op4.addParameter(name='save', value=figpath+'/plots', format='str')
126 #op4.addParameter(name='figpath', value = figpath+'/plots', format='str')#no es necesario
127 op4.addParameter(name='colormap', value='jet', format='str')
128 op4.addParameter(name='channels', value='2,4', format='intlist')
155 129
156 130 # opObj14 = procUnitConfObj1.addOperation(name='NoisePlot', optype='external')
157 131 # opObj14.addParameter(name='id', value='3', format='int')
158 132 # opObj14.addParameter(name='wintitle', value='title0', format='str')
159 133 # opObj14.addParameter(name='showprofile', value='0', format='int')
160 134 # opObj14.addParameter(name='xmin', value=xmin, format='int')
161 135 # opObj14.addParameter(name='xmax', value=xmax, format='int')
162 136 # opObj14.addParameter(name='ymin', value=dbmin, format='int')
163 137 # opObj14.addParameter(name='ymax', value=dbmax, format='int')
164 138 # opObj14.addParameter(name='save', value=figpath+'/plots', format='str')
165 139 # opObj14.addParameter(name='localtime', value=localtime,format='int')
166 140 # opObj14.addParameter(name='show', value = showNOISE, format='int')
167 141 # #
168 142
169 143 # opObj18 = procUnitConfObj1.addOperation(name='PublishData', optype='other')
170 144 # opObj18.addParameter(name='zeromq', value=1, format='int')
171 145 # opObj18.addParameter(name='server', value='tcp://0.0.0.0:8020/', format='str')
172 146 # opObj18.addParameter(name='delay', value=0, format='int')
173 147 # #
174 148
175 149 # patternX = 'local, remote, ext, period, exp_code, sub_exp_code'
176 150 #
177 151 # opObj18 = procUnitConfObj1.addOperation(name='SendToFTP', optype='external')
178 152 # opObj18.addParameter(name='server', value='localhost', format='str')
179 153 # opObj18.addParameter(name='username', value='soporte', format='str')
180 154 # opObj18.addParameter(name='password', value='soporte', format='str')
181 155 # opObj18.addParameter(name='timeout', value=5, format='int')
182 156 #
183 157 # #opObj18.addParameter(name='patternx', value=patternX, format='str')
184 158 # opObj18.addParameter(name='patternlocalfolder', value=figpath, format='str')
185 159 # opObj18.addParameter(name='patternremotefolder', value=remotefolder, format='str')
186 160 # opObj18.addParameter(name='patternext', value='.png', format='str')
187 161 # opObj18.addParameter(name='patternperiod', value=1, format='int')
188 162 # opObj18.addParameter(name='patternprotocol', value='ftp', format='str')
189 163 # opObj18.addParameter(name='patternsub_ext', value='amisr', format='str')
190 164
191 165 # remotefolder = '/Data/myServer/'
192 166 # opObj18 = controllerObj.addProcUnit(name='SendToServer', inputId=procUnitConfObj1.getId())
193 167 # opObj18.addParameter(name='server', value='localhost', format='str')
194 168 # opObj18.addParameter(name='username', value='soporte', format='str')
195 169 # opObj18.addParameter(name='password', value='soporte', format='str')
196 170 # opObj18.addParameter(name='localfolder', value=figpath, format='str')
197 171 # opObj18.addParameter(name='remotefolder', value=remotefolder, format='str')
198 172 # opObj18.addParameter(name='ext', value='.png', format='str')
199 173 # opObj18.addParameter(name='period', value=5, format='int')
200 174 # opObj18.addParameter(name='protocol', value='ftp', format='str')
201 175 # #-----------------------------------------------------------------------------------------------
202 176 #####################
203 177
204 178
205 179 #
206 180 # procUnitConfObj2 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObj1.getId())
207 181 # opObj16 = procUnitConfObj2.addOperation(name='SpectralMoments', optype='other')
208 182 #
209 183 #
210 184 # #Using ParamWriter::::
211 185 # opObj17 = procUnitConfObj2.addOperation(name='ParamWriter', optype='external')
212 186 # opObj17.addParameter(name='path', value=figpath+'/param')
213 187 # opObj17.addParameter(name='blocksPerFile', value='10', format='int')
214 188 # opObj17.addParameter(name='metadataList',value='type,inputUnit,heightList',format='list')
215 189 # opObj17.addParameter(name='dataList',value='moments,data_SNR,utctime',format='list')
216 190 # opObj17.addParameter(name='mode',value='1',format='int') #'0' channels, '1' parameters, '3' table (for meteors)
217 191 #
218 192 #
219 193
220 194
221 195 #print("Escribiendo el archivo XML",controllerObj.writeXml(path +'/'+filename))
222 196
223 197 controllerObj.start()
224 198
225 199 #print("Leyendo el archivo XML",controllerObj.readXml(path +'/'+filename))
226 200
227 201 if __name__ == '__main__':
228 202 import time
229 203 start_time = time.time()
230 204 main()
231 205 print("--- %s seconds ---" % (time.time() - start_time))
General Comments 0
You need to be logged in to leave comments. Login now