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