@@ -465,6 +465,9 class Spectra(JROData): | |||||
465 | self.ippFactor = 1 |
|
465 | self.ippFactor = 1 | |
466 | self.beacon_heiIndexList = [] |
|
466 | self.beacon_heiIndexList = [] | |
467 | self.noise_estimation = None |
|
467 | self.noise_estimation = None | |
|
468 | self.codeList = [] | |||
|
469 | self.azimuthList = [] | |||
|
470 | self.elevationList = [] | |||
468 | self.metadata_list = ['type', 'heightList', 'timeZone', 'pairsList', 'channelList', 'nCohInt', |
|
471 | self.metadata_list = ['type', 'heightList', 'timeZone', 'pairsList', 'channelList', 'nCohInt', | |
469 | 'code', 'nCode', 'nBaud', 'ippSeconds', 'ipp','nIncohInt', 'nFFTPoints', 'nProfiles'] |
|
472 | 'code', 'nCode', 'nBaud', 'ippSeconds', 'ipp','nIncohInt', 'nFFTPoints', 'nProfiles'] | |
470 |
|
473 | |||
@@ -866,6 +869,7 class Parameters(Spectra): | |||||
866 | Constructor |
|
869 | Constructor | |
867 | ''' |
|
870 | ''' | |
868 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
871 | self.radarControllerHeaderObj = RadarControllerHeader() | |
|
872 | self.radarControllerHeaderObj.set_ippSeconds(0) | |||
869 | self.systemHeaderObj = SystemHeader() |
|
873 | self.systemHeaderObj = SystemHeader() | |
870 | self.type = "Parameters" |
|
874 | self.type = "Parameters" | |
871 | self.timeZone = 0 |
|
875 | self.timeZone = 0 |
@@ -497,7 +497,6 class Plot(Operation): | |||||
497 | 'interval': dataOut.timeInterval, |
|
497 | 'interval': dataOut.timeInterval, | |
498 | 'channels': dataOut.channelList |
|
498 | 'channels': dataOut.channelList | |
499 | } |
|
499 | } | |
500 |
|
||||
501 | data, meta = self.update(dataOut) |
|
500 | data, meta = self.update(dataOut) | |
502 | metadata.update(meta) |
|
501 | metadata.update(meta) | |
503 | self.data.update(data, timestamp, metadata) |
|
502 | self.data.update(data, timestamp, metadata) |
@@ -84,7 +84,6 class PowerPlot(RTIPlot): | |||||
84 | data = { |
|
84 | data = { | |
85 | 'pow': 10*numpy.log10(dataOut.data_pow) |
|
85 | 'pow': 10*numpy.log10(dataOut.data_pow) | |
86 | } |
|
86 | } | |
87 | #print("data",data) |
|
|||
88 | return data, {} |
|
87 | return data, {} | |
89 |
|
88 | |||
90 | class SpectralWidthPlot(RTIPlot): |
|
89 | class SpectralWidthPlot(RTIPlot): |
@@ -12,6 +12,7 import numpy | |||||
12 | from schainpy.model.graphics.jroplot_base import Plot, plt, log |
|
12 | from schainpy.model.graphics.jroplot_base import Plot, plt, log | |
13 | from itertools import combinations |
|
13 | from itertools import combinations | |
14 |
|
14 | |||
|
15 | ||||
15 | class SpectraPlot(Plot): |
|
16 | class SpectraPlot(Plot): | |
16 | ''' |
|
17 | ''' | |
17 | Plot for Spectra data |
|
18 | Plot for Spectra data | |
@@ -36,10 +37,12 class SpectraPlot(Plot): | |||||
36 | self.width = 3.5 * self.ncols |
|
37 | self.width = 3.5 * self.ncols | |
37 | self.plots_adjust.update({'wspace': 0.4, 'hspace':0.4, 'left': 0.1, 'right': 0.9, 'bottom': 0.08}) |
|
38 | self.plots_adjust.update({'wspace': 0.4, 'hspace':0.4, 'left': 0.1, 'right': 0.9, 'bottom': 0.08}) | |
38 | self.ylabel = 'Range [km]' |
|
39 | self.ylabel = 'Range [km]' | |
|
40 | def update_list(self,dataOut): | |||
|
41 | if len(self.channelList) == 0: | |||
|
42 | self.channelList = dataOut.channelList | |||
39 |
|
43 | |||
40 | def update(self, dataOut): |
|
44 | def update(self, dataOut): | |
41 | if self.channelList == None: |
|
45 | self.update_list(dataOut) | |
42 | self.channelList = dataOut.channelList |
|
|||
43 | data = {} |
|
46 | data = {} | |
44 | meta = {} |
|
47 | meta = {} | |
45 | spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor) |
|
48 | spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor) | |
@@ -178,9 +181,9 class CrossSpectraPlot(Plot): | |||||
178 |
|
181 | |||
179 | data = self.data[-1] |
|
182 | data = self.data[-1] | |
180 | cspc = data['cspc'] |
|
183 | cspc = data['cspc'] | |
181 | #print(self.crossPairs) |
|
184 | ||
182 | for n in range(len(self.data.pairs)): |
|
185 | for n in range(len(self.data.pairs)): | |
183 | #pair = self.data.pairs[n] |
|
186 | ||
184 | pair = self.crossPairs[n] |
|
187 | pair = self.crossPairs[n] | |
185 |
|
188 | |||
186 | coh = cspc[n*2] |
|
189 | coh = cspc[n*2] | |
@@ -238,6 +241,7 class RTIPlot(Plot): | |||||
238 | if len(self.channelList) == 0: |
|
241 | if len(self.channelList) == 0: | |
239 | self.channelList = dataOut.channelList |
|
242 | self.channelList = dataOut.channelList | |
240 |
|
243 | |||
|
244 | ||||
241 | def update(self, dataOut): |
|
245 | def update(self, dataOut): | |
242 | self.update_list(dataOut) |
|
246 | self.update_list(dataOut) | |
243 | data = {} |
|
247 | data = {} |
@@ -691,7 +691,7 class Reader(object): | |||||
691 | """Check if the given datetime is in range""" |
|
691 | """Check if the given datetime is in range""" | |
692 | startDateTime= datetime.datetime.combine(startDate,startTime) |
|
692 | startDateTime= datetime.datetime.combine(startDate,startTime) | |
693 | endDateTime = datetime.datetime.combine(endDate,endTime) |
|
693 | endDateTime = datetime.datetime.combine(endDate,endTime) | |
694 | #print("dt eval: ", dt, startDateTime,endDateTime) |
|
694 | ||
695 | if startDateTime <= dt <= endDateTime: |
|
695 | if startDateTime <= dt <= endDateTime: | |
696 | return True |
|
696 | return True | |
697 | return False |
|
697 | return False |
@@ -644,7 +644,7 class AMISRReader(ProcessingUnit): | |||||
644 |
|
644 | |||
645 | self.profileIndex += 1 |
|
645 | self.profileIndex += 1 | |
646 |
|
646 | |||
647 | return self.dataOut.data |
|
647 | return self.dataOut.data #retorno necesario?? | |
648 |
|
648 | |||
649 |
|
649 | |||
650 | def run(self, **kwargs): |
|
650 | def run(self, **kwargs): |
@@ -82,7 +82,7 class HDFReader(Reader, ProcessingUnit): | |||||
82 |
|
82 | |||
83 | def __init__(self): |
|
83 | def __init__(self): | |
84 | ProcessingUnit.__init__(self) |
|
84 | ProcessingUnit.__init__(self) | |
85 | self.dataOut = Parameters() |
|
85 | ||
86 | self.ext = ".hdf5" |
|
86 | self.ext = ".hdf5" | |
87 | self.optchar = "D" |
|
87 | self.optchar = "D" | |
88 | self.meta = {} |
|
88 | self.meta = {} | |
@@ -95,6 +95,10 class HDFReader(Reader, ProcessingUnit): | |||||
95 | self.folderfmt = "*%Y%j" |
|
95 | self.folderfmt = "*%Y%j" | |
96 | self.utcoffset = 0 |
|
96 | self.utcoffset = 0 | |
97 |
|
97 | |||
|
98 | self.dataOut = Parameters() | |||
|
99 | self.dataOut.error=False ## NOTE: Importante definir esto antes inicio | |||
|
100 | self.dataOut.flagNoData = True | |||
|
101 | ||||
98 | def setup(self, **kwargs): |
|
102 | def setup(self, **kwargs): | |
99 |
|
103 | |||
100 | self.set_kwargs(**kwargs) |
|
104 | self.set_kwargs(**kwargs) | |
@@ -109,7 +113,7 class HDFReader(Reader, ProcessingUnit): | |||||
109 | self.endDate, self.expLabel, self.ext, self.walk, |
|
113 | self.endDate, self.expLabel, self.ext, self.walk, | |
110 | self.filefmt, self.folderfmt) |
|
114 | self.filefmt, self.folderfmt) | |
111 | pathname, filename = os.path.split(fullpath) |
|
115 | pathname, filename = os.path.split(fullpath) | |
112 | #print(pathname,filename) |
|
116 | ||
113 | try: |
|
117 | try: | |
114 | fullpath = next(fullpath) |
|
118 | fullpath = next(fullpath) | |
115 |
|
119 | |||
@@ -140,7 +144,7 class HDFReader(Reader, ProcessingUnit): | |||||
140 |
|
144 | |||
141 | self.setNextFile() |
|
145 | self.setNextFile() | |
142 |
|
146 | |||
143 | return |
|
147 | ||
144 |
|
148 | |||
145 |
|
149 | |||
146 | def readFirstHeader(self): |
|
150 | def readFirstHeader(self): | |
@@ -150,16 +154,12 class HDFReader(Reader, ProcessingUnit): | |||||
150 | self.__readData() |
|
154 | self.__readData() | |
151 | self.__setBlockList() |
|
155 | self.__setBlockList() | |
152 |
|
156 | |||
153 | if 'type' in self.meta: |
|
|||
154 | ##print("Creting dataOut...") |
|
|||
155 | self.dataOut = eval(self.meta['type'])() |
|
|||
156 | ##print(vars(self.dataOut)) |
|
|||
157 |
|
157 | |||
158 | for attr in self.meta: |
|
158 | for attr in self.meta: | |
159 | ##print("attr: ", attr) |
|
|||
160 | ##print(type(self.dataOut).__name__) |
|
|||
161 | setattr(self.dataOut, attr, self.meta[attr]) |
|
|||
162 |
|
159 | |||
|
160 | setattr(self.dataOut, attr, self.meta[attr]) | |||
|
161 | self.dataOut.error=False | |||
|
162 | self.dataOut.flagNoData = False | |||
163 | self.blockIndex = 0 |
|
163 | self.blockIndex = 0 | |
164 |
|
164 | |||
165 | return |
|
165 | return | |
@@ -276,10 +276,10 class HDFReader(Reader, ProcessingUnit): | |||||
276 | if not self.isDateTimeInRange(self.startFileDatetime, self.startDate, self.endDate, self.startTime, self.endTime): |
|
276 | if not self.isDateTimeInRange(self.startFileDatetime, self.startDate, self.endDate, self.startTime, self.endTime): | |
277 | self.dataOut.flagNoData = True |
|
277 | self.dataOut.flagNoData = True | |
278 | self.blockIndex = self.blocksPerFile |
|
278 | self.blockIndex = self.blocksPerFile | |
279 |
|
|
279 | self.dataOut.error = True # TERMINA EL PROGRAMA | |
280 | return |
|
280 | return | |
281 | for attr in self.data: |
|
281 | for attr in self.data: | |
282 | #print("attr ",attr) |
|
282 | ||
283 | if self.data[attr].ndim == 1: |
|
283 | if self.data[attr].ndim == 1: | |
284 | setattr(self.dataOut, attr, self.data[attr][self.blockIndex]) |
|
284 | setattr(self.dataOut, attr, self.data[attr][self.blockIndex]) | |
285 | else: |
|
285 | else: | |
@@ -298,9 +298,11 class HDFReader(Reader, ProcessingUnit): | |||||
298 | self.blockIndex, |
|
298 | self.blockIndex, | |
299 | self.blocksPerFile),self.name) |
|
299 | self.blocksPerFile),self.name) | |
300 |
|
300 | |||
|
301 | if self.blockIndex == self.blocksPerFile: | |||
|
302 | self.setNextFile() | |||
|
303 | ||||
301 | self.dataOut.flagNoData = False |
|
304 | self.dataOut.flagNoData = False | |
302 | self.dataOut.error = False |
|
305 | ||
303 | return |
|
|||
304 |
|
306 | |||
305 | def run(self, **kwargs): |
|
307 | def run(self, **kwargs): | |
306 |
|
308 | |||
@@ -308,13 +310,8 class HDFReader(Reader, ProcessingUnit): | |||||
308 | self.setup(**kwargs) |
|
310 | self.setup(**kwargs) | |
309 | self.isConfig = True |
|
311 | self.isConfig = True | |
310 |
|
312 | |||
311 | if self.blockIndex == self.blocksPerFile: |
|
|||
312 | self.setNextFile() |
|
|||
313 |
|
||||
314 | self.getData() |
|
313 | self.getData() | |
315 |
|
314 | |||
316 | return |
|
|||
317 |
|
||||
318 | @MPDecorator |
|
315 | @MPDecorator | |
319 | class HDFWriter(Operation): |
|
316 | class HDFWriter(Operation): | |
320 | """Operation to write HDF5 files. |
|
317 | """Operation to write HDF5 files. | |
@@ -645,7 +642,6 class HDFWriter(Operation): | |||||
645 | if (self.blockIndex == self.blocksPerFile) or self.timeFlag(): |
|
642 | if (self.blockIndex == self.blocksPerFile) or self.timeFlag(): | |
646 | self.closeFile() |
|
643 | self.closeFile() | |
647 | self.setNextFile() |
|
644 | self.setNextFile() | |
648 | print("breaking file") |
|
|||
649 |
|
645 | |||
650 | for i, ds in enumerate(self.ds): |
|
646 | for i, ds in enumerate(self.ds): | |
651 | attr, ch = self.data[i] |
|
647 | attr, ch = self.data[i] |
@@ -32,6 +32,7 class ProcessingUnit(object): | |||||
32 |
|
32 | |||
33 | self.dataIn = unit.dataOut |
|
33 | self.dataIn = unit.dataOut | |
34 |
|
34 | |||
|
35 | ||||
35 | def getAllowedArgs(self): |
|
36 | def getAllowedArgs(self): | |
36 | if hasattr(self, '__attrs__'): |
|
37 | if hasattr(self, '__attrs__'): | |
37 | return self.__attrs__ |
|
38 | return self.__attrs__ | |
@@ -64,6 +65,7 class ProcessingUnit(object): | |||||
64 | self.dataOut.error = self.dataIn.error |
|
65 | self.dataOut.error = self.dataIn.error | |
65 | self.dataOut.flagNoData = True |
|
66 | self.dataOut.flagNoData = True | |
66 | except: |
|
67 | except: | |
|
68 | ||||
67 | err = traceback.format_exc() |
|
69 | err = traceback.format_exc() | |
68 | if 'SchainWarning' in err: |
|
70 | if 'SchainWarning' in err: | |
69 | log.warning(err.split('SchainWarning:')[-1].split('\n')[0].strip(), self.name) |
|
71 | log.warning(err.split('SchainWarning:')[-1].split('\n')[0].strip(), self.name) |
@@ -142,6 +142,7 class ParametersProc(ProcessingUnit): | |||||
142 | # self.dataOut.normFactor = self.dataIn.normFactor |
|
142 | # self.dataOut.normFactor = self.dataIn.normFactor | |
143 | self.dataOut.pairsList = self.dataIn.pairsList |
|
143 | self.dataOut.pairsList = self.dataIn.pairsList | |
144 | self.dataOut.groupList = self.dataIn.pairsList |
|
144 | self.dataOut.groupList = self.dataIn.pairsList | |
|
145 | ||||
145 | self.dataOut.flagNoData = False |
|
146 | self.dataOut.flagNoData = False | |
146 |
|
147 | |||
147 | if hasattr(self.dataIn, 'ChanDist'): #Distances of receiver channels |
|
148 | if hasattr(self.dataIn, 'ChanDist'): #Distances of receiver channels | |
@@ -183,7 +184,6 class ParametersProc(ProcessingUnit): | |||||
183 | if self.dataIn.type == "Parameters": |
|
184 | if self.dataIn.type == "Parameters": | |
184 | self.dataOut.copy(self.dataIn) |
|
185 | self.dataOut.copy(self.dataIn) | |
185 | self.dataOut.flagNoData = False |
|
186 | self.dataOut.flagNoData = False | |
186 | self.prin("DAta In") |
|
|||
187 | return True |
|
187 | return True | |
188 |
|
188 | |||
189 | self.__updateObjFromInput() |
|
189 | self.__updateObjFromInput() |
@@ -20,7 +20,7 from schainpy.model.data.jrodata import hildebrand_sekhon | |||||
20 | from schainpy.utils import log |
|
20 | from schainpy.utils import log | |
21 |
|
21 | |||
22 | from scipy.optimize import curve_fit |
|
22 | from scipy.optimize import curve_fit | |
23 |
|
23 | SPEED_OF_LIGHT = 299792458 | ||
24 |
|
24 | |||
25 | class SpectraProc(ProcessingUnit): |
|
25 | class SpectraProc(ProcessingUnit): | |
26 |
|
26 | |||
@@ -68,6 +68,8 class SpectraProc(ProcessingUnit): | |||||
68 | self.dataOut.azimuthList = self.dataIn.azimuthList |
|
68 | self.dataOut.azimuthList = self.dataIn.azimuthList | |
69 | self.dataOut.elevationList = self.dataIn.elevationList |
|
69 | self.dataOut.elevationList = self.dataIn.elevationList | |
70 |
|
70 | |||
|
71 | ||||
|
72 | ||||
71 | def __getFft(self): |
|
73 | def __getFft(self): | |
72 | """ |
|
74 | """ | |
73 | Convierte valores de Voltaje a Spectra |
|
75 | Convierte valores de Voltaje a Spectra | |
@@ -121,7 +123,7 class SpectraProc(ProcessingUnit): | |||||
121 | self.dataOut.flagShiftFFT = False |
|
123 | self.dataOut.flagShiftFFT = False | |
122 |
|
124 | |||
123 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False): |
|
125 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False): | |
124 | #print("spectra run") |
|
126 | ||
125 | if self.dataIn.type == "Spectra": |
|
127 | if self.dataIn.type == "Spectra": | |
126 | self.dataOut.copy(self.dataIn) |
|
128 | self.dataOut.copy(self.dataIn) | |
127 | if shift_fft: |
|
129 | if shift_fft: | |
@@ -135,6 +137,7 class SpectraProc(ProcessingUnit): | |||||
135 | if pairsList: |
|
137 | if pairsList: | |
136 | self.__selectPairs(pairsList) |
|
138 | self.__selectPairs(pairsList) | |
137 |
|
139 | |||
|
140 | ||||
138 | elif self.dataIn.type == "Voltage": |
|
141 | elif self.dataIn.type == "Voltage": | |
139 |
|
142 | |||
140 | self.dataOut.flagNoData = True |
|
143 | self.dataOut.flagNoData = True | |
@@ -546,7 +549,6 class CleanRayleigh(Operation): | |||||
546 | self.currentTime = self.__initime |
|
549 | self.currentTime = self.__initime | |
547 | self.pairsArray = numpy.array(dataOut.pairsList) |
|
550 | self.pairsArray = numpy.array(dataOut.pairsList) | |
548 | self.factor_stdv = factor_stdv |
|
551 | self.factor_stdv = factor_stdv | |
549 | #print("CHANNELS: ",[x for x in self.channels]) |
|
|||
550 |
|
552 | |||
551 | if n != None : |
|
553 | if n != None : | |
552 | self.byProfiles = True |
|
554 | self.byProfiles = True | |
@@ -560,11 +562,11 class CleanRayleigh(Operation): | |||||
560 |
|
562 | |||
561 |
|
563 | |||
562 | def run(self, dataOut,min_hei=None,max_hei=None, n=None, timeInterval=10,factor_stdv=2.5): |
|
564 | def run(self, dataOut,min_hei=None,max_hei=None, n=None, timeInterval=10,factor_stdv=2.5): | |
563 | #print (dataOut.utctime) |
|
565 | ||
564 | if not self.isConfig : |
|
566 | if not self.isConfig : | |
565 | #print("Setting config") |
|
567 | ||
566 | self.setup(dataOut, min_hei,max_hei,n,timeInterval,factor_stdv) |
|
568 | self.setup(dataOut, min_hei,max_hei,n,timeInterval,factor_stdv) | |
567 | #print("Config Done") |
|
569 | ||
568 | tini=dataOut.utctime |
|
570 | tini=dataOut.utctime | |
569 |
|
571 | |||
570 | if self.byProfiles: |
|
572 | if self.byProfiles: | |
@@ -572,14 +574,14 class CleanRayleigh(Operation): | |||||
572 | self.__dataReady = True |
|
574 | self.__dataReady = True | |
573 | else: |
|
575 | else: | |
574 | if (tini - self.__initime) >= self.__integrationtime: |
|
576 | if (tini - self.__initime) >= self.__integrationtime: | |
575 | #print(tini - self.__initime,self.__profIndex) |
|
577 | ||
576 | self.__dataReady = True |
|
578 | self.__dataReady = True | |
577 | self.__initime = tini |
|
579 | self.__initime = tini | |
578 |
|
580 | |||
579 | #if (tini.tm_min % 2) == 0 and (tini.tm_sec < 5 and self.fint==0): |
|
581 | #if (tini.tm_min % 2) == 0 and (tini.tm_sec < 5 and self.fint==0): | |
580 |
|
582 | |||
581 | if self.__dataReady: |
|
583 | if self.__dataReady: | |
582 | #print("Data ready",self.__profIndex) |
|
584 | ||
583 | self.__profIndex = 0 |
|
585 | self.__profIndex = 0 | |
584 | jspc = self.buffer |
|
586 | jspc = self.buffer | |
585 | jcspc = self.buffer2 |
|
587 | jcspc = self.buffer2 | |
@@ -1075,7 +1077,6 class IntegrationFaradaySpectra(Operation): | |||||
1075 | buffer_cspc=numpy.copy(self.__buffer_cspc[:,:,:,k]) |
|
1077 | buffer_cspc=numpy.copy(self.__buffer_cspc[:,:,:,k]) | |
1076 | outliers_IDs_cspc=[] |
|
1078 | outliers_IDs_cspc=[] | |
1077 | cspc_outliers_exist=False |
|
1079 | cspc_outliers_exist=False | |
1078 | #print("AQUIII") |
|
|||
1079 | for i in range(self.nChannels):#dataOut.nChannels): |
|
1080 | for i in range(self.nChannels):#dataOut.nChannels): | |
1080 |
|
1081 | |||
1081 | buffer1=numpy.copy(self.__buffer_spc[:,i,:,k]) |
|
1082 | buffer1=numpy.copy(self.__buffer_spc[:,i,:,k]) |
General Comments 0
You need to be logged in to leave comments.
Login now