##// END OF EJS Templates
updates real multiprocess, save hdf5, utils_Io
joabAM -
r1559:6d931be610e9
parent child
Show More
@@ -17,9 +17,9 import json
17
17
18 import schainpy.admin
18 import schainpy.admin
19 from schainpy.utils import log
19 from schainpy.utils import log
20 from .jroheaderIO import SystemHeader, RadarControllerHeader
20 from .jroheaderIO import SystemHeader, RadarControllerHeader,ProcessingHeader
21 from schainpy.model.data import _noise
21 from schainpy.model.data import _noise
22
22 SPEED_OF_LIGHT = 3e8
23
23
24 def getNumpyDtype(dataTypeCode):
24 def getNumpyDtype(dataTypeCode):
25
25
@@ -190,7 +190,7 class JROData(GenericData):
190 blocknow = None
190 blocknow = None
191 azimuth = None
191 azimuth = None
192 zenith = None
192 zenith = None
193 beam = Beam()
193
194 profileIndex = None
194 profileIndex = None
195 error = None
195 error = None
196 data = None
196 data = None
@@ -200,10 +200,17 class JROData(GenericData):
200 azimuthList = []
200 azimuthList = []
201 elevationList = []
201 elevationList = []
202 last_noise = None
202 last_noise = None
203 radar_ipp = None
203 __ipp = None
204 __ippSeconds = None
204 sampled_heightsFFT = None
205 sampled_heightsFFT = None
205 pulseLength_TxA = None
206 pulseLength_TxA = None
206 deltaHeight = None
207 deltaHeight = None
208 code = None
209 nCode = None
210 nBaud = None
211 unitsDescription = "The units of the parameters are according to the International System of units (Seconds, Meter, Hertz, ...), except \
212 the parameters related to distances such as heightList, or heightResolution wich are in Km"
213
207
214
208 def __str__(self):
215 def __str__(self):
209
216
@@ -268,7 +275,7 class JROData(GenericData):
268 return fmax
275 return fmax
269
276
270 def getFmax(self):
277 def getFmax(self):
271 PRF = 1. / (self.ippSeconds * self.nCohInt)
278 PRF = 1. / (self.__ippSeconds * self.nCohInt)
272
279
273 fmax = PRF
280 fmax = PRF
274 return fmax
281 return fmax
@@ -285,61 +292,67 class JROData(GenericData):
285 def ippSeconds(self):
292 def ippSeconds(self):
286 '''
293 '''
287 '''
294 '''
288 return self.radarControllerHeaderObj.ippSeconds
295 #return self.radarControllerHeaderObj.ippSeconds
296 return self.__ippSeconds
289
297
290 @ippSeconds.setter
298 @ippSeconds.setter
291 def ippSeconds(self, ippSeconds):
299 def ippSeconds(self, ippSeconds):
292 '''
300 '''
293 '''
301 '''
294 self.radarControllerHeaderObj.ippSeconds = ippSeconds
302 #self.radarControllerHeaderObj.ippSeconds = ippSeconds
295
303 self.__ippSeconds = ippSeconds
296 @property
304 self.__ipp = ippSeconds*SPEED_OF_LIGHT/2000.0
297 def code(self):
298 '''
299 '''
300 return self.radarControllerHeaderObj.code
301
302 @code.setter
303 def code(self, code):
304 '''
305 '''
306 self.radarControllerHeaderObj.code = code
307
305
308 @property
309 def nCode(self):
310 '''
311 '''
312 return self.radarControllerHeaderObj.nCode
313
314 @nCode.setter
315 def nCode(self, ncode):
316 '''
317 '''
318 self.radarControllerHeaderObj.nCode = ncode
319
320 @property
321 def nBaud(self):
322 '''
323 '''
324 return self.radarControllerHeaderObj.nBaud
325
306
326 @nBaud.setter
307 # @property
327 def nBaud(self, nbaud):
308 # def code(self):
328 '''
309 # '''
329 '''
310 # '''
330 self.radarControllerHeaderObj.nBaud = nbaud
311 # return self.radarControllerHeaderObj.code
312 #
313 # @code.setter
314 # def code(self, code):
315 # '''
316 # '''
317 # self.radarControllerHeaderObj.code = code
318 #
319 # @property
320 # def nCode(self):
321 # '''
322 # '''
323 # return self.radarControllerHeaderObj.nCode
324 #
325 # @nCode.setter
326 # def nCode(self, ncode):
327 # '''
328 # '''
329 # self.radarControllerHeaderObj.nCode = ncode
330 #
331 # @property
332 # def nBaud(self):
333 # '''
334 # '''
335 # return self.radarControllerHeaderObj.nBaud
336 #
337 # @nBaud.setter
338 # def nBaud(self, nbaud):
339 # '''
340 # '''
341 # self.radarControllerHeaderObj.nBaud = nbaud
331
342
332 @property
343 @property
333 def ipp(self):
344 def ipp(self):
334 '''
345 '''
335 '''
346 '''
336 return self.radarControllerHeaderObj.ipp
347 return self.__ipp
348 #return self.radarControllerHeaderObj.ipp
337
349
338 @ipp.setter
350 @ipp.setter
339 def ipp(self, ipp):
351 def ipp(self, ipp):
340 '''
352 '''
341 '''
353 '''
342 self.radarControllerHeaderObj.ipp = ipp
354 self.__ipp = ipp
355 #self.radarControllerHeaderObj.ipp = ipp
343
356
344 @property
357 @property
345 def metadata(self):
358 def metadata(self):
@@ -364,6 +377,7 class Voltage(JROData):
364 self.useLocalTime = True
377 self.useLocalTime = True
365 self.radarControllerHeaderObj = RadarControllerHeader()
378 self.radarControllerHeaderObj = RadarControllerHeader()
366 self.systemHeaderObj = SystemHeader()
379 self.systemHeaderObj = SystemHeader()
380 self.processingHeaderObj = ProcessingHeader()
367 self.type = "Voltage"
381 self.type = "Voltage"
368 self.data = None
382 self.data = None
369 self.nProfiles = None
383 self.nProfiles = None
@@ -456,6 +470,7 class Spectra(JROData):
456 self.useLocalTime = True
470 self.useLocalTime = True
457 self.radarControllerHeaderObj = RadarControllerHeader()
471 self.radarControllerHeaderObj = RadarControllerHeader()
458 self.systemHeaderObj = SystemHeader()
472 self.systemHeaderObj = SystemHeader()
473 self.processingHeaderObj = ProcessingHeader()
459 self.type = "Spectra"
474 self.type = "Spectra"
460 self.timeZone = 0
475 self.timeZone = 0
461 self.nProfiles = None
476 self.nProfiles = None
@@ -924,12 +939,15 class Parameters(Spectra):
924 noise_estimation = None
939 noise_estimation = None
925 GauSPC = None # Fit gaussian SPC
940 GauSPC = None # Fit gaussian SPC
926
941
942
943
927 def __init__(self):
944 def __init__(self):
928 '''
945 '''
929 Constructor
946 Constructor
930 '''
947 '''
931 self.radarControllerHeaderObj = RadarControllerHeader()
948 self.radarControllerHeaderObj = RadarControllerHeader()
932 self.systemHeaderObj = SystemHeader()
949 self.systemHeaderObj = SystemHeader()
950 self.processingHeaderObj = ProcessingHeader()
933 self.type = "Parameters"
951 self.type = "Parameters"
934 self.timeZone = 0
952 self.timeZone = 0
935
953
@@ -279,6 +279,7 class SystemHeader(Header):
279 class RadarControllerHeader(Header):
279 class RadarControllerHeader(Header):
280
280
281 expType = None
281 expType = None
282 dtype = ""
282 nTx = None
283 nTx = None
283 ipp = None
284 ipp = None
284 txA = None
285 txA = None
@@ -291,19 +292,32 class RadarControllerHeader(Header):
291 fClock = None
292 fClock = None
292 prePulseBefore = None
293 prePulseBefore = None
293 prePulseAfter = None
294 prePulseAfter = None
294 rangeIpp = None
295 rangeIpp = None #variables innecesarias?
295 rangeTxA = None
296 rangeTxA = None
296 rangeTxB = None
297 rangeTxB = None
297 structure = RADAR_STRUCTURE
298 structure = RADAR_STRUCTURE
298 __size = None
299 __size = None
300 ################################################
301 ippSeconds = None
302 frequency = None
303 sampleRate = None
304 nOsamp = None
305 channelList = []
306 azimuthList = []
307 elevationList =[]
308 codeList = []
309 nChannels = 1
310 heightList = []
311 heightResolution = None
312
299
313
300 def __init__(self, expType=2, nTx=1,
314 def __init__(self, expType=2, nTx=1,
301 ipp=None, txA=0, txB=0,
315 ipp=None, txA=0, txB=0,
302 nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None,
316 nWindows=None, nHeights=None, firstHeight=None, deltaHeight=None,
303 numTaus=0, line6Function=0, line5Function=0, fClock=None,
317 numTaus=0, line6Function=0, line5Function=0, fClock=None,
304 prePulseBefore=0, prePulseAfter=0,
318 prePulseBefore=0, prePulseAfter=0,
305 codeType=0, nCode=0, nBaud=0, code=[],
319 codeType=0, nCode=0, nBaud=0, code=[],nOsamp = None, frequency = None,sampleRate=None,
306 flip1=0, flip2=0):
320 flip1=0, flip2=0, nChannels=1):
307
321
308 # self.size = 116
322 # self.size = 116
309 self.expType = expType
323 self.expType = expType
@@ -314,7 +328,8 class RadarControllerHeader(Header):
314 self.rangeIpp = ipp
328 self.rangeIpp = ipp
315 self.rangeTxA = txA
329 self.rangeTxA = txA
316 self.rangeTxB = txB
330 self.rangeTxB = txB
317
331 self.frequency = frequency
332 self.sampleRate = sampleRate
318 self.nWindows = nWindows
333 self.nWindows = nWindows
319 self.numTaus = numTaus
334 self.numTaus = numTaus
320 self.codeType = codeType
335 self.codeType = codeType
@@ -332,6 +347,7 class RadarControllerHeader(Header):
332 self.nCode = nCode
347 self.nCode = nCode
333 self.nBaud = nBaud
348 self.nBaud = nBaud
334 self.code = code
349 self.code = code
350 self.nOsamp = nOsamp
335 self.flip1 = flip1
351 self.flip1 = flip1
336 self.flip2 = flip2
352 self.flip2 = flip2
337
353
@@ -578,6 +594,7 class RadarControllerHeader(Header):
578 class ProcessingHeader(Header):
594 class ProcessingHeader(Header):
579
595
580 # size = None
596 # size = None
597
581 dtype = None
598 dtype = None
582 blockSize = None
599 blockSize = None
583 profilesPerBlock = None
600 profilesPerBlock = None
@@ -590,6 +607,21 class ProcessingHeader(Header):
590 structure = PROCESSING_STRUCTURE
607 structure = PROCESSING_STRUCTURE
591 flag_dc = None
608 flag_dc = None
592 flag_cspc = None
609 flag_cspc = None
610 #########################################################
611 nFFTPoints = None
612 nSamplesFFT = None
613 channelList = []
614 azimuthList = []
615 elevationList =[]
616 codeList = []
617 nChannels = 1
618 heightList = []
619 ipp = None
620 ippSeconds = None
621 timeIncohInt = None
622 #################
623 rangeIpp = None
624 heightResolution = None
593
625
594 def __init__(self, dtype=0, blockSize=0, profilesPerBlock=0, dataBlocksPerFile=0, nWindows=0, processFlags=0, nCohInt=0,
626 def __init__(self, dtype=0, blockSize=0, profilesPerBlock=0, dataBlocksPerFile=0, nWindows=0, processFlags=0, nCohInt=0,
595 nIncohInt=0, totalSpectra=0, nHeights=0, firstHeight=0, deltaHeight=0, samplesWin=0, spectraComb=0, nCode=0,
627 nIncohInt=0, totalSpectra=0, nHeights=0, firstHeight=0, deltaHeight=0, samplesWin=0, spectraComb=0, nCode=0,
@@ -623,6 +655,7 class ProcessingHeader(Header):
623 self.flag_deflip = False
655 self.flag_deflip = False
624 self.length = 0
656 self.length = 0
625
657
658
626 def read(self, fp):
659 def read(self, fp):
627 self.length = 0
660 self.length = 0
628 try:
661 try:
@@ -77,7 +77,7 class SpectraPlot(Plot):
77 spc = 10*numpy.log10(z)
77 spc = 10*numpy.log10(z)
78
78
79 data['spc'] = spc
79 data['spc'] = spc
80 print(spc[0].shape)
80 #print(spc[0].shape)
81 data['rti'] = spc.mean(axis=1)
81 data['rti'] = spc.mean(axis=1)
82 data['noise'] = noise
82 data['noise'] = noise
83 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
83 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
@@ -309,16 +309,19 class RTIPlot(Plot):
309 try:
309 try:
310 if self.channelList != None:
310 if self.channelList != None:
311 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
311 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
312 self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
312 self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
313 self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
313 self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
314 else:
314 else:
315 self.titles = ['{} Channel {}'.format(
315 self.titles = ['{} Channel {}'.format(
316 self.CODE.upper(), x) for x in self.channelList]
316 self.CODE.upper(), x) for x in self.channelList]
317 except:
317 except:
318 if self.channelList.any() != None:
318 if self.channelList.any() != None:
319
319 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
320 self.titles = ['{} Channel {}'.format(
320 self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
321 self.CODE.upper(), x) for x in self.channelList]
321 self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
322 else:
323 self.titles = ['{} Channel {}'.format(
324 self.CODE.upper(), x) for x in self.channelList]
322
325
323 if self.decimation is None:
326 if self.decimation is None:
324 x, y, z = self.fill_gaps(self.x, self.y, self.z)
327 x, y, z = self.fill_gaps(self.x, self.y, self.z)
@@ -1002,6 +1005,7 class NoiselessRTIPlot(Plot):
1002 def update(self, dataOut):
1005 def update(self, dataOut):
1003 if len(self.channelList) == 0:
1006 if len(self.channelList) == 0:
1004 self.update_list(dataOut)
1007 self.update_list(dataOut)
1008
1005 data = {}
1009 data = {}
1006 meta = {}
1010 meta = {}
1007 #print(dataOut.max_nIncohInt, dataOut.nIncohInt)
1011 #print(dataOut.max_nIncohInt, dataOut.nIncohInt)
@@ -1037,9 +1041,12 class NoiselessRTIPlot(Plot):
1037 self.CODE.upper(), x) for x in self.channelList]
1041 self.CODE.upper(), x) for x in self.channelList]
1038 except:
1042 except:
1039 if self.channelList.any() != None:
1043 if self.channelList.any() != None:
1040
1044 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
1041 self.titles = ['{} Channel {}'.format(
1045 self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
1042 self.CODE.upper(), x) for x in self.channelList]
1046 self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
1047 else:
1048 self.titles = ['{} Channel {}'.format(
1049 self.CODE.upper(), x) for x in self.channelList]
1043
1050
1044
1051
1045 if self.decimation is None:
1052 if self.decimation is None:
@@ -21,7 +21,7 try:
21 except:
21 except:
22 from time import sleep
22 from time import sleep
23
23
24 from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader
24 from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader,ProcessingHeader
25 from schainpy.model.data.jrodata import Voltage
25 from schainpy.model.data.jrodata import Voltage
26 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
26 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
27 from numpy import imag
27 from numpy import imag
@@ -94,10 +94,11 class AMISRReader(ProcessingUnit):
94 code = None,
94 code = None,
95 nCode = 1,
95 nCode = 1,
96 nBaud = 0,
96 nBaud = 0,
97 nOsamp = None,
97 online=False,
98 online=False,
98 old_beams=False,
99 old_beams=False,
99 margin_days=1,
100 margin_days=1,
100 nFFT = 1,
101 nFFT = None,
101 nChannels = None,
102 nChannels = None,
102 ):
103 ):
103
104
@@ -110,6 +111,7 class AMISRReader(ProcessingUnit):
110 self.code = code
111 self.code = code
111 self.nCode = int(nCode)
112 self.nCode = int(nCode)
112 self.nBaud = int(nBaud)
113 self.nBaud = int(nBaud)
114 self.nOsamp = int(nOsamp)
113 self.margin_days = margin_days
115 self.margin_days = margin_days
114 self.__sampleRate = None
116 self.__sampleRate = None
115
117
@@ -154,7 +156,7 class AMISRReader(ProcessingUnit):
154
156
155 header = 'Raw11/Data/RadacHeader'
157 header = 'Raw11/Data/RadacHeader'
156 if self.nChannels == None:
158 if self.nChannels == None:
157 expFile = fp['Setup/ExperimentFile'][()].decode()
159 expFile = fp['Setup/Experimentfile'][()].decode()
158 linesExp = expFile.split("\n")
160 linesExp = expFile.split("\n")
159 a = [line for line in linesExp if "nbeamcodes" in line]
161 a = [line for line in linesExp if "nbeamcodes" in line]
160 self.nChannels = int(a[0][11:])
162 self.nChannels = int(a[0][11:])
@@ -164,6 +166,8 class AMISRReader(ProcessingUnit):
164 self.beamcodeFile = fp['Setup/Beamcodefile'][()].decode()
166 self.beamcodeFile = fp['Setup/Beamcodefile'][()].decode()
165 self.trueBeams = self.beamcodeFile.split("\n")
167 self.trueBeams = self.beamcodeFile.split("\n")
166 self.trueBeams.pop()#remove last
168 self.trueBeams.pop()#remove last
169 if self.nFFT == None:
170 log.error("FFT or number of repetitions per channels is needed",self.name)
167 beams_idx = [k*self.nFFT for k in range(self.nChannels)]
171 beams_idx = [k*self.nFFT for k in range(self.nChannels)]
168 beams = [self.trueBeams[b] for b in beams_idx]
172 beams = [self.trueBeams[b] for b in beams_idx]
169 self.beamCode = [int(x, 16) for x in beams]
173 self.beamCode = [int(x, 16) for x in beams]
@@ -191,7 +195,7 class AMISRReader(ProcessingUnit):
191 self.timeStatus = fp.get(header+'/TimeStatus')# NOT USE FOR THIS
195 self.timeStatus = fp.get(header+'/TimeStatus')# NOT USE FOR THIS
192 self.rangeFromFile = fp.get('Raw11/Data/Samples/Range')
196 self.rangeFromFile = fp.get('Raw11/Data/Samples/Range')
193 self.frequency = fp.get('Rx/Frequency')
197 self.frequency = fp.get('Rx/Frequency')
194 txAus = fp.get('Raw11/Data/Pulsewidth')
198 txAus = fp.get('Raw11/Data/Pulsewidth') #seconds
195 self.baud = fp.get('Raw11/Data/TxBaud')
199 self.baud = fp.get('Raw11/Data/TxBaud')
196 sampleRate = fp.get('Rx/SampleRate')
200 sampleRate = fp.get('Rx/SampleRate')
197 self.__sampleRate = sampleRate[()]
201 self.__sampleRate = sampleRate[()]
@@ -207,7 +211,9 class AMISRReader(ProcessingUnit):
207
211
208 #filling radar controller header parameters
212 #filling radar controller header parameters
209 self.__ippKm = self.ippSeconds *.15*1e6 # in km
213 self.__ippKm = self.ippSeconds *.15*1e6 # in km
210 self.__txA = (txAus[()])*.15 #(ipp[us]*.15km/1us) in km
214 #self.__txA = txAus[()]*.15 #(ipp[us]*.15km/1us) in km
215 self.__txA = txAus[()] #seconds
216 self.__txAKm = self.__txA*1e6*.15
211 self.__txB = 0
217 self.__txB = 0
212 nWindows=1
218 nWindows=1
213 self.__nSamples = self.nsa
219 self.__nSamples = self.nsa
@@ -224,6 +230,7 class AMISRReader(ProcessingUnit):
224 self.__codeType = 1
230 self.__codeType = 1
225 self.__nCode = self.nCode
231 self.__nCode = self.nCode
226 self.__nBaud = self.nBaud
232 self.__nBaud = self.nBaud
233 self.__baudTX = self.__txA/(self.nBaud)
227 #self.__code = 0
234 #self.__code = 0
228
235
229 #filling system header parameters
236 #filling system header parameters
@@ -493,10 +500,12 class AMISRReader(ProcessingUnit):
493 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
500 new_block = numpy.empty((nblocks, nchan, numpy.int_(self.newProfiles), nsamples), dtype="complex64")
494 ############################################
501 ############################################
495 profPerCH = int(self.profPerBlockRAW / (self.nFFT* self.nChannels))
502 profPerCH = int(self.profPerBlockRAW / (self.nFFT* self.nChannels))
496
503 #profPerCH = int(self.profPerBlockRAW / self.nChannels)
497 for thisChannel in range(nchan):
504 for thisChannel in range(nchan):
498
505
499 idx_ch = [thisChannel+(k*nchan*self.nFFT) for k in range(profPerCH)]
506
507 idx_ch = [self.nFFT*(thisChannel + nchan*k) for k in range(profPerCH)]
508 #print(idx_ch)
500 if self.nFFT > 1:
509 if self.nFFT > 1:
501 aux = [numpy.arange(i, i+self.nFFT) for i in idx_ch]
510 aux = [numpy.arange(i, i+self.nFFT) for i in idx_ch]
502 idx_ch = None
511 idx_ch = None
@@ -522,17 +531,7 class AMISRReader(ProcessingUnit):
522 def fillJROHeader(self):
531 def fillJROHeader(self):
523
532
524 #fill radar controller header
533 #fill radar controller header
525 self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ipp=self.__ippKm,
534
526 txA=self.__txA,
527 txB=0,
528 nWindows=1,
529 nHeights=self.__nSamples,
530 firstHeight=self.__firstHeight,
531 deltaHeight=self.__deltaHeight,
532 codeType=self.__codeType,
533 nCode=self.__nCode, nBaud=self.__nBaud,
534 code = self.__code,
535 fClock=self.__sampleRate)
536 #fill system header
535 #fill system header
537 self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples,
536 self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples,
538 nProfiles=self.newProfiles,
537 nProfiles=self.newProfiles,
@@ -552,6 +551,7 class AMISRReader(ProcessingUnit):
552 ranges = numpy.reshape(self.rangeFromFile[()],(-1))
551 ranges = numpy.reshape(self.rangeFromFile[()],(-1))
553 self.dataOut.heightList = ranges/1000.0 #km
552 self.dataOut.heightList = ranges/1000.0 #km
554 self.dataOut.channelList = self.__channelList
553 self.dataOut.channelList = self.__channelList
554
555 self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights
555 self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights
556
556
557 # self.dataOut.channelIndexList = None
557 # self.dataOut.channelIndexList = None
@@ -560,6 +560,10 class AMISRReader(ProcessingUnit):
560 self.dataOut.azimuthList = numpy.array(self.azimuthList)
560 self.dataOut.azimuthList = numpy.array(self.azimuthList)
561 self.dataOut.elevationList = numpy.array(self.elevationList)
561 self.dataOut.elevationList = numpy.array(self.elevationList)
562 self.dataOut.codeList = numpy.array(self.beamCode)
562 self.dataOut.codeList = numpy.array(self.beamCode)
563
564
565
566
563 #print(self.dataOut.elevationList)
567 #print(self.dataOut.elevationList)
564 self.dataOut.flagNoData = True
568 self.dataOut.flagNoData = True
565
569
@@ -581,14 +585,37 class AMISRReader(ProcessingUnit):
581 self.dataOut.flagDeflipData = False #asumo que la data esta sin flip
585 self.dataOut.flagDeflipData = False #asumo que la data esta sin flip
582 self.dataOut.flagShiftFFT = False
586 self.dataOut.flagShiftFFT = False
583 self.dataOut.ippSeconds = self.ippSeconds
587 self.dataOut.ippSeconds = self.ippSeconds
584 self.dataOut.radar_ipp = self.ippSeconds
588 self.dataOut.ipp = self.__ippKm
585 self.dataOut.pulseLength_TxA = self.__txA/0.15
589
586 self.dataOut.deltaHeight = self.__deltaHeight
587 #Time interval between profiles
588 #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt
589
590
590 self.dataOut.frequency = self.__frequency
591 self.dataOut.frequency = self.__frequency
591 self.dataOut.realtime = self.online
592 self.dataOut.realtime = self.online
593
594 self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ipp=self.__ippKm,
595 txA=self.__txAKm,
596 txB=0,
597 nWindows=1,
598 nHeights=self.__nSamples,
599 firstHeight=self.__firstHeight,
600 codeType=self.__codeType,
601 nCode=self.__nCode, nBaud=self.__nBaud,
602 code = self.__code,
603 nOsamp=self.nOsamp,
604 frequency = self.__frequency,
605 sampleRate= self.__sampleRate,
606 fClock=self.__sampleRate)
607
608
609 self.dataOut.radarControllerHeaderObj.heightList = ranges/1000.0 #km
610 self.dataOut.radarControllerHeaderObj.heightResolution = self.__deltaHeight
611 self.dataOut.radarControllerHeaderObj.rangeIpp = self.__ippKm #km
612 self.dataOut.radarControllerHeaderObj.rangeTxA = self.__txA*1e6*.15 #km
613 self.dataOut.radarControllerHeaderObj.nChannels = self.nchannels
614 self.dataOut.radarControllerHeaderObj.channelList = self.__channelList
615 self.dataOut.radarControllerHeaderObj.azimuthList = self.azimuthList
616 self.dataOut.radarControllerHeaderObj.elevationList = self.elevationList
617 self.dataOut.radarControllerHeaderObj.dtype = "Voltage"
618 self.dataOut.ippSeconds = self.ippSeconds
592 pass
619 pass
593
620
594 def readNextFile(self,online=False):
621 def readNextFile(self,online=False):
@@ -94,7 +94,7 class HDFReader(Reader, ProcessingUnit):
94 self.filefmt = "*%Y%j***"
94 self.filefmt = "*%Y%j***"
95 self.folderfmt = "*%Y%j"
95 self.folderfmt = "*%Y%j"
96 self.utcoffset = 0
96 self.utcoffset = 0
97
97 self.flagUpdateDataOut = False
98 self.dataOut = Parameters()
98 self.dataOut = Parameters()
99 self.dataOut.error=False ## NOTE: Importante definir esto antes inicio
99 self.dataOut.error=False ## NOTE: Importante definir esto antes inicio
100 self.dataOut.flagNoData = True
100 self.dataOut.flagNoData = True
@@ -147,19 +147,57 class HDFReader(Reader, ProcessingUnit):
147
147
148
148
149
149
150 # def readFirstHeader(self):
151 # '''Read metadata and data'''
152 #
153 # self.__readMetadata2()
154 # self.__readData()
155 # self.__setBlockList()
156 #
157 # for attr in self.meta:
158 # setattr(self.dataOut, attr, self.meta[attr])
159 # self.blockIndex = 0
160 #
161 # return
162
150 def readFirstHeader(self):
163 def readFirstHeader(self):
151 '''Read metadata and data'''
164 '''Read metadata and data'''
152
165
153 self.__readMetadata()
166 self.__readMetadata2()
154 self.__readData()
167 self.__readData()
155 self.__setBlockList()
168 self.__setBlockList()
156
157 for attr in self.meta:
169 for attr in self.meta:
158 setattr(self.dataOut, attr, self.meta[attr])
170 if "processingHeaderObj" in attr:
171 self.flagUpdateDataOut=True
172 at = attr.split('.')
173 if len(at) > 1:
174 setattr(eval("self.dataOut."+at[0]),at[1], self.meta[attr])
175 else:
176 setattr(self.dataOut, attr, self.meta[attr])
159 self.blockIndex = 0
177 self.blockIndex = 0
160
178
179 if self.flagUpdateDataOut:
180 self.updateDataOut()
181
161 return
182 return
162
183
184 def updateDataOut(self):
185 self.dataOut.azimuthList = self.dataOut.processingHeaderObj.azimuthList
186 self.dataOut.elevationList = self.dataOut.processingHeaderObj.elevationList
187 self.dataOut.heightList = self.dataOut.processingHeaderObj.heightList
188 self.dataOut.ippSeconds = self.dataOut.processingHeaderObj.ipp
189 self.dataOut.elevationList = self.dataOut.processingHeaderObj.elevationList
190 self.dataOut.channelList = self.dataOut.processingHeaderObj.channelList
191 self.dataOut.nCohInt = self.dataOut.processingHeaderObj.nCohInt
192 self.dataOut.nFFTPoints = self.dataOut.processingHeaderObj.nFFTPoints
193 self.flagUpdateDataOut = False
194 self.dataOut.frequency = self.dataOut.radarControllerHeaderObj.frequency
195 #self.dataOut.heightList = self.dataOut.processingHeaderObj.heightList
196
197
198 return
199
200
163 def __setBlockList(self):
201 def __setBlockList(self):
164 '''
202 '''
165 Selects the data within the times defined
203 Selects the data within the times defined
@@ -214,6 +252,38 class HDFReader(Reader, ProcessingUnit):
214 return
252 return
215
253
216
254
255 def __readMetadata2(self):
256 '''
257 Reads Metadata
258 '''
259
260 meta = {}
261
262 if self.description:
263 for key, value in self.description['Metadata'].items():
264 meta[key] = self.fp[value][()]
265 else:
266 grp = self.fp['Metadata']
267 for item in grp.values():
268 name = item.name
269 if isinstance(item, h5py.Dataset):
270 name = name.split("/")[-1]
271 meta[name] = item[()]
272 else:
273 grp2 = self.fp[name]
274 Obj = name.split("/")[-1]
275
276 for item2 in grp2.values():
277 name2 = Obj+"."+item2.name.split("/")[-1]
278 meta[name2] = item2[()]
279
280 if self.extras:
281 for key, value in self.extras.items():
282 meta[key] = value
283 self.meta = meta
284 #print(meta)
285 return
286
217
287
218 def checkForRealPath(self, nextFile, nextDay):
288 def checkForRealPath(self, nextFile, nextDay):
219
289
@@ -406,6 +476,8 class HDFWriter(Operation):
406 if self.metadataList is None:
476 if self.metadataList is None:
407 self.metadataList = self.dataOut.metadata_list
477 self.metadataList = self.dataOut.metadata_list
408
478
479 self.metadataList = list(set(self.metadataList))
480
409 tableList = []
481 tableList = []
410 dsList = []
482 dsList = []
411
483
@@ -587,6 +659,56 class HDFWriter(Operation):
587 grp.create_dataset(self.getLabel(self.metadataList[i]), data=value)
659 grp.create_dataset(self.getLabel(self.metadataList[i]), data=value)
588 return
660 return
589
661
662 def writeMetadata2(self, fp):
663
664 if self.description:
665 if 'Metadata' in self.description:
666 grp = fp.create_group('Metadata')
667 else:
668 grp = fp
669 else:
670 grp = fp.create_group('Metadata')
671
672
673 for i in range(len(self.metadataList)):
674
675 attribute = self.metadataList[i]
676 attr = attribute.split('.')
677 if len(attr) > 1:
678 if not hasattr(eval("self.dataOut."+attr[0]),attr[1]):
679 log.warning('Metadata: {}.{} not found'.format(attr[0],attr[1]), self.name)
680 continue
681 value = getattr(eval("self.dataOut."+attr[0]),attr[1])
682 if isinstance(value, bool):
683 if value is True:
684 value = 1
685 else:
686 value = 0
687 if isinstance(value,type(None)):
688 log.warning("Invalid value detected, {} is None".format(attribute), self.name)
689 value = 0
690 grp2 = None
691 if not 'Metadata/'+attr[0] in fp:
692 grp2 = fp.create_group('Metadata/'+attr[0])
693 else:
694 grp2 = fp['Metadata/'+attr[0]]
695 #print("attribute: ", attribute, value)
696 grp2.create_dataset(attr[1], data=value)
697
698 else:
699 if not hasattr(self.dataOut, attr[0] ):
700 log.warning('Metadata: `{}` not found'.format(attribute), self.name)
701 continue
702 value = getattr(self.dataOut, attr[0])
703 if isinstance(value, bool):
704 if value is True:
705 value = 1
706 else:
707 value = 0
708 grp.create_dataset(self.getLabel(attribute), data=value)
709
710 return
711
590 def writeData(self, fp):
712 def writeData(self, fp):
591
713
592 if self.description:
714 if self.description:
@@ -649,7 +771,7 class HDFWriter(Operation):
649 #Setting HDF5 File
771 #Setting HDF5 File
650 self.fp = h5py.File(self.filename, 'w')
772 self.fp = h5py.File(self.filename, 'w')
651 #write metadata
773 #write metadata
652 self.writeMetadata(self.fp)
774 self.writeMetadata2(self.fp)
653 #Write data
775 #Write data
654 self.writeData(self.fp)
776 self.writeData(self.fp)
655 log.log('Block No. {}/{} --> {}'.format(self.blockIndex+1, self.blocksPerFile,self.dataOut.datatime.ctime()), self.name)
777 log.log('Block No. {}/{} --> {}'.format(self.blockIndex+1, self.blocksPerFile,self.dataOut.datatime.ctime()), self.name)
@@ -123,6 +123,12 class MergeH5(object):
123 self.filefmt = "*%Y%j***"
123 self.filefmt = "*%Y%j***"
124 self.folderfmt = "*%Y%j"
124 self.folderfmt = "*%Y%j"
125
125
126 self.flag_spc = False
127 self.flag_pow = False
128 self.flag_snr = False
129 self.flag_nIcoh = False
130 self.flagProcessingHeader = False
131 self.flagControllerHeader = False
126
132
127 def setup(self):
133 def setup(self):
128
134
@@ -187,12 +193,25 class MergeH5(object):
187
193
188 '''Read metadata and data'''
194 '''Read metadata and data'''
189
195
190 self.readMetadata(fp)
196 self.readMetadata(fp,ch)
197 #print(self.metadataList)
191 data = self.readData(fp)
198 data = self.readData(fp)
192
199
193
200
194 for attr in self.meta:
201 for attr in self.meta:
195 setattr(self.ch_dataIn[ch], attr, self.meta[attr])
202
203 if "processingHeaderObj" in attr:
204 self.flagProcessingHeader=True
205
206 if "radarControllerHeaderObj" in attr:
207 self.flagControllerHeader=True
208
209 at = attr.split('.')
210 #print("AT ", at)
211 if len(at) > 1:
212 setattr(eval("self.ch_dataIn[ch]."+at[0]),at[1], self.meta[attr])
213 else:
214 setattr(self.ch_dataIn[ch], attr, self.meta[attr])
196
215
197 self.fill_dataIn(data, self.ch_dataIn[ch])
216 self.fill_dataIn(data, self.ch_dataIn[ch])
198
217
@@ -200,33 +219,57 class MergeH5(object):
200 return
219 return
201
220
202
221
203 def readMetadata(self, fp):
222 def readMetadata(self, fp, ch):
204 '''
223 '''
205 Reads Metadata
224 Reads Metadata
206 '''
225 '''
207 meta = {}
226 meta = {}
208 self.metadataList = []
227 self.metadataList = []
209 grp = fp['Metadata']
228 grp = fp['Metadata']
210 for name in grp:
229 for item in grp.values():
211 meta[name] = grp[name][()]
230 name = item.name
212 self.metadataList.append(name)
231
232 if isinstance(item, h5py.Dataset):
233 name = name.split("/")[-1]
234 if 'List' in name:
235 meta[name] = item[()].tolist()
236 else:
237 meta[name] = item[()]
238 self.metadataList.append(name)
239 else:
240 grp2 = fp[name]
241 Obj = name.split("/")[-1]
242 #print(Obj)
243 for item2 in grp2.values():
244 name2 = Obj+"."+item2.name.split("/")[-1]
245 if 'List' in name2:
246 meta[name2] = item2[()].tolist()
247 else:
248 meta[name2] = item2[()]
249 self.metadataList.append(name2)
250
251
213
252
214 for k in meta:
215 if ('List' in k):
216 meta[k] = meta[k].tolist()
217 if not self.meta:
253 if not self.meta:
218 self.meta = meta
254 self.meta = meta.copy()
219 self.meta["channelList"] =[n for n in range(self.nChannels)]
255 for key in list(self.meta.keys()):
256 if "channelList" in key:
257 self.meta["channelList"] =[n for n in range(self.nChannels)]
258 if "processingHeaderObj" in key:
259 self.meta["processingHeaderObj.channelList"] =[n for n in range(self.nChannels)]
260 if "radarControllerHeaderObj" in key:
261 self.meta["radarControllerHeaderObj.channelList"] =[n for n in range(self.nChannels)]
220 return 1
262 return 1
263
221 else:
264 else:
222 if len(self.meta) == len(meta):
223 for k in meta:
224 if 'List' in k and 'channel' not in k and "height" not in k:
225 self.meta[k] += meta[k]
226
265
227 return 1
266 for k in list(self.meta.keys()):
228 else:
267 if 'List' in k and 'channel' not in k and "height" not in k and "radarControllerHeaderObj" not in k:
229 return 0
268 self.meta[k] += meta[k]
269
270 #print("Metadata: ",self.meta)
271 return 1
272
230
273
231
274
232
275
@@ -237,17 +280,23 class MergeH5(object):
237 setattr(dataIn, attr, data[attr][:])
280 setattr(dataIn, attr, data[attr][:])
238 else:
281 else:
239 setattr(dataIn, attr, numpy.squeeze(data[attr][:,:]))
282 setattr(dataIn, attr, numpy.squeeze(data[attr][:,:]))
240 print("shape in", dataIn.data_spc.shape, len(dataIn.data_spc))
283 #print("shape in", dataIn.data_spc.shape, len(dataIn.data_spc))
241 if dataIn.data_spc.ndim > 3:
284 if self.flag_spc:
242 dataIn.data_spc = dataIn.data_spc[0]
285 if dataIn.data_spc.ndim > 3:
243 #print("shape in", dataIn.data_spc.shape)
286 dataIn.data_spc = dataIn.data_spc[0]
287 #print("shape in", dataIn.data_spc.shape)
244
288
245
289
246
290
247 def getBlocksPerFile(self):
291 def getBlocksPerFile(self):
248 b = numpy.zeros(self.nChannels)
292 b = numpy.zeros(self.nChannels)
249 for i in range(self.nChannels):
293 for i in range(self.nChannels):
250 b[i] = self.ch_dataIn[i].data_spc.shape[0] #number of blocks
294 if self.flag_spc:
295 b[i] = self.ch_dataIn[i].data_spc.shape[0] #number of blocks
296 elif self.flag_pow:
297 b[i] = self.ch_dataIn[i].data_pow.shape[0] #number of blocks
298 elif self.flag_snr:
299 b[i] = self.ch_dataIn[i].data_snr.shape[0] #number of blocks
251
300
252 self.blocksPerFile = int(b.min())
301 self.blocksPerFile = int(b.min())
253 iresh_ch = numpy.where(b > self.blocksPerFile)[0]
302 iresh_ch = numpy.where(b > self.blocksPerFile)[0]
@@ -307,6 +356,12 class MergeH5(object):
307 grp = fp['Data']
356 grp = fp['Data']
308
357
309 for name in grp:
358 for name in grp:
359 if "spc" in name:
360 self.flag_spc = True
361 if "pow" in name:
362 self.flag_pow = True
363 if "snr" in name:
364 self.flag_snr = True
310 if isinstance(grp[name], h5py.Dataset):
365 if isinstance(grp[name], h5py.Dataset):
311 array = grp[name][()]
366 array = grp[name][()]
312 elif isinstance(grp[name], h5py.Group):
367 elif isinstance(grp[name], h5py.Group):
@@ -323,70 +378,153 class MergeH5(object):
323 def getDataOut(self):
378 def getDataOut(self):
324
379
325 self.dataOut = self.ch_dataIn[0].copy() #dataIn #blocks, fft, hei for metadata
380 self.dataOut = self.ch_dataIn[0].copy() #dataIn #blocks, fft, hei for metadata
326 if self.dataOut.data_spc.ndim < 3:
381 if self.flagProcessingHeader:
327 return 0
382 self.dataOut.processingHeaderObj = self.ch_dataIn[0].processingHeaderObj.copy()
383 self.dataOut.heightList = self.dataOut.processingHeaderObj.heightList
384 self.dataOut.ippSeconds = self.dataOut.processingHeaderObj.ipp
385 self.dataOut.channelList = self.dataOut.processingHeaderObj.channelList
386 self.dataOut.nCohInt = self.dataOut.processingHeaderObj.nCohInt
387 self.dataOut.nFFTPoints = self.dataOut.processingHeaderObj.nFFTPoints
388
389 if self.flagControllerHeader:
390 self.dataOut.radarControllerHeaderObj = self.ch_dataIn[0].radarControllerHeaderObj.copy()
391 self.dataOut.frequency = self.dataOut.radarControllerHeaderObj.frequency
392 #--------------------------------------------------------------------
393
394
395 #--------------------------------------------------------------------
396 if self.flag_spc:
397 if self.dataOut.data_spc.ndim < 3:
398 print("shape spc in: ",self.dataOut.data_spc.shape )
399 return 0
400 if self.flag_pow:
401 if self.dataOut.data_pow.ndim < 2:
402 print("shape pow in: ",self.dataOut.data_pow.shape )
403 return 0
404 if self.flag_snr:
405 if self.dataOut.data_snr.ndim < 2:
406 print("shape snr in: ",self.dataOut.data_snr.shape )
407 return 0
408
328 self.dataOut.data_spc = None
409 self.dataOut.data_spc = None
410 self.dataOut.data_cspc = None
411 self.dataOut.data_pow = None
412 self.dataOut.data_snr = None
329 self.dataOut.utctim = None
413 self.dataOut.utctim = None
330 self.dataOut.nIncohInt = None
414 self.dataOut.nIncohInt = None
331 #print(self.ch_dataIn[0].data_spc.shape)
415 #--------------------------------------------------------------------
332 spc = [data.data_spc for data in self.ch_dataIn]
416 if self.flag_spc:
333 self.dataOut.data_spc = numpy.stack(spc, axis=1) #blocks, ch, fft, hei
417 spc = [data.data_spc for data in self.ch_dataIn]
418 self.dataOut.data_spc = numpy.stack(spc, axis=1) #blocks, ch, fft, hei
419 #--------------------------------------------------------------------
420 if self.flag_pow:
421 pow = [data.data_pow for data in self.ch_dataIn]
422 self.dataOut.data_pow = numpy.stack(pow, axis=1) #blocks, ch, fft, hei
423 #--------------------------------------------------------------------
424 if self.flag_snr:
425 snr = [data.data_snr for data in self.ch_dataIn]
426 self.dataOut.data_snr = numpy.stack(snr, axis=1) #blocks, ch, fft, hei
427
428 #--------------------------------------------------------------------
334 time = [data.utctime for data in self.ch_dataIn]
429 time = [data.utctime for data in self.ch_dataIn]
335 time = numpy.asarray(time).mean(axis=0)
430 time = numpy.asarray(time).mean(axis=0)
336 #time = numpy.reshape(time, (len(time),1))
337 time = numpy.squeeze(time)
431 time = numpy.squeeze(time)
338 self.dataOut.utctime = time
432 self.dataOut.utctime = time
339 ints = [data.nIncohInt for data in self.ch_dataIn]
433 #--------------------------------------------------------------------
340 self.dataOut.nIncohInt = numpy.stack(ints, axis=1)
434 if self.flag_nIcoh:
341
435 ints = [data.nIncohInt for data in self.ch_dataIn]
342
436 self.dataOut.nIncohInt = numpy.stack(ints, axis=1)
343 if self.dataOut.nIncohInt.ndim > 3:
437
344 aux = self.dataOut.nIncohInt
438 if self.dataOut.nIncohInt.ndim > 3:
345 self.dataOut.nIncohInt = None
439 aux = self.dataOut.nIncohInt
346 self.dataOut.nIncohInt = aux[0]
440 self.dataOut.nIncohInt = None
347
441 self.dataOut.nIncohInt = aux[0]
442
443 if self.dataOut.nIncohInt.ndim < 3:
444 nIncohInt = numpy.repeat(self.dataOut.nIncohInt, self.dataOut.nHeights).reshape(self.blocksPerFile,self.nChannels, self.dataOut.nHeights)
445 #nIncohInt = numpy.reshape(nIncohInt, (self.blocksPerFile,self.nChannels, self.dataOut.nHeights))
446 self.dataOut.nIncohInt = None
447 self.dataOut.nIncohInt = nIncohInt
448
449 if (self.dataOut.nIncohInt.shape)[0]==self.nChannels: ## ch,blocks, hei
450 self.dataOut.nIncohInt = numpy.swapaxes(self.dataOut.nIncohInt, 0, 1) ## blocks,ch, hei
451 #--------------------------------------------------------------------
452 #print("utcTime: ", time.shape)
453 #print("data_spc ",self.dataOut.data_spc.shape)
454 if "data_cspc" in self.dataList:
455 pairsList = [pair for pair in itertools.combinations(self.channelList, 2)]
456 #print("PairsList: ", pairsList)
457 self.dataOut.pairsList = pairsList
458 cspc = []
348
459
349 if self.dataOut.nIncohInt.ndim < 3:
460 for i, j in pairsList:
350 nIncohInt = numpy.repeat(self.dataOut.nIncohInt, self.dataOut.nHeights).reshape(self.blocksPerFile,self.nChannels, self.dataOut.nHeights)
461 cspc.append(self.ch_dataIn[i].data_spc*numpy.conjugate(self.ch_dataIn[j].data_spc)) #blocks, fft, hei
351 #nIncohInt = numpy.reshape(nIncohInt, (self.blocksPerFile,self.nChannels, self.dataOut.nHeights))
352 self.dataOut.nIncohInt = None
353 self.dataOut.nIncohInt = nIncohInt
354
462
355 if (self.dataOut.nIncohInt.shape)[0]==self.nChannels: ## ch,blocks, hei
463 cspc = numpy.asarray(cspc) # # pairs, blocks, fft, hei
356 self.dataOut.nIncohInt = numpy.swapaxes(self.dataOut.nIncohInt, 0, 1) ## blocks,ch, hei
464 #print("cspc: ",cspc.shape)
465 self.dataOut.data_cspc = numpy.swapaxes(cspc, 0, 1) ## blocks, pairs, fft, hei
466 #print("dataOut.data_cspc: ",self.dataOut.data_cspc.shape)
467 #if "data_pow" in self.dataList:
357
468
358 #print("utcTime: ", time.shape)
359 #print("data_spc ",self.dataOut.data_spc.shape)
360 pairsList = [pair for pair in itertools.combinations(self.channelList, 2)]
361 #print("PairsList: ", pairsList)
362 self.dataOut.pairsList = pairsList
363 cspc = []
364
365 for i, j in pairsList:
366 cspc.append(self.ch_dataIn[i].data_spc*numpy.conjugate(self.ch_dataIn[j].data_spc)) #blocks, fft, hei
367
368 cspc = numpy.asarray(cspc) # # pairs, blocks, fft, hei
369 #print("cspc: ",cspc.shape)
370 self.dataOut.data_cspc = numpy.swapaxes(cspc, 0, 1) ## blocks, pairs, fft, hei
371 #print("dataOut.data_cspc: ",self.dataOut.data_cspc.shape)
372 return 1
469 return 1
373
470
471 # def writeMetadata(self, fp):
472 #
473 #
474 # grp = fp.create_group('Metadata')
475 #
476 # for i in range(len(self.metadataList)):
477 # if not hasattr(self.dataOut, self.metadataList[i]):
478 # print('Metadata: `{}` not found'.format(self.metadataList[i]))
479 # continue
480 # value = getattr(self.dataOut, self.metadataList[i])
481 # if isinstance(value, bool):
482 # if value is True:
483 # value = 1
484 # else:
485 # value = 0
486 # grp.create_dataset(self.getLabel(self.metadataList[i]), data=value)
487 # return
374 def writeMetadata(self, fp):
488 def writeMetadata(self, fp):
375
489
376
490
377 grp = fp.create_group('Metadata')
491 grp = fp.create_group('Metadata')
378
492
379 for i in range(len(self.metadataList)):
493 for i in range(len(self.metadataList)):
380 if not hasattr(self.dataOut, self.metadataList[i]):
494 attribute = self.metadataList[i]
381 print('Metadata: `{}` not found'.format(self.metadataList[i]))
495 attr = attribute.split('.')
382 continue
496 if '' in attr:
383 value = getattr(self.dataOut, self.metadataList[i])
497 attr.remove('')
384 if isinstance(value, bool):
498 #print(attr)
385 if value is True:
499 if len(attr) > 1:
386 value = 1
500 if not hasattr(eval("self.dataOut."+attr[0]),attr[1]):
501 print('Metadata: {}.{} not found'.format(attr[0],attr[1]))
502 continue
503 value = getattr(eval("self.dataOut."+attr[0]),attr[1])
504 if isinstance(value, bool):
505 if value is True:
506 value = 1
507 else:
508 value = 0
509 grp2 = None
510 if not 'Metadata/'+attr[0] in fp:
511 grp2 = fp.create_group('Metadata/'+attr[0])
387 else:
512 else:
388 value = 0
513 grp2 = fp['Metadata/'+attr[0]]
389 grp.create_dataset(self.getLabel(self.metadataList[i]), data=value)
514
515 grp2.create_dataset(attr[1], data=value)
516
517 else:
518 if not hasattr(self.dataOut, attr[0] ):
519 print('Metadata: `{}` not found'.format(attribute))
520 continue
521 value = getattr(self.dataOut, attr[0])
522 if isinstance(value, bool):
523 if value is True:
524 value = 1
525 else:
526 value = 0
527 grp.create_dataset(self.getLabel(attribute), data=value)
390 return
528 return
391
529
392 def getDsList(self):
530 def getDsList(self):
@@ -69,14 +69,14 class ParametersProc(ProcessingUnit):
69 self.dataOut.dstFlag = self.dataIn.dstFlag
69 self.dataOut.dstFlag = self.dataIn.dstFlag
70 self.dataOut.errorCount = self.dataIn.errorCount
70 self.dataOut.errorCount = self.dataIn.errorCount
71 self.dataOut.useLocalTime = self.dataIn.useLocalTime
71 self.dataOut.useLocalTime = self.dataIn.useLocalTime
72 self.dataOut.radar_ipp = self.dataIn.radar_ipp
72
73 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
73 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
74 #self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
74 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
75 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
75 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
76 self.dataOut.channelList = self.dataIn.channelList
76 self.dataOut.channelList = self.dataIn.channelList
77 self.dataOut.heightList = self.dataIn.heightList
77 self.dataOut.heightList = self.dataIn.heightList
78 self.dataOut.sampled_heightsFFT = self.dataIn.sampled_heightsFFT
78 self.dataOut.ipp = self.dataIn.ipp
79 self.dataOut.pulseLength_TxA = self.dataIn.pulseLength_TxA
79 self.dataOut.ippSeconds = self.dataIn.ippSeconds
80 self.dataOut.deltaHeight = self.dataIn.deltaHeight
80 self.dataOut.deltaHeight = self.dataIn.deltaHeight
81 self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')])
81 self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')])
82 # self.dataOut.nHeights = self.dataIn.nHeights
82 # self.dataOut.nHeights = self.dataIn.nHeights
@@ -103,7 +103,7 class ParametersProc(ProcessingUnit):
103 self.dataOut.elevationList = self.dataIn.elevationList
103 self.dataOut.elevationList = self.dataIn.elevationList
104
104
105 def run(self):
105 def run(self):
106 # print("run parameter proc")
106 #print("run parameter proc")
107 #---------------------- Voltage Data ---------------------------
107 #---------------------- Voltage Data ---------------------------
108 #print(self.dataIn.flagNoData)
108 #print(self.dataIn.flagNoData)
109 if self.dataIn.type == "Voltage":
109 if self.dataIn.type == "Voltage":
@@ -141,12 +141,8 class ParametersProc(ProcessingUnit):
141 self.dataOut.nIncohInt = self.dataIn.nIncohInt
141 self.dataOut.nIncohInt = self.dataIn.nIncohInt
142 self.dataOut.nFFTPoints = self.dataIn.nFFTPoints
142 self.dataOut.nFFTPoints = self.dataIn.nFFTPoints
143 self.dataOut.ippFactor = self.dataIn.ippFactor
143 self.dataOut.ippFactor = self.dataIn.ippFactor
144 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
144
145 #self.dataOut.radarControllerHeaderTxt = self.dataOut.radarControllerHeaderObj.toString()
145
146 self.dataOut.ipp = self.dataIn.ipp
147 self.dataOut.radar_ipp = self.dataIn.radar_ipp
148 self.dataOut.sampled_heightsFFT = self.dataIn.sampled_heightsFFT
149 self.dataOut.pulseLength_TxA = self.dataIn.pulseLength_TxA
150 self.dataOut.deltaHeight = self.dataIn.deltaHeight
146 self.dataOut.deltaHeight = self.dataIn.deltaHeight
151 self.dataOut.abscissaList = self.dataIn.getVelRange(1)
147 self.dataOut.abscissaList = self.dataIn.getVelRange(1)
152 self.dataOut.spc_noise = self.dataIn.getNoise()
148 self.dataOut.spc_noise = self.dataIn.getNoise()
@@ -202,6 +198,7 class ParametersProc(ProcessingUnit):
202 return True
198 return True
203
199
204 self.__updateObjFromInput()
200 self.__updateObjFromInput()
201
205 self.dataOut.utctimeInit = self.dataIn.utctime
202 self.dataOut.utctimeInit = self.dataIn.utctime
206 self.dataOut.paramInterval = self.dataIn.timeInterval
203 self.dataOut.paramInterval = self.dataIn.timeInterval
207
204
@@ -37,6 +37,7 class SpectraProc(ProcessingUnit):
37 self.id_min = None
37 self.id_min = None
38 self.id_max = None
38 self.id_max = None
39 self.setupReq = False #Agregar a todas las unidades de proc
39 self.setupReq = False #Agregar a todas las unidades de proc
40 self.nsamplesFFT = 0
40
41
41 def __updateSpecFromVoltage(self):
42 def __updateSpecFromVoltage(self):
42
43
@@ -46,11 +47,11 class SpectraProc(ProcessingUnit):
46 self.dataOut.dstFlag = self.dataIn.dstFlag
47 self.dataOut.dstFlag = self.dataIn.dstFlag
47 self.dataOut.errorCount = self.dataIn.errorCount
48 self.dataOut.errorCount = self.dataIn.errorCount
48 self.dataOut.useLocalTime = self.dataIn.useLocalTime
49 self.dataOut.useLocalTime = self.dataIn.useLocalTime
49 try:
50
50 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
51 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
51 except:
52 pass
53 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
52 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
53 self.dataOut.ippSeconds = self.dataIn.ippSeconds
54 self.dataOut.ipp = self.dataIn.ipp
54 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
55 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
55 self.dataOut.channelList = self.dataIn.channelList
56 self.dataOut.channelList = self.dataIn.channelList
56 self.dataOut.heightList = self.dataIn.heightList
57 self.dataOut.heightList = self.dataIn.heightList
@@ -63,9 +64,6 class SpectraProc(ProcessingUnit):
63 self.dataOut.flagShiftFFT = False
64 self.dataOut.flagShiftFFT = False
64 self.dataOut.nCohInt = self.dataIn.nCohInt
65 self.dataOut.nCohInt = self.dataIn.nCohInt
65 self.dataOut.nIncohInt = 1
66 self.dataOut.nIncohInt = 1
66 self.dataOut.radar_ipp = self.dataIn.radar_ipp
67 self.dataOut.sampled_heightsFFT = self.dataIn.sampled_heightsFFT
68 self.dataOut.pulseLength_TxA = self.dataIn.pulseLength_TxA
69 self.dataOut.deltaHeight = self.dataIn.deltaHeight
67 self.dataOut.deltaHeight = self.dataIn.deltaHeight
70 self.dataOut.windowOfFilter = self.dataIn.windowOfFilter
68 self.dataOut.windowOfFilter = self.dataIn.windowOfFilter
71 self.dataOut.frequency = self.dataIn.frequency
69 self.dataOut.frequency = self.dataIn.frequency
@@ -131,7 +129,7 class SpectraProc(ProcessingUnit):
131 self.dataOut.flagShiftFFT = False
129 self.dataOut.flagShiftFFT = False
132
130
133 def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False, zeroPad=False):
131 def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False, zeroPad=False):
134 #print("run spc proc")
132
135
133
136 try:
134 try:
137 type = self.dataIn.type.decode("utf-8")
135 type = self.dataIn.type.decode("utf-8")
@@ -142,11 +140,15 class SpectraProc(ProcessingUnit):
142
140
143 try:
141 try:
144 self.dataOut.copy(self.dataIn)
142 self.dataOut.copy(self.dataIn)
143 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
144 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
145 self.dataOut.nProfiles = self.dataOut.nFFTPoints
145 self.dataOut.nProfiles = self.dataOut.nFFTPoints
146 #self.dataOut.nHeights = len(self.dataOut.heightList)
146 #self.dataOut.nHeights = len(self.dataOut.heightList)
147 except Exception as e:
147 except Exception as e:
148 print("Error dataIn ",e)
148 print("Error dataIn ",e)
149
149
150
151
150 if shift_fft:
152 if shift_fft:
151 #desplaza a la derecha en el eje 2 determinadas posiciones
153 #desplaza a la derecha en el eje 2 determinadas posiciones
152 shift = int(self.dataOut.nFFTPoints/2)
154 shift = int(self.dataOut.nFFTPoints/2)
@@ -162,7 +164,8 class SpectraProc(ProcessingUnit):
162 elif self.dataIn.type == "Voltage":
164 elif self.dataIn.type == "Voltage":
163
165
164 self.dataOut.flagNoData = True
166 self.dataOut.flagNoData = True
165
167 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
168 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
166 if nFFTPoints == None:
169 if nFFTPoints == None:
167 raise ValueError("This SpectraProc.run() need nFFTPoints input variable")
170 raise ValueError("This SpectraProc.run() need nFFTPoints input variable")
168
171
@@ -226,8 +229,16 class SpectraProc(ProcessingUnit):
226 self.__getFft()
229 self.__getFft()
227 self.dataOut.flagNoData = False
230 self.dataOut.flagNoData = False
228 self.firstdatatime = None
231 self.firstdatatime = None
232 self.nsamplesFFT = self.profIndex
229 self.profIndex = 0
233 self.profIndex = 0
230
234
235 #update Processing Header:
236 self.dataOut.processingHeaderObj.dtype = "Spectra"
237 self.dataOut.processingHeaderObj.nFFTPoints = self.dataOut.nFFTPoints
238 self.dataOut.processingHeaderObj.nSamplesFFT = self.nsamplesFFT
239 self.dataOut.processingHeaderObj.nIncohInt = 1
240
241
231 elif self.dataIn.type == "Parameters":
242 elif self.dataIn.type == "Parameters":
232
243
233 self.dataOut.data_spc = self.dataIn.data_spc
244 self.dataOut.data_spc = self.dataIn.data_spc
@@ -239,6 +250,8 class SpectraProc(ProcessingUnit):
239 self.dataOut.ippFactor = self.dataIn.ippFactor
250 self.dataOut.ippFactor = self.dataIn.ippFactor
240 self.dataOut.max_nIncohInt = self.dataIn.max_nIncohInt
251 self.dataOut.max_nIncohInt = self.dataIn.max_nIncohInt
241 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
252 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
253 self.dataOut.ProcessingHeader = self.dataIn.ProcessingHeader.copy()
254 self.dataOut.ippSeconds = self.dataIn.ippSeconds
242 self.dataOut.ipp = self.dataIn.ipp
255 self.dataOut.ipp = self.dataIn.ipp
243 #self.dataOut.abscissaList = self.dataIn.getVelRange(1)
256 #self.dataOut.abscissaList = self.dataIn.getVelRange(1)
244 #self.dataOut.spc_noise = self.dataIn.getNoise()
257 #self.dataOut.spc_noise = self.dataIn.getNoise()
@@ -265,7 +278,13 class SpectraProc(ProcessingUnit):
265 else:
278 else:
266 raise ValueError("The type of input object {} is not valid".format(
279 raise ValueError("The type of input object {} is not valid".format(
267 self.dataIn.type))
280 self.dataIn.type))
281
282
283
284
268 #print("spc proc Done", self.dataOut.data_spc.shape)
285 #print("spc proc Done", self.dataOut.data_spc.shape)
286 #print(self.dataOut.data_spc)
287 return
269
288
270 def __selectPairs(self, pairsList):
289 def __selectPairs(self, pairsList):
271
290
@@ -1332,6 +1351,7 class IntegrationFaradaySpectra(Operation):
1332 self.n = None
1351 self.n = None
1333 self.__byTime = True
1352 self.__byTime = True
1334
1353
1354
1335 if minHei == None:
1355 if minHei == None:
1336 minHei = self.dataOut.heightList[0]
1356 minHei = self.dataOut.heightList[0]
1337
1357
@@ -1352,7 +1372,7 class IntegrationFaradaySpectra(Operation):
1352 ind_list2 = numpy.where(self.dataOut.heightList <= maxHei)
1372 ind_list2 = numpy.where(self.dataOut.heightList <= maxHei)
1353 self.minHei_ind = ind_list1[0][0]
1373 self.minHei_ind = ind_list1[0][0]
1354 self.maxHei_ind = ind_list2[0][-1]
1374 self.maxHei_ind = ind_list2[0][-1]
1355 #print("setup rem sats done")
1375
1356
1376
1357 def putData(self, data_spc, data_cspc, data_dc):
1377 def putData(self, data_spc, data_cspc, data_dc):
1358 """
1378 """
@@ -1607,7 +1627,7 class IntegrationFaradaySpectra(Operation):
1607 self.dataOut = dataOut
1627 self.dataOut = dataOut
1608 if n == 1:
1628 if n == 1:
1609 return self.dataOut
1629 return self.dataOut
1610
1630 self.dataOut.processingHeaderObj.timeIncohInt = timeInterval
1611 #print("nchannels", self.dataOut.nChannels)
1631 #print("nchannels", self.dataOut.nChannels)
1612 if self.dataOut.nChannels == 1:
1632 if self.dataOut.nChannels == 1:
1613 self.dataOut.data_cspc = None #si es un solo canal no vale la pena acumular DATOS
1633 self.dataOut.data_cspc = None #si es un solo canal no vale la pena acumular DATOS
@@ -1661,6 +1681,11 class IntegrationFaradaySpectra(Operation):
1661
1681
1662 self.dataOut.utctime = avgdatatime
1682 self.dataOut.utctime = avgdatatime
1663 self.dataOut.flagNoData = False
1683 self.dataOut.flagNoData = False
1684
1685 # #update Processing Header:
1686 # self.dataOut.processingHeaderObj.nIncohInt =
1687 # self.dataOut.processingHeaderObj.nFFTPoints = self.dataOut.nFFTPoints
1688
1664 #print("Faraday Integration DONE...", self.dataOut.data_cspc)
1689 #print("Faraday Integration DONE...", self.dataOut.data_cspc)
1665 #print(self.dataOut.flagNoData)
1690 #print(self.dataOut.flagNoData)
1666 return self.dataOut
1691 return self.dataOut
@@ -2008,6 +2033,7 class IncohInt(Operation):
2008 self.n = None
2033 self.n = None
2009 self.__byTime = True
2034 self.__byTime = True
2010
2035
2036
2011 def putData(self, data_spc, data_cspc, data_dc):
2037 def putData(self, data_spc, data_cspc, data_dc):
2012 """
2038 """
2013 Add a profile to the __buffer_spc and increase in one the __profileIndex
2039 Add a profile to the __buffer_spc and increase in one the __profileIndex
@@ -2111,11 +2137,12 class IncohInt(Operation):
2111 return dataOut
2137 return dataOut
2112
2138
2113 dataOut.flagNoData = True
2139 dataOut.flagNoData = True
2114
2140 dataOut.processingHeaderObj.timeIncohInt = timeInterval
2115 if not self.isConfig:
2141 if not self.isConfig:
2116 self.setup(n, timeInterval, overlapping)
2142 self.setup(n, timeInterval, overlapping)
2117 self.isConfig = True
2143 self.isConfig = True
2118
2144
2145
2119 avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime,
2146 avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime,
2120 dataOut.data_spc,
2147 dataOut.data_spc,
2121 dataOut.data_cspc,
2148 dataOut.data_cspc,
@@ -30,7 +30,23 class VoltageProc(ProcessingUnit):
30 if self.dataOut.buffer_empty:
30 if self.dataOut.buffer_empty:
31 if self.dataIn.type == 'Voltage':
31 if self.dataIn.type == 'Voltage':
32 self.dataOut.copy(self.dataIn)
32 self.dataOut.copy(self.dataIn)
33 #print("new volts reading")
33 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
34 self.dataOut.ippSeconds = self.dataIn.ippSeconds
35 self.dataOut.ipp = self.dataIn.ipp
36
37 #update Processing Header:
38 self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList
39 self.dataOut.processingHeaderObj.ipp = self.dataOut.ipp
40 self.dataOut.processingHeaderObj.nCohInt = self.dataOut.nCohInt
41 self.dataOut.processingHeaderObj.dtype = self.dataOut.type
42 self.dataOut.processingHeaderObj.channelList = self.dataOut.channelList
43 self.dataOut.processingHeaderObj.azimuthList = self.dataOut.azimuthList
44 self.dataOut.processingHeaderObj.elevationList = self.dataOut.elevationList
45 self.dataOut.processingHeaderObj.codeList = self.dataOut.nChannels
46 self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList
47 self.dataOut.processingHeaderObj.heightResolution = self.dataOut.heightList[1] - self.dataOut.heightList[0]
48
49
34
50
35
51
36 def __updateObjFromAmisrInput(self):
52 def __updateObjFromAmisrInput(self):
@@ -51,9 +67,7 class VoltageProc(ProcessingUnit):
51 self.dataOut.nCohInt = self.dataIn.nCohInt
67 self.dataOut.nCohInt = self.dataIn.nCohInt
52 self.dataOut.ippSeconds = self.dataIn.ippSeconds
68 self.dataOut.ippSeconds = self.dataIn.ippSeconds
53 self.dataOut.frequency = self.dataIn.frequency
69 self.dataOut.frequency = self.dataIn.frequency
54 self.dataOut.radar_ipp = self.dataIn.radar_ipp
70
55 self.dataOut.pulseLength_TxA = self.dataIn.pulseLength_TxA
56 self.dataOut.deltaHeight = self.dataIn.deltaHeight
57 self.dataOut.azimuth = self.dataIn.azimuth
71 self.dataOut.azimuth = self.dataIn.azimuth
58 self.dataOut.zenith = self.dataIn.zenith
72 self.dataOut.zenith = self.dataIn.zenith
59
73
@@ -85,6 +99,14 class selectChannels(Operation):
85 index = dataOut.channelList.index(channel)
99 index = dataOut.channelList.index(channel)
86 channelIndexList.append(index)
100 channelIndexList.append(index)
87 dataOut = self.selectChannelsByIndex(dataOut,channelIndexList)
101 dataOut = self.selectChannelsByIndex(dataOut,channelIndexList)
102
103 #update Processing Header:
104 dataOut.processingHeaderObj.channelList = dataOut.channelList
105 dataOut.processingHeaderObj.elevationList = dataOut.elevationList
106 dataOut.processingHeaderObj.azimuthList = dataOut.azimuthList
107 dataOut.processingHeaderObj.codeList = dataOut.codeList
108 dataOut.processingHeaderObj.nChannels = len(dataOut.channelList)
109
88 return dataOut
110 return dataOut
89
111
90 def selectChannelsByIndex(self, dataOut, channelIndexList):
112 def selectChannelsByIndex(self, dataOut, channelIndexList):
@@ -221,6 +243,11 class selectHeights(Operation):
221
243
222 self.selectHeightsByIndex(minIndex, maxIndex)
244 self.selectHeightsByIndex(minIndex, maxIndex)
223
245
246 #update Processing Header:
247 dataOut.processingHeaderObj.heightList = dataOut.heightList
248
249
250
224 return dataOut
251 return dataOut
225
252
226 def selectHeightsByIndex(self, minIndex, maxIndex):
253 def selectHeightsByIndex(self, minIndex, maxIndex):
@@ -324,6 +351,10 class filterByHeights(Operation):
324 dataOut.heightList = dataOut.heightList[0] + numpy.arange( newheights )*newdelta
351 dataOut.heightList = dataOut.heightList[0] + numpy.arange( newheights )*newdelta
325 dataOut.windowOfFilter = window
352 dataOut.windowOfFilter = window
326
353
354 #update Processing Header:
355 dataOut.processingHeaderObj.heightList = dataOut.heightList
356 dataOut.processingHeaderObj.nWindows = window
357
327 return dataOut
358 return dataOut
328
359
329
360
@@ -340,6 +371,9 class setH0(Operation):
340
371
341 dataOut.heightList = newHeiRange
372 dataOut.heightList = newHeiRange
342
373
374 #update Processing Header:
375 dataOut.processingHeaderObj.heightList = dataOut.heightList
376
343 return dataOut
377 return dataOut
344
378
345
379
@@ -770,6 +804,11 class CohInt(Operation):
770 # raise
804 # raise
771 # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt
805 # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt
772 dataOut.flagNoData = False
806 dataOut.flagNoData = False
807
808 #update Processing Header:
809 dataOut.processingHeaderObj.nCohInt = dataOut.nCohInt
810
811
773 return dataOut
812 return dataOut
774
813
775 class Decoder(Operation):
814 class Decoder(Operation):
@@ -959,9 +998,16 class Decoder(Operation):
959
998
960 self.__profIndex += 1
999 self.__profIndex += 1
961
1000
962 return dataOut
1001 #update Processing Header:
963 # dataOut.flagDeflipData = True #asumo q la data no esta sin flip
1002 dataOut.radarControllerHeaderObj.code = self.code
1003 dataOut.radarControllerHeaderObj.nCode = self.nCode
1004 dataOut.radarControllerHeaderObj.nBaud = self.nBaud
1005 dataOut.radarControllerHeaderObj.nOsamp = osamp
1006 #update Processing Header:
1007 dataOut.processingHeaderObj.heightList = dataOut.heightList
1008 dataOut.processingHeaderObj.heightResolution = dataOut.heightList[1]-dataOut.heightList[0]
964
1009
1010 return dataOut
965
1011
966 class ProfileConcat(Operation):
1012 class ProfileConcat(Operation):
967
1013
@@ -1011,6 +1057,11 class ProfileConcat(Operation):
1011 xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * m
1057 xf = dataOut.heightList[0] + dataOut.nHeights * deltaHeight * m
1012 dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight)
1058 dataOut.heightList = numpy.arange(dataOut.heightList[0], xf, deltaHeight)
1013 dataOut.ippSeconds *= m
1059 dataOut.ippSeconds *= m
1060
1061 #update Processing Header:
1062 dataOut.processingHeaderObj.heightList = dataOut.heightList
1063 dataOut.processingHeaderObj.ipp = dataOut.ippSeconds
1064
1014 return dataOut
1065 return dataOut
1015
1066
1016 class ProfileSelector(Operation):
1067 class ProfileSelector(Operation):
@@ -1961,6 +2012,12 class SSheightProfiles2(Operation):
1961
2012
1962 #print("new data shape:", dataOut.data.shape, dataOut.utctime)
2013 #print("new data shape:", dataOut.data.shape, dataOut.utctime)
1963
2014
2015 #update Processing Header:
2016 dataOut.processingHeaderObj.heightList = dataOut.heightList
2017 dataOut.processingHeaderObj.ipp = ippSeconds
2018 dataOut.processingHeaderObj.heightResolution = dataOut.deltaHeight
2019 #dataOut.processingHeaderObj.profilesPerBlock = nProfiles
2020
1964 return dataOut
2021 return dataOut
1965
2022
1966
2023
@@ -3165,6 +3222,7 class RemoveProfileSats2(Operation):
3165 Escrito: Joab Apaza
3222 Escrito: Joab Apaza
3166
3223
3167 Omite los perfiles contaminados con señal de satélites, usando una altura de referencia
3224 Omite los perfiles contaminados con señal de satélites, usando una altura de referencia
3225 promedia todas las alturas para los cálculos
3168 In: minHei = min_sat_range
3226 In: minHei = min_sat_range
3169 max_sat_range
3227 max_sat_range
3170 min_hei_ref
3228 min_hei_ref
General Comments 0
You need to be logged in to leave comments. Login now