diff --git a/schainpy/model/jroheaderIO.py b/schainpy/model/jroheaderIO.py index 9454ee4..d6a4814 100644 --- a/schainpy/model/jroheaderIO.py +++ b/schainpy/model/jroheaderIO.py @@ -376,56 +376,56 @@ class ProcessingHeader(Header): self.flag_cspc = False def read(self, fp): - try: - header = numpy.fromfile(fp,self.struct,1) - self.size = int(header['nSize'][0]) - self.dtype = int(header['nDataType'][0]) - self.blockSize = int(header['nSizeOfDataBlock'][0]) - self.profilesPerBlock = int(header['nProfilesperBlock'][0]) - self.dataBlocksPerFile = int(header['nDataBlocksperFile'][0]) - self.nWindows = int(header['nNumWindows'][0]) - self.processFlags = header['nProcessFlags'] - self.nCohInt = int(header['nCoherentIntegrations'][0]) - self.nIncohInt = int(header['nIncoherentIntegrations'][0]) - self.totalSpectra = int(header['nTotalSpectra'][0]) - self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows) - self.nHeights = int(numpy.sum(self.samplingWindow['nsa'])) - self.firstHeight = float(self.samplingWindow['h0'][0]) - self.deltaHeight = float(self.samplingWindow['dh'][0]) - self.samplesWin = self.samplingWindow['nsa'] - self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) - - if ((self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE) == PROCFLAG.DEFINE_PROCESS_CODE): - self.nCode = int(numpy.fromfile(fp,' 0: - self.flag_cspc = True + nPairs = nPairs + 1 #par de canales diferentes + pairList.append( (self.spectraComb[i], self.spectraComb[i+1]) ) + + self.flag_cspc = False + if nPairs > 0: + self.flag_cspc = True - except Exception, e: - print "ProcessingHeader: " + e - return 0 +# except Exception, e: +# print "Error ProcessingHeader: " +# return 0 return 1 diff --git a/schainpy/model/jroplot.py b/schainpy/model/jroplot.py index 023512d..203372d 100644 --- a/schainpy/model/jroplot.py +++ b/schainpy/model/jroplot.py @@ -107,8 +107,9 @@ class CrossSpectraPlot(Figure): noisedB = 10*numpy.log10(noise) - thisDatetime = dataOut.datatime - title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) xlabel = "Velocity (m/s)" ylabel = "Range (Km)" @@ -293,7 +294,7 @@ class RTIPlot(Figure): # thisDatetime = dataOut.datatime thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) - title = wintitle+' ' + "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) + title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) xlabel = "" ylabel = "Range (Km)" @@ -455,8 +456,9 @@ class SpectraPlot(Figure): avgdB = 10*numpy.log10(avg) noisedB = 10*numpy.log10(noise) - thisDatetime = dataOut.datatime - title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) xlabel = "Velocity (m/s)" ylabel = "Range (Km)" @@ -572,8 +574,9 @@ class Scope(Figure): y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) y = y.real - thisDatetime = dataOut.datatime - title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) xlabel = "Range (Km)" ylabel = "Intensity" @@ -674,8 +677,9 @@ class PowerProfilePlot(Figure): avgdB = 10*numpy.log10(avg) - thisDatetime = dataOut.datatime - title = "Power Profile" + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) xlabel = "dB" ylabel = "Range (Km)" @@ -798,8 +802,9 @@ class CoherenceMap(Figure): x = dataOut.getTimeRange() y = dataOut.getHeiRange() - thisDatetime = dataOut.datatime - title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y")) xlabel = "" ylabel = "Range (Km)" @@ -963,8 +968,9 @@ class RTIfromNoise(Figure): noise = dataOut.getNoise()/factor noisedB = 10*numpy.log10(noise) - thisDatetime = dataOut.datatime - title = "RTI Noise: %s" %(thisDatetime.strftime("%d-%b-%Y")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " RTI Noise: %s" %(thisDatetime.strftime("%d-%b-%Y")) xlabel = "" ylabel = "Range (Km)" @@ -1156,8 +1162,9 @@ class SpectraHeisScope(Figure): datadB = 10.*numpy.log10(dataOut.data_spc) y = datadB - thisDatetime = dataOut.datatime - title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) xlabel = "Frequency x 10000" ylabel = "Intensity (dB)" @@ -1283,8 +1290,9 @@ class RTIfromSpectraHeis(Figure): # noise = dataOut.getNoise()/factor # noisedB = 10*numpy.log10(noise) - thisDatetime = dataOut.datatime - title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) + #thisDatetime = dataOut.datatime + thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) + title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) xlabel = "Local Time" ylabel = "Intensity (dB)" diff --git a/schainpy/model/jroprocessing.py b/schainpy/model/jroprocessing.py index b403f82..e2ae3aa 100644 --- a/schainpy/model/jroprocessing.py +++ b/schainpy/model/jroprocessing.py @@ -273,7 +273,7 @@ class VoltageProc(ProcessingUnit): return 1 - def selectHeights(self, minHei, maxHei): + def selectHeights(self, minHei=None, maxHei=None): """ Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango minHei <= height <= maxHei @@ -288,9 +288,17 @@ class VoltageProc(ProcessingUnit): Return: 1 si el metodo se ejecuto con exito caso contrario devuelve 0 """ + + if minHei == None: + minHei = self.dataOut.heightList[0] + + if maxHei == None: + maxHei = self.dataOut.heightList[-1] + if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) + if (maxHei > self.dataOut.heightList[-1]): maxHei = self.dataOut.heightList[-1] # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) @@ -358,7 +366,7 @@ class VoltageProc(ProcessingUnit): deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] if window == None: - window = self.dataOut.radarControllerHeaderObj.txA / deltaHeight + window = (self.dataOut.radarControllerHeaderObj.txA/self.dataOut.radarControllerHeaderObj.nBaud) / deltaHeight newdelta = deltaHeight * window r = self.dataOut.data.shape[1] % window @@ -366,7 +374,7 @@ class VoltageProc(ProcessingUnit): buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window) buffer = numpy.sum(buffer,2) self.dataOut.data = buffer - self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window,newdelta) + self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*(self.dataOut.nHeights-r)/window,newdelta) self.dataOut.windowOfFilter = window def deFlip(self):