@@ -1,5 +1,12 | |||||
1 | import numpy |
|
1 | import numpy | |
2 |
|
2 | |||
|
3 | class Beam: | |||
|
4 | def __init__(self): | |||
|
5 | self.codeList = [] | |||
|
6 | self.azimuthList = [] | |||
|
7 | self.zenithList = [] | |||
|
8 | ||||
|
9 | ||||
3 | class AMISR: |
|
10 | class AMISR: | |
4 | def __init__(self): |
|
11 | def __init__(self): | |
5 | self.flagNoData = True |
|
12 | self.flagNoData = True | |
@@ -51,6 +58,10 class AMISR: | |||||
51 |
|
58 | |||
52 | self.npulseByFrame = None |
|
59 | self.npulseByFrame = None | |
53 |
|
60 | |||
|
61 | self.profileIndex = None | |||
|
62 | ||||
|
63 | self.beam = Beam() | |||
|
64 | ||||
54 | def copy(self, inputObj=None): |
|
65 | def copy(self, inputObj=None): | |
55 |
|
66 | |||
56 | if inputObj == None: |
|
67 | if inputObj == None: | |
@@ -58,8 +69,14 class AMISR: | |||||
58 |
|
69 | |||
59 | for key in inputObj.__dict__.keys(): |
|
70 | for key in inputObj.__dict__.keys(): | |
60 | self.__dict__[key] = inputObj.__dict__[key] |
|
71 | self.__dict__[key] = inputObj.__dict__[key] | |
|
72 | ||||
|
73 | def getNHeights(self): | |||
|
74 | ||||
|
75 | return len(self.heightList) | |||
61 |
|
76 | |||
62 |
|
77 | |||
63 | def isEmpty(self): |
|
78 | def isEmpty(self): | |
64 |
|
79 | |||
65 | return self.flagNoData No newline at end of file |
|
80 | return self.flagNoData | |
|
81 | ||||
|
82 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") No newline at end of file |
@@ -89,6 +89,12 def hildebrand_sekhon(data, navg): | |||||
89 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) |
|
89 | stdv = numpy.sqrt((sumq - lnoise**2)/(j - 1)) | |
90 | return lnoise |
|
90 | return lnoise | |
91 |
|
91 | |||
|
92 | class Beam: | |||
|
93 | def __init__(self): | |||
|
94 | self.codeList = [] | |||
|
95 | self.azimuthList = [] | |||
|
96 | self.zenithList = [] | |||
|
97 | ||||
92 | class GenericData(object): |
|
98 | class GenericData(object): | |
93 |
|
99 | |||
94 | flagNoData = True |
|
100 | flagNoData = True | |
@@ -193,6 +199,8 class JROData(GenericData): | |||||
193 |
|
199 | |||
194 | zenith = None |
|
200 | zenith = None | |
195 |
|
201 | |||
|
202 | beam = Beam() | |||
|
203 | ||||
196 | def __init__(self): |
|
204 | def __init__(self): | |
197 |
|
205 | |||
198 | raise ValueError, "This class has not been implemented" |
|
206 | raise ValueError, "This class has not been implemented" | |
@@ -735,6 +743,4 class Fits: | |||||
735 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
743 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
736 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
744 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
737 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
745 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
738 |
|
||||
739 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
|||
740 |
|
746 |
@@ -166,6 +166,9 class SpectraPlot(Figure): | |||||
166 | for i in range(self.nplots): |
|
166 | for i in range(self.nplots): | |
167 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
167 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |
168 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime) |
|
168 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime) | |
|
169 | if len(dataOut.beam.codeList) != 0: | |||
|
170 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[i]+1, noisedB[i], dataOut.beam.azimuthList[i], dataOut.beam.zenithList[i], str_datetime) | |||
|
171 | ||||
169 | axes = self.axesList[i*self.__nsubplots] |
|
172 | axes = self.axesList[i*self.__nsubplots] | |
170 | axes.pcolor(x, y, zdB[i,:,:], |
|
173 | axes.pcolor(x, y, zdB[i,:,:], | |
171 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
174 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
@@ -77,7 +77,7 def printLabels(ax, xlabel, ylabel, title): | |||||
77 |
|
77 | |||
78 | ax.set_xlabel(xlabel, size=11) |
|
78 | ax.set_xlabel(xlabel, size=11) | |
79 | ax.set_ylabel(ylabel, size=11) |
|
79 | ax.set_ylabel(ylabel, size=11) | |
80 |
ax.set_title(title, size= |
|
80 | ax.set_title(title, size=8) | |
81 |
|
81 | |||
82 | def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', |
|
82 | def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', | |
83 | ticksize=9, xtick_visible=True, ytick_visible=True, |
|
83 | ticksize=9, xtick_visible=True, ytick_visible=True, |
@@ -600,7 +600,7 class AMISRReader(ProcessingUnit): | |||||
600 | self.dataOut.data = numpy.reshape(self.datablock[self.profileIndex,:],(1,-1)) |
|
600 | self.dataOut.data = numpy.reshape(self.datablock[self.profileIndex,:],(1,-1)) | |
601 |
|
601 | |||
602 | self.dataOut.utctime = self.radacTimeByFrame[self.profileIndex] |
|
602 | self.dataOut.utctime = self.radacTimeByFrame[self.profileIndex] | |
603 |
|
603 | self.dataOut.profileIndex = self.profileIndex | ||
604 | self.dataOut.flagNoData = False |
|
604 | self.dataOut.flagNoData = False | |
605 |
|
605 | |||
606 | self.profileIndex += 1 |
|
606 | self.profileIndex += 1 |
@@ -1,7 +1,7 | |||||
1 | ''' |
|
1 | ''' | |
2 | @author: Daniel Suarez |
|
2 | @author: Daniel Suarez | |
3 | ''' |
|
3 | ''' | |
4 |
|
4 | import numpy | ||
5 | from jroproc_base import ProcessingUnit, Operation |
|
5 | from jroproc_base import ProcessingUnit, Operation | |
6 | from model.data.jroamisr import AMISR |
|
6 | from model.data.jroamisr import AMISR | |
7 |
|
7 | |||
@@ -88,4 +88,43 class BeamSelector(Operation): | |||||
88 | else: |
|
88 | else: | |
89 | raise ValueError, "BeamSelector needs beam value" |
|
89 | raise ValueError, "BeamSelector needs beam value" | |
90 |
|
90 | |||
91 |
return 0 |
|
91 | return 0 | |
|
92 | ||||
|
93 | class ProfileToChannels(Operation): | |||
|
94 | ||||
|
95 | def __init__(self): | |||
|
96 | self.__isConfig = False | |||
|
97 | self.__counter_chan = 0 | |||
|
98 | self.buffer = None | |||
|
99 | ||||
|
100 | ||||
|
101 | def run(self, dataOut): | |||
|
102 | ||||
|
103 | dataOut.flagNoData = True | |||
|
104 | ||||
|
105 | if not(self.__isConfig): | |||
|
106 | nchannels = len(dataOut.beamRangeDict.keys()) | |||
|
107 | nsamples = dataOut.nHeights | |||
|
108 | self.buffer = numpy.zeros((nchannels, nsamples), dtype = 'complex128') | |||
|
109 | self.__isConfig = True | |||
|
110 | ||||
|
111 | for i in range(self.buffer.shape[0]): | |||
|
112 | if dataOut.profileIndex in dataOut.beamRangeDict[i]: | |||
|
113 | self.buffer[i,:] = dataOut.data | |||
|
114 | if len(dataOut.beam.codeList) < self.buffer.shape[0]: | |||
|
115 | beamInfo = dataOut.beamCodeDict[i] | |||
|
116 | dataOut.beam.codeList.append(beamInfo[0]) | |||
|
117 | dataOut.beam.azimuthList.append(beamInfo[1]) | |||
|
118 | dataOut.beam.zenithList.append(beamInfo[2]) | |||
|
119 | break | |||
|
120 | ||||
|
121 | self.__counter_chan += 1 | |||
|
122 | ||||
|
123 | if self.__counter_chan >= self.buffer.shape[0]: | |||
|
124 | self.__counter_chan = 0 | |||
|
125 | dataOut.data = self.buffer.copy() | |||
|
126 | dataOut.channelList = range(self.buffer.shape[0]) | |||
|
127 | self.__isConfig = False | |||
|
128 | dataOut.flagNoData = False | |||
|
129 | pass | |||
|
130 | No newline at end of file |
@@ -53,6 +53,10 class SpectraProc(ProcessingUnit): | |||||
53 | self.dataOut.azimuth = self.dataIn.azimuth |
|
53 | self.dataOut.azimuth = self.dataIn.azimuth | |
54 | self.dataOut.zenith = self.dataIn.zenith |
|
54 | self.dataOut.zenith = self.dataIn.zenith | |
55 |
|
55 | |||
|
56 | self.dataOut.beam.codeList = self.dataIn.beam.codeList | |||
|
57 | self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList | |||
|
58 | self.dataOut.beam.zenithList = self.dataIn.beam.zenithList | |||
|
59 | ||||
56 | def __getFft(self): |
|
60 | def __getFft(self): | |
57 | """ |
|
61 | """ | |
58 | Convierte valores de Voltaje a Spectra |
|
62 | Convierte valores de Voltaje a Spectra |
@@ -44,6 +44,10 class VoltageProc(ProcessingUnit): | |||||
44 |
|
44 | |||
45 | self.dataOut.azimuth = self.dataIn.azimuth |
|
45 | self.dataOut.azimuth = self.dataIn.azimuth | |
46 | self.dataOut.zenith = self.dataIn.zenith |
|
46 | self.dataOut.zenith = self.dataIn.zenith | |
|
47 | ||||
|
48 | self.dataOut.beam.codeList = self.dataIn.beam.codeList | |||
|
49 | self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList | |||
|
50 | self.dataOut.beam.zenithList = self.dataIn.beam.zenithList | |||
47 | # |
|
51 | # | |
48 | # pass# |
|
52 | # pass# | |
49 | # |
|
53 | # |
@@ -15,13 +15,13 controllerObj.setup(id = '191', name='test01', description=desc) | |||||
15 |
|
15 | |||
16 |
|
16 | |||
17 | path = os.path.join(os.environ['HOME'],'Development/amisr/data') |
|
17 | path = os.path.join(os.environ['HOME'],'Development/amisr/data') | |
18 | #path = os.path.join(os.environ['HOME'],'Documents/amisr') |
|
18 | path = '/media/administrator/KINGSTON/amisr' | |
19 | figpath = os.path.join(os.environ['HOME'],'Pictures/amisr') |
|
19 | figpath = os.path.join(os.environ['HOME'],'Pictures/amisr') | |
20 |
|
20 | |||
21 | readUnitConfObj = controllerObj.addReadUnit(datatype='AMISRReader', |
|
21 | readUnitConfObj = controllerObj.addReadUnit(datatype='AMISRReader', | |
22 | path=path, |
|
22 | path=path, | |
23 |
startDate='2014/ |
|
23 | startDate='2014/10/21', | |
24 |
endDate='2014/1 |
|
24 | endDate='2014/10/21', | |
25 | startTime='00:00:00', |
|
25 | startTime='00:00:00', | |
26 | endTime='23:59:59', |
|
26 | endTime='23:59:59', | |
27 | walk=1, |
|
27 | walk=1, | |
@@ -32,38 +32,47 procUnitAMISRBeam0 = controllerObj.addProcUnit(datatype='AMISRProc', inputId=rea | |||||
32 |
|
32 | |||
33 | opObj11 = procUnitAMISRBeam0.addOperation(name='PrintInfo', optype='other') |
|
33 | opObj11 = procUnitAMISRBeam0.addOperation(name='PrintInfo', optype='other') | |
34 |
|
34 | |||
|
35 | #Reshaper | |||
|
36 | opObj11 = procUnitAMISRBeam0.addOperation(name='ProfileToChannels', optype='other') | |||
|
37 | ||||
|
38 | ||||
35 | #Beam Selector |
|
39 | #Beam Selector | |
36 | opObj11 = procUnitAMISRBeam0.addOperation(name='BeamSelector', optype='other') |
|
40 | #opObj11 = procUnitAMISRBeam0.addOperation(name='BeamSelector', optype='other') | |
37 | opObj11.addParameter(name='beam', value='0', format='int') |
|
41 | #opObj11.addParameter(name='beam', value='0', format='int') | |
38 |
|
42 | |||
39 | #Voltage Processing Unit |
|
43 | #Voltage Processing Unit | |
40 | procUnitConfObjBeam0 = controllerObj.addProcUnit(datatype='VoltageProc', inputId=procUnitAMISRBeam0.getId()) |
|
44 | procUnitConfObjBeam0 = controllerObj.addProcUnit(datatype='VoltageProc', inputId=procUnitAMISRBeam0.getId()) | |
41 | #Coherent Integration |
|
45 | #Coherent Integration | |
42 | opObj11 = procUnitConfObjBeam0.addOperation(name='CohInt', optype='other') |
|
46 | opObj11 = procUnitConfObjBeam0.addOperation(name='CohInt', optype='other') | |
43 |
opObj11.addParameter(name='n', value=' |
|
47 | opObj11.addParameter(name='n', value='8', format='int') | |
44 | #Spectra Unit Processing, getting spectras with nProfiles and nFFTPoints |
|
48 | #Spectra Unit Processing, getting spectras with nProfiles and nFFTPoints | |
45 | procUnitConfObjSpectraBeam0 = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjBeam0.getId()) |
|
49 | procUnitConfObjSpectraBeam0 = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjBeam0.getId()) | |
46 | procUnitConfObjSpectraBeam0.addParameter(name='nFFTPoints', value=32, format='int') |
|
50 | procUnitConfObjSpectraBeam0.addParameter(name='nFFTPoints', value=32, format='int') | |
47 | procUnitConfObjSpectraBeam0.addParameter(name='nProfiles', value=32, format='int') |
|
51 | procUnitConfObjSpectraBeam0.addParameter(name='nProfiles', value=32, format='int') | |
|
52 | #RemoveDc | |||
|
53 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='removeDC') | |||
|
54 | ||||
48 | #Noise Estimation |
|
55 | #Noise Estimation | |
49 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='getNoise') |
|
56 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='getNoise') | |
50 |
opObj11.addParameter(name='minHei', value=' |
|
57 | opObj11.addParameter(name='minHei', value='5', format='float') | |
51 |
opObj11.addParameter(name='maxHei', value=' |
|
58 | opObj11.addParameter(name='maxHei', value='20', format='float') | |
52 |
|
59 | |||
53 | #SpectraPlot |
|
60 | #SpectraPlot | |
54 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='SpectraPlot', optype='other') |
|
61 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='SpectraPlot', optype='other') | |
55 | opObj11.addParameter(name='id', value='100', format='int') |
|
62 | opObj11.addParameter(name='id', value='100', format='int') | |
56 | opObj11.addParameter(name='wintitle', value='AMISR Beam 0', format='str') |
|
63 | opObj11.addParameter(name='wintitle', value='AMISR Beam 0', format='str') | |
|
64 | opObj11.addParameter(name='zmin', value='30', format='int') | |||
|
65 | opObj11.addParameter(name='zmax', value='80', format='int') | |||
57 |
|
66 | |||
58 | #RTIPlot |
|
67 | #RTIPlot | |
59 | title0 = 'RTI AMISR Beam 0' |
|
68 | #title0 = 'RTI AMISR Beam 0' | |
60 | opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='RTIPlot', optype='other') |
|
69 | #opObj11 = procUnitConfObjSpectraBeam0.addOperation(name='RTIPlot', optype='other') | |
61 | opObj11.addParameter(name='id', value='200', format='int') |
|
70 | #opObj11.addParameter(name='id', value='200', format='int') | |
62 | opObj11.addParameter(name='wintitle', value=title0, format='str') |
|
71 | #opObj11.addParameter(name='wintitle', value=title0, format='str') | |
63 | opObj11.addParameter(name='showprofile', value='0', format='int') |
|
72 | #opObj11.addParameter(name='showprofile', value='0', format='int') | |
64 | #Setting RTI time using xmin,xmax |
|
73 | ##Setting RTI time using xmin,xmax | |
65 | opObj11.addParameter(name='xmin', value='15', format='int') |
|
74 | #opObj11.addParameter(name='xmin', value='15', format='int') | |
66 | opObj11.addParameter(name='xmax', value='23', format='int') |
|
75 | #opObj11.addParameter(name='xmax', value='23', format='int') | |
67 | #Setting dB range with zmin, zmax |
|
76 | #Setting dB range with zmin, zmax | |
68 | #opObj11.addParameter(name='zmin', value='45', format='int') |
|
77 | #opObj11.addParameter(name='zmin', value='45', format='int') | |
69 | #opObj11.addParameter(name='zmax', value='70', format='int') |
|
78 | #opObj11.addParameter(name='zmax', value='70', format='int') |
General Comments 0
You need to be logged in to leave comments.
Login now