@@ -242,14 +242,18 the parameters related to distances such as heightList, or heightResolution wich | |||||
242 |
|
242 | |||
243 | @property |
|
243 | @property | |
244 | def ltctime(self): |
|
244 | def ltctime(self): | |
245 |
|
245 | try: | ||
|
246 | self.timeZone = self.timeZone.decode("utf-8") | |||
|
247 | except Exception as e: | |||
|
248 | pass | |||
|
249 | ||||
246 | if self.useLocalTime: |
|
250 | if self.useLocalTime: | |
247 | if self.timeZone =='lt': |
|
251 | if self.timeZone =='lt': | |
248 | return self.utctime - 300 * 60 |
|
252 | return self.utctime - 300 * 60 | |
249 | elif self.timeZone =='ut': |
|
253 | elif self.timeZone =='ut': | |
250 | return self.utctime |
|
254 | return self.utctime | |
251 | else: |
|
255 | else: | |
252 | log.error("No valid timeZone detected") |
|
256 | log.error("No valid timeZone detected:{}".format(self.timeZone)) | |
253 | return self.utctime |
|
257 | return self.utctime | |
254 |
|
258 | |||
255 | @property |
|
259 | @property |
@@ -107,7 +107,7 class PowerPlot(RTIPlot): | |||||
107 | def update(self, dataOut): |
|
107 | def update(self, dataOut): | |
108 | self.update_list(dataOut) |
|
108 | self.update_list(dataOut) | |
109 | data = { |
|
109 | data = { | |
110 |
'pow': 10*numpy.log10(dataOut.data_pow |
|
110 | 'pow': 10*numpy.log10(dataOut.data_pow) | |
111 | } |
|
111 | } | |
112 | try: |
|
112 | try: | |
113 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
|
113 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
@@ -728,13 +728,13 class RTIPlot(Plot): | |||||
728 | cmap=plt.get_cmap(self.colormap) |
|
728 | cmap=plt.get_cmap(self.colormap) | |
729 | ) |
|
729 | ) | |
730 | if self.showprofile: |
|
730 | if self.showprofile: | |
731 | ax.plot_profile = self.pf_axes[n].plot( |
|
731 | ax.plot_profile = self.pf_axes[n].plot(data[self.CODE][n], self.y)[0] | |
732 | data[self.CODE][n], self.y)[0] |
|
|||
733 | if "noise" in self.data: |
|
732 | if "noise" in self.data: | |
|
733 | ||||
734 | ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(data['noise'][n], len(self.y)), self.y, |
|
734 | ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(data['noise'][n], len(self.y)), self.y, | |
735 | color="k", linestyle="dashed", lw=1)[0] |
|
735 | color="k", linestyle="dashed", lw=1)[0] | |
736 | else: |
|
736 | else: | |
737 |
ax.collections.remove(ax.collections[0]) |
|
737 | ax.collections.remove(ax.collections[0]) | |
738 | ax.plt = ax.pcolormesh(x, y, z[n].T, |
|
738 | ax.plt = ax.pcolormesh(x, y, z[n].T, | |
739 | vmin=self.zmin, |
|
739 | vmin=self.zmin, | |
740 | vmax=self.zmax, |
|
740 | vmax=self.zmax, | |
@@ -743,8 +743,7 class RTIPlot(Plot): | |||||
743 | if self.showprofile: |
|
743 | if self.showprofile: | |
744 | ax.plot_profile.set_data(data[self.CODE][n], self.y) |
|
744 | ax.plot_profile.set_data(data[self.CODE][n], self.y) | |
745 | if "noise" in self.data: |
|
745 | if "noise" in self.data: | |
746 |
ax.plot_noise |
|
746 | ax.plot_noise.set_data(numpy.repeat(data['noise'][n], len(self.y)), self.y) | |
747 | color="k", linestyle="dashed", lw=1)[0] |
|
|||
748 |
|
747 | |||
749 | class SpectrogramPlot(Plot): |
|
748 | class SpectrogramPlot(Plot): | |
750 | ''' |
|
749 | ''' | |
@@ -819,7 +818,7 class SpectrogramPlot(Plot): | |||||
819 | cmap=plt.get_cmap(self.colormap) |
|
818 | cmap=plt.get_cmap(self.colormap) | |
820 | ) |
|
819 | ) | |
821 | else: |
|
820 | else: | |
822 |
|
|
821 | ax.collections.remove(ax.collections[0]) # error while running | |
823 | ax.plt = ax.pcolormesh(x, y, z[n].T, |
|
822 | ax.plt = ax.pcolormesh(x, y, z[n].T, | |
824 | vmin=self.zmin, |
|
823 | vmin=self.zmin, | |
825 | vmax=self.zmax, |
|
824 | vmax=self.zmax, | |
@@ -1541,7 +1540,7 class NoiselessRTIPlot(RTIPlot): | |||||
1541 | ax.plot_profile = self.pf_axes[n].plot(data['noiseless_rti'][n], self.y)[0] |
|
1540 | ax.plot_profile = self.pf_axes[n].plot(data['noiseless_rti'][n], self.y)[0] | |
1542 |
|
1541 | |||
1543 | else: |
|
1542 | else: | |
1544 |
|
|
1543 | ax.collections.remove(ax.collections[0]) # error while running | |
1545 | ax.plt = ax.pcolormesh(x, y, z[n].T, |
|
1544 | ax.plt = ax.pcolormesh(x, y, z[n].T, | |
1546 | vmin=self.zmin, |
|
1545 | vmin=self.zmin, | |
1547 | vmax=self.zmax, |
|
1546 | vmax=self.zmax, | |
@@ -1622,7 +1621,7 class OutliersRTIPlot(Plot): | |||||
1622 | else: |
|
1621 | else: | |
1623 | if self.zlimits is not None: |
|
1622 | if self.zlimits is not None: | |
1624 | self.zmin, self.zmax = self.zlimits[n] |
|
1623 | self.zmin, self.zmax = self.zlimits[n] | |
1625 |
|
|
1624 | ax.collections.remove(ax.collections[0]) # error while running | |
1626 | ax.plt = ax.pcolormesh(x, y, z[n].T , |
|
1625 | ax.plt = ax.pcolormesh(x, y, z[n].T , | |
1627 | vmin=self.zmin, |
|
1626 | vmin=self.zmin, | |
1628 | vmax=self.zmax, |
|
1627 | vmax=self.zmax, | |
@@ -1700,7 +1699,7 class NIncohIntRTIPlot(Plot): | |||||
1700 | else: |
|
1699 | else: | |
1701 | if self.zlimits is not None: |
|
1700 | if self.zlimits is not None: | |
1702 | self.zmin, self.zmax = self.zlimits[n] |
|
1701 | self.zmin, self.zmax = self.zlimits[n] | |
1703 |
|
|
1702 | ax.collections.remove(ax.collections[0]) # error while running | |
1704 | ax.plt = ax.pcolormesh(x, y, z[n].T , |
|
1703 | ax.plt = ax.pcolormesh(x, y, z[n].T , | |
1705 | vmin=self.zmin, |
|
1704 | vmin=self.zmin, | |
1706 | vmax=self.zmax, |
|
1705 | vmax=self.zmax, |
@@ -174,8 +174,8 class HDFReader(Reader, ProcessingUnit): | |||||
174 | self.__readMetadata2() |
|
174 | self.__readMetadata2() | |
175 | self.__readData() |
|
175 | self.__readData() | |
176 | self.__setBlockList() |
|
176 | self.__setBlockList() | |
177 | if 'type' in self.meta: |
|
177 | # if 'type' in self.meta: | |
178 | self.dataOut = eval(self.meta['type'])() |
|
178 | # self.dataOut = eval(self.meta['type'])() | |
179 |
|
179 | |||
180 | for attr in self.meta: |
|
180 | for attr in self.meta: | |
181 | if "processingHeaderObj" in attr: |
|
181 | if "processingHeaderObj" in attr: | |
@@ -268,6 +268,7 class HDFReader(Reader, ProcessingUnit): | |||||
268 | Reads Metadata |
|
268 | Reads Metadata | |
269 | ''' |
|
269 | ''' | |
270 | meta = {} |
|
270 | meta = {} | |
|
271 | ||||
271 | if self.description: |
|
272 | if self.description: | |
272 | for key, value in self.description['Metadata'].items(): |
|
273 | for key, value in self.description['Metadata'].items(): | |
273 | meta[key] = self.fp[value][()] |
|
274 | meta[key] = self.fp[value][()] |
@@ -165,7 +165,7 class MergeH5(object): | |||||
165 | def readFile(self,fp,ch): |
|
165 | def readFile(self,fp,ch): | |
166 | '''Read metadata and data''' |
|
166 | '''Read metadata and data''' | |
167 | self.readMetadata(fp,ch) |
|
167 | self.readMetadata(fp,ch) | |
168 | #print(self.metadataList) |
|
168 | # print(self.metadataList) | |
169 | data = self.readData(fp) |
|
169 | data = self.readData(fp) | |
170 | for attr in self.meta: |
|
170 | for attr in self.meta: | |
171 | if "processingHeaderObj" in attr: |
|
171 | if "processingHeaderObj" in attr: | |
@@ -173,7 +173,7 class MergeH5(object): | |||||
173 | if "radarControllerHeaderObj" in attr: |
|
173 | if "radarControllerHeaderObj" in attr: | |
174 | self.flagControllerHeader=True |
|
174 | self.flagControllerHeader=True | |
175 | at = attr.split('.') |
|
175 | at = attr.split('.') | |
176 | #print("AT ", at) |
|
176 | # print("AT ", at) | |
177 | if len(at) > 1: |
|
177 | if len(at) > 1: | |
178 | setattr(eval("self.ch_dataIn[ch]."+at[0]),at[1], self.meta[attr]) |
|
178 | setattr(eval("self.ch_dataIn[ch]."+at[0]),at[1], self.meta[attr]) | |
179 | else: |
|
179 | else: | |
@@ -229,7 +229,7 class MergeH5(object): | |||||
229 | setattr(dataIn, attr, data[attr][:]) |
|
229 | setattr(dataIn, attr, data[attr][:]) | |
230 | else: |
|
230 | else: | |
231 | setattr(dataIn, attr, numpy.squeeze(data[attr][:,:])) |
|
231 | setattr(dataIn, attr, numpy.squeeze(data[attr][:,:])) | |
232 | #print("shape in", dataIn.data_spc.shape, len(dataIn.data_spc)) |
|
232 | # print("shape in", dataIn.data_spc.shape, len(dataIn.data_spc)) | |
233 | if self.flag_spc: |
|
233 | if self.flag_spc: | |
234 | if dataIn.data_spc.ndim > 3: |
|
234 | if dataIn.data_spc.ndim > 3: | |
235 | dataIn.data_spc = dataIn.data_spc[0] |
|
235 | dataIn.data_spc = dataIn.data_spc[0] | |
@@ -256,6 +256,7 class MergeH5(object): | |||||
256 | setattr(self.ch_dataIn[ich], self.dataList[i], dataAux[0:self.blocksPerFile]) |
|
256 | setattr(self.ch_dataIn[ich], self.dataList[i], dataAux[0:self.blocksPerFile]) | |
257 | # print(getattr(self.ch_dataIn[ich], self.dataList[i]).shape) |
|
257 | # print(getattr(self.ch_dataIn[ich], self.dataList[i]).shape) | |
258 | else: |
|
258 | else: | |
|
259 | # log.error("Channels number error,iresh_ch=", iresh_ch) | |||
259 | return |
|
260 | return | |
260 | def getLabel(self, name, x=None): |
|
261 | def getLabel(self, name, x=None): | |
261 | if x is None: |
|
262 | if x is None: | |
@@ -289,8 +290,9 class MergeH5(object): | |||||
289 | return 'pair{:02d}'.format(x) |
|
290 | return 'pair{:02d}'.format(x) | |
290 | else: |
|
291 | else: | |
291 | return 'channel{:02d}'.format(x) |
|
292 | return 'channel{:02d}'.format(x) | |
|
293 | ||||
292 | def readData(self, fp): |
|
294 | def readData(self, fp): | |
293 | #print("read fp: ", fp) |
|
295 | # print("read fp: ", fp) | |
294 | data = {} |
|
296 | data = {} | |
295 | grp = fp['Data'] |
|
297 | grp = fp['Data'] | |
296 | for name in grp: |
|
298 | for name in grp: | |
@@ -302,7 +304,7 class MergeH5(object): | |||||
302 | self.flag_snr = True |
|
304 | self.flag_snr = True | |
303 | if "nIncohInt" in name: |
|
305 | if "nIncohInt" in name: | |
304 | self.flag_nIcoh = True |
|
306 | self.flag_nIcoh = True | |
305 |
|
307 | # print("spc:",self.flag_spc," pow:",self.flag_pow," snr:", self.flag_snr) | ||
306 | if isinstance(grp[name], h5py.Dataset): |
|
308 | if isinstance(grp[name], h5py.Dataset): | |
307 | array = grp[name][()] |
|
309 | array = grp[name][()] | |
308 | elif isinstance(grp[name], h5py.Group): |
|
310 | elif isinstance(grp[name], h5py.Group): | |
@@ -314,7 +316,9 class MergeH5(object): | |||||
314 | print('Unknown type: {}'.format(name)) |
|
316 | print('Unknown type: {}'.format(name)) | |
315 | data[name] = array |
|
317 | data[name] = array | |
316 | return data |
|
318 | return data | |
|
319 | ||||
317 | def getDataOut(self): |
|
320 | def getDataOut(self): | |
|
321 | # print("Getting DataOut") | |||
318 | self.dataOut = self.ch_dataIn[0].copy() #dataIn #blocks, fft, hei for metadata |
|
322 | self.dataOut = self.ch_dataIn[0].copy() #dataIn #blocks, fft, hei for metadata | |
319 | if self.flagProcessingHeader: |
|
323 | if self.flagProcessingHeader: | |
320 | self.dataOut.processingHeaderObj = self.ch_dataIn[0].processingHeaderObj.copy() |
|
324 | self.dataOut.processingHeaderObj = self.ch_dataIn[0].processingHeaderObj.copy() | |
@@ -381,8 +385,8 class MergeH5(object): | |||||
381 | else: |
|
385 | else: | |
382 | self.dataOut.nIncohInt = self.ch_dataIn[0].nIncohInt |
|
386 | self.dataOut.nIncohInt = self.ch_dataIn[0].nIncohInt | |
383 | #-------------------------------------------------------------------- |
|
387 | #-------------------------------------------------------------------- | |
384 | #print("utcTime: ", time.shape) |
|
388 | # print("utcTime: ", time.shape) | |
385 | #print("data_spc ",self.dataOut.data_spc.shape) |
|
389 | # print("data_spc ",self.dataOut.data_spc.shape) | |
386 | if "data_cspc" in self.dataList: |
|
390 | if "data_cspc" in self.dataList: | |
387 | pairsList = [pair for pair in itertools.combinations(self.channelList, 2)] |
|
391 | pairsList = [pair for pair in itertools.combinations(self.channelList, 2)] | |
388 | #print("PairsList: ", pairsList) |
|
392 | #print("PairsList: ", pairsList) | |
@@ -452,8 +456,11 class MergeH5(object): | |||||
452 |
|
456 | |||
453 | grp.create_dataset(self.getLabel(attribute), data=value) |
|
457 | grp.create_dataset(self.getLabel(attribute), data=value) | |
454 | return |
|
458 | return | |
|
459 | ||||
455 | def getDsList(self): |
|
460 | def getDsList(self): | |
|
461 | # print("Getting DS List", self.dataList) | |||
456 | dsList =[] |
|
462 | dsList =[] | |
|
463 | dataAux = None | |||
457 | for i in range(len(self.dataList)): |
|
464 | for i in range(len(self.dataList)): | |
458 | dsDict = {} |
|
465 | dsDict = {} | |
459 | if hasattr(self.dataOut, self.dataList[i]): |
|
466 | if hasattr(self.dataOut, self.dataList[i]): | |
@@ -464,7 +471,7 class MergeH5(object): | |||||
464 | continue |
|
471 | continue | |
465 | if dataAux is None: |
|
472 | if dataAux is None: | |
466 | continue |
|
473 | continue | |
467 |
elif isinstance(dataAux, (int, float, numpy.int |
|
474 | elif isinstance(dataAux, (int, float, numpy.int_, numpy.float_)): | |
468 | dsDict['nDim'] = 0 |
|
475 | dsDict['nDim'] = 0 | |
469 | else: |
|
476 | else: | |
470 | dsDict['nDim'] = len(dataAux.shape) -1 |
|
477 | dsDict['nDim'] = len(dataAux.shape) -1 | |
@@ -485,8 +492,9 class MergeH5(object): | |||||
485 | # dsDict['dsNumber'] = dataAux.shape[0] |
|
492 | # dsDict['dsNumber'] = dataAux.shape[0] | |
486 | # dsDict['dtype'] = dataAux.dtype |
|
493 | # dsDict['dtype'] = dataAux.dtype | |
487 | dsList.append(dsDict) |
|
494 | dsList.append(dsDict) | |
488 | #print(dsList) |
|
495 | # print("dsList: ", dsList) | |
489 | self.dsList = dsList |
|
496 | self.dsList = dsList | |
|
497 | ||||
490 | def clean_dataIn(self): |
|
498 | def clean_dataIn(self): | |
491 | for ch in range(self.nChannels): |
|
499 | for ch in range(self.nChannels): | |
492 | self.ch_dataIn[ch].data_spc = None |
|
500 | self.ch_dataIn[ch].data_spc = None | |
@@ -494,9 +502,11 class MergeH5(object): | |||||
494 | self.ch_dataIn[ch].nIncohInt = None |
|
502 | self.ch_dataIn[ch].nIncohInt = None | |
495 | self.meta ={} |
|
503 | self.meta ={} | |
496 | self.blocksPerFile = None |
|
504 | self.blocksPerFile = None | |
|
505 | ||||
497 | def writeData(self, outFilename): |
|
506 | def writeData(self, outFilename): | |
498 | self.getDsList() |
|
507 | self.getDsList() | |
499 | fp = h5py.File(outFilename, 'w') |
|
508 | fp = h5py.File(outFilename, 'w') | |
|
509 | # print("--> Merged file: ",fp) | |||
500 | self.writeMetadata(fp) |
|
510 | self.writeMetadata(fp) | |
501 | grp = fp.create_group('Data') |
|
511 | grp = fp.create_group('Data') | |
502 | dtsets = [] |
|
512 | dtsets = [] | |
@@ -514,7 +524,7 class MergeH5(object): | |||||
514 | else: |
|
524 | else: | |
515 | sgrp = grp |
|
525 | sgrp = grp | |
516 | k = -1*(dsInfo['nDim'] - 1) |
|
526 | k = -1*(dsInfo['nDim'] - 1) | |
517 | #print(k, dsInfo['shape'], dsInfo['shape'][k:]) |
|
527 | # print(k, dsInfo['shape'], dsInfo['shape'][k:]) | |
518 | for i in range(dsInfo['dsNumber']): |
|
528 | for i in range(dsInfo['dsNumber']): | |
519 | ds = sgrp.create_dataset( |
|
529 | ds = sgrp.create_dataset( | |
520 | self.getLabel(dsInfo['variable'], i),(self.blocksPerFile, ) + dsInfo['shape'][k:], |
|
530 | self.getLabel(dsInfo['variable'], i),(self.blocksPerFile, ) + dsInfo['shape'][k:], | |
@@ -539,6 +549,7 class MergeH5(object): | |||||
539 | fp.close() |
|
549 | fp.close() | |
540 | self.clean_dataIn() |
|
550 | self.clean_dataIn() | |
541 | return |
|
551 | return | |
|
552 | ||||
542 | def run(self): |
|
553 | def run(self): | |
543 | if not(self.isConfig): |
|
554 | if not(self.isConfig): | |
544 | self.setup() |
|
555 | self.setup() | |
@@ -549,7 +560,7 class MergeH5(object): | |||||
549 | name = self.filenameList[ch][nf] |
|
560 | name = self.filenameList[ch][nf] | |
550 | filename = os.path.join(self.inPaths[ch], name) |
|
561 | filename = os.path.join(self.inPaths[ch], name) | |
551 | fp = h5py.File(filename, 'r') |
|
562 | fp = h5py.File(filename, 'r') | |
552 |
|
|
563 | print("Opening file: ",filename) | |
553 | self.readFile(fp,ch) |
|
564 | self.readFile(fp,ch) | |
554 | fp.close() |
|
565 | fp.close() | |
555 | if self.blocksPerFile == None: |
|
566 | if self.blocksPerFile == None: | |
@@ -559,7 +570,7 class MergeH5(object): | |||||
559 | print("Error getting DataOut invalid number of blocks") |
|
570 | print("Error getting DataOut invalid number of blocks") | |
560 | return |
|
571 | return | |
561 | name = name[-16:] |
|
572 | name = name[-16:] | |
562 | #print("Final name out: ", name) |
|
573 | # print("Final name out: ", name) | |
563 | outFile = os.path.join(self.pathOut, name) |
|
574 | outFile = os.path.join(self.pathOut, name) | |
564 | #print("Outfile: ", outFile) |
|
575 | # print("Outfile: ", outFile) | |
565 | self.writeData(outFile) No newline at end of file |
|
576 | self.writeData(outFile) |
@@ -137,12 +137,13 class SpectraProc(ProcessingUnit): | |||||
137 |
|
137 | |||
138 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False, |
|
138 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False, | |
139 | zeroPad=False, zeroPoints=0, runNextUnit=0): |
|
139 | zeroPad=False, zeroPoints=0, runNextUnit=0): | |
|
140 | ||||
140 | self.dataIn.runNextUnit = runNextUnit |
|
141 | self.dataIn.runNextUnit = runNextUnit | |
141 | try: |
|
142 | try: | |
142 | type = self.dataIn.type.decode("utf-8") |
|
143 | _type = self.dataIn.type.decode("utf-8") | |
143 | self.dataIn.type = type |
|
144 | self.dataIn.type = _type | |
144 | except Exception as e: |
|
145 | except Exception as e: | |
145 |
# |
|
146 | #print("spc -> ",self.dataIn.type, e) | |
146 | pass |
|
147 | pass | |
147 |
|
148 | |||
148 | if self.dataIn.type == "Spectra": |
|
149 | if self.dataIn.type == "Spectra": |
General Comments 0
You need to be logged in to leave comments.
Login now