diff --git a/schainpy/model/data/jroamisr.py b/schainpy/model/data/jroamisr.py index db52e88..0eeb60e 100644 --- a/schainpy/model/data/jroamisr.py +++ b/schainpy/model/data/jroamisr.py @@ -44,7 +44,11 @@ class AMISR: #consideracion para los Beams self.beamCodeDict = None self.beamRangeDict = None - + self.beamcode = None + self.azimuth = None + self.zenith = None + self.gain = None + self.npulseByFrame = None def copy(self, inputObj=None): diff --git a/schainpy/model/data/jrodata.py b/schainpy/model/data/jrodata.py index a06fe8e..a028e52 100644 --- a/schainpy/model/data/jrodata.py +++ b/schainpy/model/data/jrodata.py @@ -189,6 +189,10 @@ class JROData(GenericData): blocknow = None + azimuth = None + + zenith = None + def __init__(self): raise ValueError, "This class has not been implemented" diff --git a/schainpy/model/graphics/jroplot_spectra.py b/schainpy/model/graphics/jroplot_spectra.py index 3e871cc..dbb877d 100644 --- a/schainpy/model/graphics/jroplot_spectra.py +++ b/schainpy/model/graphics/jroplot_spectra.py @@ -131,6 +131,9 @@ class SpectraPlot(Figure): #thisDatetime = dataOut.datatime thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) title = wintitle + " Spectra" + if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): + title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) + xlabel = "Velocity (m/s)" ylabel = "Range (Km)" @@ -185,7 +188,10 @@ class SpectraPlot(Figure): if figfile == None: str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") figfile = self.getFilename(name = str_datetime) - + name = str_datetime + if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): + name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) + figfile = self.getFilename(name) if figpath != '': self.counter_imagwr += 1 if (self.counter_imagwr>=wr_period): @@ -563,6 +569,8 @@ class RTIPlot(Figure): for i in range(self.nplots): title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) + if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): + title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) axes = self.axesList[i*self.__nsubplots] zdB = avgdB[i].reshape((1,-1)) axes.pcolorbuffer(x, y, zdB, diff --git a/schainpy/model/io/jroIO_amisr.py b/schainpy/model/io/jroIO_amisr.py index f746bb6..0f5c442 100644 --- a/schainpy/model/io/jroIO_amisr.py +++ b/schainpy/model/io/jroIO_amisr.py @@ -173,7 +173,37 @@ class AMISRReader(ProcessingUnit): return None def __getTimeFromData(self): - pass + startDateTime_Reader = datetime.datetime.combine(self.startDate,self.startTime) + endDateTime_Reader = datetime.datetime.combine(self.endDate,self.endTime) + + print 'Filtering Files from %s to %s'%(startDateTime_Reader, endDateTime_Reader) + print '........................................' + filter_filenameList = [] + for filename in self.filenameList: + fp = h5py.File(filename,'r') + time_str = fp.get('Time/RadacTimeString') + + startDateTimeStr_File = time_str[0][0].split('.')[0] + junk = time.strptime(startDateTimeStr_File, '%Y-%m-%d %H:%M:%S') + startDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) + + endDateTimeStr_File = time_str[-1][-1].split('.')[0] + junk = time.strptime(endDateTimeStr_File, '%Y-%m-%d %H:%M:%S') + endDateTime_File = datetime.datetime(junk.tm_year,junk.tm_mon,junk.tm_mday,junk.tm_hour, junk.tm_min, junk.tm_sec) + + fp.close() + + if self.timezone == 'lt': + startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300) + endDateTime_File = endDateTime_File - datetime.timedelta(minutes = 300) + + if (endDateTime_File>=startDateTime_Reader and endDateTime_File0: self.status = 1 self.filenameList.sort() @@ -290,16 +324,22 @@ class AMISRReader(ProcessingUnit): self.beamCodeDict = {} self.beamRangeDict = {} + beamCodeMap = self.amisrFilePointer.get('Setup/BeamcodeMap') + for i in range(len(self.radacHeaderObj.beamCode[0,:])): self.beamCodeDict.setdefault(i) self.beamRangeDict.setdefault(i) - self.beamCodeDict[i] = self.radacHeaderObj.beamCode[0,i] + beamcodeValue = self.radacHeaderObj.beamCode[0,i] + beamcodeIndex = numpy.where(beamCodeMap[:,0] == beamcodeValue)[0][0] + x = beamCodeMap[beamcodeIndex][1] + y = beamCodeMap[beamcodeIndex][2] + z = beamCodeMap[beamcodeIndex][3] + self.beamCodeDict[i] = [beamcodeValue, x, y, z] - just4record0 = self.radacHeaderObj.beamCodeByPulse[0,:] for i in range(len(self.beamCodeDict.values())): - xx = numpy.where(just4record0==self.beamCodeDict.values()[i]) + xx = numpy.where(just4record0==self.beamCodeDict.values()[i][0]) self.beamRangeDict[i] = xx[0] def __getExpParameters(self): @@ -332,6 +372,7 @@ class AMISRReader(ProcessingUnit): tufileFinder = fnmatch.filter(lines, 'tufile=*') tufile = tufileFinder[0].split('=')[1].split('\n')[0] + tufile = tufile.split('\r')[0] tufilename = os.path.join(experimentCfgPath,tufile) f = open(tufilename) @@ -374,9 +415,11 @@ class AMISRReader(ProcessingUnit): startTime=datetime.time(0,0,0), endTime=datetime.time(23,59,59), walk=True, - timezone='ut',): + timezone='ut', + all=0,): self.timezone = timezone + self.all = all #Busqueda de archivos offline self.__searchFilesOffline(path, startDate, endDate, startTime, endTime, walk) diff --git a/schainpy/model/proc/jroproc_amisr.py b/schainpy/model/proc/jroproc_amisr.py index 06b0d9c..780ebe1 100644 --- a/schainpy/model/proc/jroproc_amisr.py +++ b/schainpy/model/proc/jroproc_amisr.py @@ -30,7 +30,7 @@ class PrintInfo(Operation): print 'Ipp Seconds: %f'%dataOut.ippSeconds print 'Number of Beams: %d'%dataOut.nBeams print 'BeamCodes:' - beamStrList = ['Beam %d -> Code %d'%(k,v) for k,v in dataOut.beamCodeDict.items()] + beamStrList = ['Beam %d -> Code=%d, azimuth=%2.2f, zenith=%2.2f, gain=%2.2f'%(k,v[0],v[1],v[2],v[3]) for k,v in dataOut.beamCodeDict.items()] for b in beamStrList: print b self.__isPrinted = True @@ -76,6 +76,10 @@ class BeamSelector(Operation): if beam != None: if self.isProfileInList(dataOut.beamRangeDict[beam]): + beamInfo = dataOut.beamCodeDict[beam] + dataOut.azimuth = beamInfo[1] + dataOut.zenith = beamInfo[2] + dataOut.gain = beamInfo[3] dataOut.flagNoData = False self.incIndex() diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index 7ad0cdc..97a6ed3 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -50,6 +50,9 @@ class SpectraProc(ProcessingUnit): self.dataOut.frequency = self.dataIn.frequency self.dataOut.realtime = self.dataIn.realtime + self.dataOut.azimuth = self.dataIn.azimuth + self.dataOut.zenith = self.dataIn.zenith + def __getFft(self): """ Convierte valores de Voltaje a Spectra diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 4a27023..5f6cb3d 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -41,6 +41,9 @@ class VoltageProc(ProcessingUnit): self.dataOut.nCohInt = self.dataIn.nCohInt self.dataOut.ippSeconds = self.dataIn.ippSeconds self.dataOut.frequency = self.dataIn.frequency + + self.dataOut.azimuth = self.dataIn.azimuth + self.dataOut.zenith = self.dataIn.zenith # # pass# #