##// END OF EJS Templates
Multiprocessing for BLTR (all operations) working
George Yong -
r1185:3cc57dcc4bfb
parent child
Show More
@@ -13,7 +13,7 import datetime
13
13
14 import numpy
14 import numpy
15
15
16 from schainpy.model.proc.jroproc_base import ProcessingUnit
16 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
17 from schainpy.model.data.jrodata import Parameters
17 from schainpy.model.data.jrodata import Parameters
18 from schainpy.model.io.jroIO_base import JRODataReader, isNumber
18 from schainpy.model.io.jroIO_base import JRODataReader, isNumber
19 from schainpy.utils import log
19 from schainpy.utils import log
@@ -83,7 +83,7 DATA_STRUCTURE = numpy.dtype([
83 ('sea_algorithm', '<u4')
83 ('sea_algorithm', '<u4')
84 ])
84 ])
85
85
86
86 @MPDecorator
87 class BLTRParamReader(JRODataReader, ProcessingUnit):
87 class BLTRParamReader(JRODataReader, ProcessingUnit):
88 '''
88 '''
89 Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files
89 Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files
@@ -91,9 +91,9 class BLTRParamReader(JRODataReader, ProcessingUnit):
91
91
92 ext = '.sswma'
92 ext = '.sswma'
93
93
94 def __init__(self, **kwargs):
94 def __init__(self):
95
95
96 ProcessingUnit.__init__(self, **kwargs)
96 ProcessingUnit.__init__(self)
97
97
98 self.dataOut = Parameters()
98 self.dataOut = Parameters()
99 self.counter_records = 0
99 self.counter_records = 0
@@ -246,7 +246,7 class BLTRParamReader(JRODataReader, ProcessingUnit):
246 self.nranges = header_rec['nranges'][0]
246 self.nranges = header_rec['nranges'][0]
247 self.fp.seek(pointer)
247 self.fp.seek(pointer)
248 self.height = numpy.empty((self.nmodes, self.nranges))
248 self.height = numpy.empty((self.nmodes, self.nranges))
249 self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges))
249 self.snr = numpy.empty((self.nmodes, int(self.nchannels), self.nranges))
250 self.buffer = numpy.empty((self.nmodes, 3, self.nranges))
250 self.buffer = numpy.empty((self.nmodes, 3, self.nranges))
251 self.flagDiscontinuousBlock = 0
251 self.flagDiscontinuousBlock = 0
252
252
@@ -268,9 +268,9 class BLTRParamReader(JRODataReader, ProcessingUnit):
268
268
269 header_structure = numpy.dtype(
269 header_structure = numpy.dtype(
270 REC_HEADER_STRUCTURE.descr + [
270 REC_HEADER_STRUCTURE.descr + [
271 ('antenna_coord', 'f4', (2, self.nchannels)),
271 ('antenna_coord', 'f4', (2, int(self.nchannels))),
272 ('rx_gains', 'u4', (self.nchannels,)),
272 ('rx_gains', 'u4', (int(self.nchannels),)),
273 ('rx_analysis', 'u4', (self.nchannels,))
273 ('rx_analysis', 'u4', (int(self.nchannels),))
274 ]
274 ]
275 )
275 )
276
276
@@ -296,6 +296,7 class BLTRParamReader(JRODataReader, ProcessingUnit):
296 status_value - Array data is set to NAN for values that are not equal to status_value
296 status_value - Array data is set to NAN for values that are not equal to status_value
297
297
298 '''
298 '''
299 self.nchannels = int(self.nchannels)
299
300
300 data_structure = numpy.dtype(
301 data_structure = numpy.dtype(
301 DATA_STRUCTURE.descr + [
302 DATA_STRUCTURE.descr + [
@@ -367,3 +368,4 class BLTRParamReader(JRODataReader, ProcessingUnit):
367 self.set_output()
368 self.set_output()
368
369
369 return 1
370 return 1
371 No newline at end of file
@@ -12,11 +12,13 from time import gmtime
12
12
13 from numpy import transpose
13 from numpy import transpose
14
14
15 from .jroproc_base import ProcessingUnit, Operation
15 from .jroproc_base import ProcessingUnit, MPDecorator, Operation
16 from schainpy.model.data.jrodata import Parameters
16 from schainpy.model.data.jrodata import Parameters
17
17
18
18 @MPDecorator
19 class BLTRParametersProc(ProcessingUnit):
19 class BLTRParametersProc(ProcessingUnit):
20
21 METHODS = {}
20 '''
22 '''
21 Processing unit for BLTR parameters data (winds)
23 Processing unit for BLTR parameters data (winds)
22
24
@@ -39,11 +41,12 class BLTRParametersProc(ProcessingUnit):
39 self.dataOut.year - Experiment year
41 self.dataOut.year - Experiment year
40 '''
42 '''
41
43
42 def __init__(self, **kwargs):
44 def __init__(self):
43 '''
45 '''
44 Inputs: None
46 Inputs: None
45 '''
47 '''
46 ProcessingUnit.__init__(self, **kwargs)
48 ProcessingUnit.__init__(self)
49 self.setupReq = False
47 self.dataOut = Parameters()
50 self.dataOut = Parameters()
48 self.isConfig = False
51 self.isConfig = False
49
52
@@ -77,12 +80,13 class BLTRParametersProc(ProcessingUnit):
77 self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan
80 self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan
78
81
79 # TODO
82 # TODO
83 @MPDecorator
80 class OutliersFilter(Operation):
84 class OutliersFilter(Operation):
81
85
82 def __init__(self, **kwargs):
86 def __init__(self):
83 '''
87 '''
84 '''
88 '''
85 Operation.__init__(self, **kwargs)
89 Operation.__init__(self)
86
90
87 def run(self, svalue2, method, factor, filter, npoints=9):
91 def run(self, svalue2, method, factor, filter, npoints=9):
88 '''
92 '''
General Comments 0
You need to be logged in to leave comments. Login now