diff --git a/schainpy/controller.py b/schainpy/controller.py index 60b4179..b474474 100644 --- a/schainpy/controller.py +++ b/schainpy/controller.py @@ -293,12 +293,12 @@ class ReadUnitConf(ProcUnitConf): if name == None: if 'Reader' in datatype: name = datatype - datatype = name.replace('Reader','') + datatype = name.replace('Reader', '') else: name = '{}Reader'.format(datatype) if datatype == None: if 'Reader' in name: - datatype = name.replace('Reader','') + datatype = name.replace('Reader', '') else: datatype = name name = '{}Reader'.format(name) diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index 5ad1fae..e79bcc9 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -63,6 +63,11 @@ class SpectraProc(ProcessingUnit): self.dataOut.beam.codeList = self.dataIn.beam.codeList self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList self.dataOut.beam.zenithList = self.dataIn.beam.zenithList + self.dataOut.runNextUnit = self.dataIn.runNextUnit + try: + self.dataOut.step = self.dataIn.step + except: + pass def __getFft(self): """ @@ -116,8 +121,9 @@ class SpectraProc(ProcessingUnit): self.dataOut.blockSize = blocksize self.dataOut.flagShiftFFT = False - def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False): - + def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False, runNextUnit = 0): + + self.dataIn.runNextUnit = runNextUnit if self.dataIn.type == "Spectra": self.dataOut.copy(self.dataIn) if shift_fft: @@ -226,13 +232,13 @@ class SpectraProc(ProcessingUnit): self.dataOut.pairsList = pairs return - - def selectFFTs(self, minFFT, maxFFT): + + def selectFFTs(self, minFFT, maxFFT ): """ - Selecciona un bloque de datos en base a un grupo de valores de puntos FFTs segun el rango + Selecciona un bloque de datos en base a un grupo de valores de puntos FFTs segun el rango minFFT<= FFT <= maxFFT """ - + if (minFFT > maxFFT): raise ValueError("Error selecting heights: Height range (%d,%d) is not valid" % (minFFT, maxFFT)) @@ -262,7 +268,7 @@ class SpectraProc(ProcessingUnit): self.selectFFTsByIndex(minIndex, maxIndex) return 1 - + def getBeaconSignal(self, tauindex=0, channelindex=0, hei_ref=None): newheis = numpy.where( self.dataOut.heightList > self.dataOut.radarControllerHeaderObj.Taus[tauindex]) @@ -304,7 +310,7 @@ class SpectraProc(ProcessingUnit): def selectFFTsByIndex(self, minIndex, maxIndex): """ - + """ if (minIndex < 0) or (minIndex > maxIndex): @@ -327,7 +333,7 @@ class SpectraProc(ProcessingUnit): self.dataOut.data_spc = data_spc self.dataOut.data_cspc = data_cspc self.dataOut.data_dc = data_dc - + self.dataOut.ippSeconds = self.dataOut.ippSeconds*(self.dataOut.nFFTPoints / numpy.shape(data_cspc)[1]) self.dataOut.nFFTPoints = numpy.shape(data_cspc)[1] self.dataOut.profilesPerBlock = numpy.shape(data_cspc)[1] @@ -466,7 +472,7 @@ class removeDC(Operation): xx_inv = numpy.linalg.inv(xx) xx_aux = xx_inv[0, :] - for ich in range(num_chan): + for ich in range(num_chan): yy = jspectra[ich, ind_vel, :] jspectra[ich, freq_dc, :] = numpy.dot(xx_aux, yy) @@ -490,12 +496,12 @@ class removeDC(Operation): class removeInterference(Operation): def removeInterference2(self): - + cspc = self.dataOut.data_cspc spc = self.dataOut.data_spc - Heights = numpy.arange(cspc.shape[2]) + Heights = numpy.arange(cspc.shape[2]) realCspc = numpy.abs(cspc) - + for i in range(cspc.shape[0]): LinePower= numpy.sum(realCspc[i], axis=0) Threshold = numpy.amax(LinePower)-numpy.sort(LinePower)[len(Heights)-int(len(Heights)*0.1)] @@ -784,7 +790,7 @@ class IncohInt(Operation): if n is not None: self.n = int(n) else: - + self.__integrationtime = int(timeInterval) self.n = None self.__byTime = True @@ -901,7 +907,7 @@ class IncohInt(Operation): dataOut.data_spc = avgdata_spc dataOut.data_cspc = avgdata_cspc - dataOut.data_dc = avgdata_dc + dataOut.data_dc = avgdata_dc dataOut.nIncohInt *= self.n dataOut.utctime = avgdatatime dataOut.flagNoData = False @@ -909,10 +915,10 @@ class IncohInt(Operation): return dataOut class dopplerFlip(Operation): - + def run(self, dataOut): # arreglo 1: (num_chan, num_profiles, num_heights) - self.dataOut = dataOut + self.dataOut = dataOut # JULIA-oblicua, indice 2 # arreglo 2: (num_profiles, num_heights) jspectra = self.dataOut.data_spc[2] diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 9c71e4d..c56688d 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -5,8 +5,7 @@ from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecora from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon from schainpy.utils import log from time import time - - +# voltage proc master class VoltageProc(ProcessingUnit): @@ -18,13 +17,15 @@ class VoltageProc(ProcessingUnit): self.flip = 1 self.setupReq = False - def run(self): + def run(self, runNextUnit = 0): if self.dataIn.type == 'AMISR': self.__updateObjFromAmisrInput() if self.dataIn.type == 'Voltage': self.dataOut.copy(self.dataIn) + self.dataOut.runNextUnit = runNextUnit + def __updateObjFromAmisrInput(self): @@ -164,8 +165,12 @@ class selectHeights(Operation): self.dataOut = dataOut - if minHei and maxHei: + if type(minHei) == int or type(minHei) == float: + v_minHei= True + else: + v_minHei= False + if v_minHei and maxHei: if (minHei < self.dataOut.heightList[0]): minHei = self.dataOut.heightList[0] @@ -175,7 +180,6 @@ class selectHeights(Operation): minIndex = 0 maxIndex = 0 heights = self.dataOut.heightList - inda = numpy.where(heights >= minHei) indb = numpy.where(heights <= maxHei) @@ -188,7 +192,8 @@ class selectHeights(Operation): maxIndex = indb[0][-1] except: maxIndex = len(heights) - + print(minIndex) + print(maxIndex) self.selectHeightsByIndex(minIndex, maxIndex) return self.dataOut @@ -211,6 +216,8 @@ class selectHeights(Operation): """ if self.dataOut.type == 'Voltage': + print(minIndex) + print(maxIndex) if (minIndex < 0) or (minIndex > maxIndex): raise ValueError("Height index range (%d,%d) is not valid" % (minIndex, maxIndex)) @@ -647,7 +654,6 @@ class CohInt(Operation): if not self.isConfig: self.setup(n=n, stride=stride, timeInterval=timeInterval, overlapping=overlapping, byblock=byblock, **kwargs) self.isConfig = True - if dataOut.flagDataAsBlock: """ Si la data es leida por bloques, dimension = [nChannels, nProfiles, nHeis] @@ -853,7 +859,6 @@ class Decoder(Operation): dataOut.nBaud = self.nBaud dataOut.data = datadec - dataOut.heightList = dataOut.heightList[0:datadec.shape[-1]] dataOut.flagDecodeData = True #asumo q la data esta decodificada @@ -865,7 +870,6 @@ class Decoder(Operation): self.__profIndex += 1 return dataOut - # dataOut.flagDeflipData = True #asumo q la data no esta sin flip class ProfileConcat(Operation): @@ -1622,4 +1626,4 @@ class PulsePairVoltage(Operation): # # self.__startIndex += self.__newNSamples # -# return +# return \ No newline at end of file