@@ -1,19 +1,21 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: murco $ |
|
3 | $Author: murco $ | |
4 | $Id: JRODataIO.py 169 2012-11-19 21:57:03Z murco $ |
|
4 | $Id: JRODataIO.py 169 2012-11-19 21:57:03Z murco $ | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | from jroIO_voltage import * |
|
7 | from jroIO_voltage import * | |
8 | from jroIO_spectra import * |
|
8 | from jroIO_spectra import * | |
9 | from jroIO_heispectra import * |
|
9 | from jroIO_heispectra import * | |
10 | from jroIO_usrp import * |
|
10 | from jroIO_usrp import * | |
11 |
|
11 | |||
12 | from jroIO_kamisr import * |
|
12 | from jroIO_kamisr import * | |
13 | from jroIO_param import * |
|
13 | from jroIO_param import * | |
14 | from jroIO_hf import * |
|
14 | from jroIO_hf import * | |
15 |
|
15 | |||
|
16 | from jroIO_madrigal import * | |||
|
17 | ||||
16 | from bltrIO_param import * |
|
18 | from bltrIO_param import * | |
17 | from jroIO_bltr import * |
|
19 | from jroIO_bltr import * | |
18 | from jroIO_mira35c import * |
|
20 | from jroIO_mira35c import * | |
19 |
|
21 |
@@ -1,364 +1,362 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Nov 9, 2016 |
|
2 | Created on Nov 9, 2016 | |
3 |
|
3 | |||
4 | @author: roj- LouVD |
|
4 | @author: roj- LouVD | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | import os |
|
8 | import os | |
9 | import sys |
|
9 | import sys | |
10 | import time |
|
10 | import time | |
11 | import glob |
|
11 | import glob | |
12 | import datetime |
|
12 | 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 | |
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 |
|
19 | |||
20 | FILE_HEADER_STRUCTURE = numpy.dtype([ |
|
20 | FILE_HEADER_STRUCTURE = numpy.dtype([ | |
21 | ('FMN', '<u4'), |
|
21 | ('FMN', '<u4'), | |
22 | ('nrec', '<u4'), |
|
22 | ('nrec', '<u4'), | |
23 | ('fr_offset', '<u4'), |
|
23 | ('fr_offset', '<u4'), | |
24 | ('id', '<u4'), |
|
24 | ('id', '<u4'), | |
25 | ('site', 'u1', (32,)) |
|
25 | ('site', 'u1', (32,)) | |
26 | ]) |
|
26 | ]) | |
27 |
|
27 | |||
28 | REC_HEADER_STRUCTURE = numpy.dtype([ |
|
28 | REC_HEADER_STRUCTURE = numpy.dtype([ | |
29 | ('rmn', '<u4'), |
|
29 | ('rmn', '<u4'), | |
30 | ('rcounter', '<u4'), |
|
30 | ('rcounter', '<u4'), | |
31 | ('nr_offset', '<u4'), |
|
31 | ('nr_offset', '<u4'), | |
32 | ('tr_offset', '<u4'), |
|
32 | ('tr_offset', '<u4'), | |
33 | ('time', '<u4'), |
|
33 | ('time', '<u4'), | |
34 | ('time_msec', '<u4'), |
|
34 | ('time_msec', '<u4'), | |
35 | ('tag', 'u1', (32,)), |
|
35 | ('tag', 'u1', (32,)), | |
36 | ('comments', 'u1', (32,)), |
|
36 | ('comments', 'u1', (32,)), | |
37 | ('lat', '<f4'), |
|
37 | ('lat', '<f4'), | |
38 | ('lon', '<f4'), |
|
38 | ('lon', '<f4'), | |
39 | ('gps_status', '<u4'), |
|
39 | ('gps_status', '<u4'), | |
40 | ('freq', '<u4'), |
|
40 | ('freq', '<u4'), | |
41 | ('freq0', '<u4'), |
|
41 | ('freq0', '<u4'), | |
42 | ('nchan', '<u4'), |
|
42 | ('nchan', '<u4'), | |
43 | ('delta_r', '<u4'), |
|
43 | ('delta_r', '<u4'), | |
44 | ('nranges', '<u4'), |
|
44 | ('nranges', '<u4'), | |
45 | ('r0', '<u4'), |
|
45 | ('r0', '<u4'), | |
46 | ('prf', '<u4'), |
|
46 | ('prf', '<u4'), | |
47 | ('ncoh', '<u4'), |
|
47 | ('ncoh', '<u4'), | |
48 | ('npoints', '<u4'), |
|
48 | ('npoints', '<u4'), | |
49 | ('polarization', '<i4'), |
|
49 | ('polarization', '<i4'), | |
50 | ('rx_filter', '<u4'), |
|
50 | ('rx_filter', '<u4'), | |
51 | ('nmodes', '<u4'), |
|
51 | ('nmodes', '<u4'), | |
52 | ('dmode_index', '<u4'), |
|
52 | ('dmode_index', '<u4'), | |
53 | ('dmode_rngcorr', '<u4'), |
|
53 | ('dmode_rngcorr', '<u4'), | |
54 | ('nrxs', '<u4'), |
|
54 | ('nrxs', '<u4'), | |
55 | ('acf_length', '<u4'), |
|
55 | ('acf_length', '<u4'), | |
56 | ('acf_lags', '<u4'), |
|
56 | ('acf_lags', '<u4'), | |
57 | ('sea_to_atmos', '<f4'), |
|
57 | ('sea_to_atmos', '<f4'), | |
58 | ('sea_notch', '<u4'), |
|
58 | ('sea_notch', '<u4'), | |
59 | ('lh_sea', '<u4'), |
|
59 | ('lh_sea', '<u4'), | |
60 | ('hh_sea', '<u4'), |
|
60 | ('hh_sea', '<u4'), | |
61 | ('nbins_sea', '<u4'), |
|
61 | ('nbins_sea', '<u4'), | |
62 | ('min_snr', '<f4'), |
|
62 | ('min_snr', '<f4'), | |
63 | ('min_cc', '<f4'), |
|
63 | ('min_cc', '<f4'), | |
64 | ('max_time_diff', '<f4') |
|
64 | ('max_time_diff', '<f4') | |
65 | ]) |
|
65 | ]) | |
66 |
|
66 | |||
67 | DATA_STRUCTURE = numpy.dtype([ |
|
67 | DATA_STRUCTURE = numpy.dtype([ | |
68 | ('range', '<u4'), |
|
68 | ('range', '<u4'), | |
69 | ('status', '<u4'), |
|
69 | ('status', '<u4'), | |
70 | ('zonal', '<f4'), |
|
70 | ('zonal', '<f4'), | |
71 | ('meridional', '<f4'), |
|
71 | ('meridional', '<f4'), | |
72 | ('vertical', '<f4'), |
|
72 | ('vertical', '<f4'), | |
73 | ('zonal_a', '<f4'), |
|
73 | ('zonal_a', '<f4'), | |
74 | ('meridional_a', '<f4'), |
|
74 | ('meridional_a', '<f4'), | |
75 | ('corrected_fading', '<f4'), # seconds |
|
75 | ('corrected_fading', '<f4'), # seconds | |
76 | ('uncorrected_fading', '<f4'), # seconds |
|
76 | ('uncorrected_fading', '<f4'), # seconds | |
77 | ('time_diff', '<f4'), |
|
77 | ('time_diff', '<f4'), | |
78 | ('major_axis', '<f4'), |
|
78 | ('major_axis', '<f4'), | |
79 | ('axial_ratio', '<f4'), |
|
79 | ('axial_ratio', '<f4'), | |
80 | ('orientation', '<f4'), |
|
80 | ('orientation', '<f4'), | |
81 | ('sea_power', '<u4'), |
|
81 | ('sea_power', '<u4'), | |
82 | ('sea_algorithm', '<u4') |
|
82 | ('sea_algorithm', '<u4') | |
83 | ]) |
|
83 | ]) | |
84 |
|
84 | |||
85 | class BLTRParamReader(JRODataReader, ProcessingUnit): |
|
85 | class BLTRParamReader(JRODataReader, ProcessingUnit): | |
86 | ''' |
|
86 | ''' | |
87 | Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files |
|
87 | Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files | |
88 | ''' |
|
88 | ''' | |
89 |
|
89 | |||
90 | ext = '.sswma' |
|
90 | ext = '.sswma' | |
91 |
|
91 | |||
92 | def __init__(self, **kwargs): |
|
92 | def __init__(self, **kwargs): | |
93 |
|
93 | |||
94 | ProcessingUnit.__init__(self , **kwargs) |
|
94 | ProcessingUnit.__init__(self , **kwargs) | |
95 |
|
95 | |||
96 | self.dataOut = Parameters() |
|
96 | self.dataOut = Parameters() | |
97 | self.counter_records = 0 |
|
97 | self.counter_records = 0 | |
98 | self.flagNoMoreFiles = 0 |
|
98 | self.flagNoMoreFiles = 0 | |
99 | self.isConfig = False |
|
99 | self.isConfig = False | |
100 | self.filename = None |
|
100 | self.filename = None | |
101 |
|
101 | |||
102 | def setup(self, |
|
102 | def setup(self, | |
103 | path=None, |
|
103 | path=None, | |
104 | startDate=None, |
|
104 | startDate=None, | |
105 | endDate=None, |
|
105 | endDate=None, | |
106 | ext=None, |
|
106 | ext=None, | |
107 | startTime=datetime.time(0, 0, 0), |
|
107 | startTime=datetime.time(0, 0, 0), | |
108 | endTime=datetime.time(23, 59, 59), |
|
108 | endTime=datetime.time(23, 59, 59), | |
109 | timezone=0, |
|
109 | timezone=0, | |
110 | status_value=0, |
|
110 | status_value=0, | |
111 | **kwargs): |
|
111 | **kwargs): | |
112 |
|
112 | |||
113 | self.path = path |
|
113 | self.path = path | |
114 | self.startTime = startTime |
|
114 | self.startTime = startTime | |
115 | self.endTime = endTime |
|
115 | self.endTime = endTime | |
116 | self.status_value = status_value |
|
116 | self.status_value = status_value | |
117 |
|
117 | |||
118 | if self.path is None: |
|
118 | if self.path is None: | |
119 | raise ValueError, "The path is not valid" |
|
119 | raise ValueError, "The path is not valid" | |
120 |
|
120 | |||
121 | if ext is None: |
|
121 | if ext is None: | |
122 | ext = self.ext |
|
122 | ext = self.ext | |
123 |
|
123 | |||
124 | self.search_files(self.path, startDate, endDate, ext) |
|
124 | self.search_files(self.path, startDate, endDate, ext) | |
125 | self.timezone = timezone |
|
125 | self.timezone = timezone | |
126 | self.fileIndex = 0 |
|
126 | self.fileIndex = 0 | |
127 |
|
127 | |||
128 | if not self.fileList: |
|
128 | if not self.fileList: | |
129 | raise Warning, "There is no files matching these date in the folder: %s. \n Check 'startDate' and 'endDate' "%(path) |
|
129 | raise Warning, "There is no files matching these date in the folder: %s. \n Check 'startDate' and 'endDate' "%(path) | |
130 |
|
130 | |||
131 | self.setNextFile() |
|
131 | self.setNextFile() | |
132 |
|
132 | |||
133 | def search_files(self, path, startDate, endDate, ext): |
|
133 | def search_files(self, path, startDate, endDate, ext): | |
134 | ''' |
|
134 | ''' | |
135 | Searching for BLTR rawdata file in path |
|
135 | Searching for BLTR rawdata file in path | |
136 | Creating a list of file to proces included in [startDate,endDate] |
|
136 | Creating a list of file to proces included in [startDate,endDate] | |
137 |
|
137 | |||
138 | Input: |
|
138 | Input: | |
139 | path - Path to find BLTR rawdata files |
|
139 | path - Path to find BLTR rawdata files | |
140 | startDate - Select file from this date |
|
140 | startDate - Select file from this date | |
141 | enDate - Select file until this date |
|
141 | enDate - Select file until this date | |
142 | ext - Extension of the file to read |
|
142 | ext - Extension of the file to read | |
143 |
|
143 | |||
144 | ''' |
|
144 | ''' | |
145 |
|
145 | |||
146 | print 'Searching file in %s ' % (path) |
|
146 | print 'Searching file in %s ' % (path) | |
147 | foldercounter = 0 |
|
147 | foldercounter = 0 | |
148 | fileList0 = glob.glob1(path, "*%s" % ext) |
|
148 | fileList0 = glob.glob1(path, "*%s" % ext) | |
149 | fileList0.sort() |
|
149 | fileList0.sort() | |
150 |
|
150 | |||
151 | self.fileList = [] |
|
151 | self.fileList = [] | |
152 | self.dateFileList = [] |
|
152 | self.dateFileList = [] | |
153 |
|
153 | |||
154 | for thisFile in fileList0: |
|
154 | for thisFile in fileList0: | |
155 | year = thisFile[-14:-10] |
|
155 | year = thisFile[-14:-10] | |
156 | if not isNumber(year): |
|
156 | if not isNumber(year): | |
157 | continue |
|
157 | continue | |
158 |
|
158 | |||
159 | month = thisFile[-10:-8] |
|
159 | month = thisFile[-10:-8] | |
160 | if not isNumber(month): |
|
160 | if not isNumber(month): | |
161 | continue |
|
161 | continue | |
162 |
|
162 | |||
163 | day = thisFile[-8:-6] |
|
163 | day = thisFile[-8:-6] | |
164 | if not isNumber(day): |
|
164 | if not isNumber(day): | |
165 | continue |
|
165 | continue | |
166 |
|
166 | |||
167 | year, month, day = int(year), int(month), int(day) |
|
167 | year, month, day = int(year), int(month), int(day) | |
168 | dateFile = datetime.date(year, month, day) |
|
168 | dateFile = datetime.date(year, month, day) | |
169 |
|
169 | |||
170 | if (startDate > dateFile) or (endDate < dateFile): |
|
170 | if (startDate > dateFile) or (endDate < dateFile): | |
171 | continue |
|
171 | continue | |
172 |
|
172 | |||
173 | self.fileList.append(thisFile) |
|
173 | self.fileList.append(thisFile) | |
174 | self.dateFileList.append(dateFile) |
|
174 | self.dateFileList.append(dateFile) | |
175 |
|
175 | |||
176 | return |
|
176 | return | |
177 |
|
177 | |||
178 | def setNextFile(self): |
|
178 | def setNextFile(self): | |
179 |
|
179 | |||
180 | file_id = self.fileIndex |
|
180 | file_id = self.fileIndex | |
181 |
|
181 | |||
182 | if file_id == len(self.fileList): |
|
182 | if file_id == len(self.fileList): | |
183 | print '\nNo more files in the folder' |
|
183 | print '\nNo more files in the folder' | |
184 | print 'Total number of file(s) read : {}'.format(self.fileIndex + 1) |
|
184 | print 'Total number of file(s) read : {}'.format(self.fileIndex + 1) | |
185 | self.flagNoMoreFiles = 1 |
|
185 | self.flagNoMoreFiles = 1 | |
186 | return 0 |
|
186 | return 0 | |
187 |
|
187 | |||
188 | print '\n[Setting file] (%s) ...' % self.fileList[file_id] |
|
188 | print '\n[Setting file] (%s) ...' % self.fileList[file_id] | |
189 | filename = os.path.join(self.path, self.fileList[file_id]) |
|
189 | filename = os.path.join(self.path, self.fileList[file_id]) | |
190 |
|
190 | |||
191 | dirname, name = os.path.split(filename) |
|
191 | dirname, name = os.path.split(filename) | |
192 | self.siteFile = name.split('.')[0] # 'peru2' ---> Piura - 'peru1' ---> Huancayo or Porcuya |
|
192 | self.siteFile = name.split('.')[0] # 'peru2' ---> Piura - 'peru1' ---> Huancayo or Porcuya | |
193 | if self.filename is not None: |
|
193 | if self.filename is not None: | |
194 | self.fp.close() |
|
194 | self.fp.close() | |
195 | self.filename = filename |
|
195 | self.filename = filename | |
196 | self.fp = open(self.filename, 'rb') |
|
196 | self.fp = open(self.filename, 'rb') | |
197 | self.header_file = numpy.fromfile(self.fp, FILE_HEADER_STRUCTURE, 1) |
|
197 | self.header_file = numpy.fromfile(self.fp, FILE_HEADER_STRUCTURE, 1) | |
198 | self.nrecords = self.header_file['nrec'][0] |
|
198 | self.nrecords = self.header_file['nrec'][0] | |
199 | self.sizeOfFile = os.path.getsize(self.filename) |
|
199 | self.sizeOfFile = os.path.getsize(self.filename) | |
200 | self.counter_records = 0 |
|
200 | self.counter_records = 0 | |
201 | self.flagIsNewFile = 0 |
|
201 | self.flagIsNewFile = 0 | |
202 | self.fileIndex += 1 |
|
202 | self.fileIndex += 1 | |
203 |
|
203 | |||
204 | return 1 |
|
204 | return 1 | |
205 |
|
205 | |||
206 | def readNextBlock(self): |
|
206 | def readNextBlock(self): | |
207 |
|
207 | |||
208 | while True: |
|
208 | while True: | |
209 | if self.counter_records == self.nrecords: |
|
209 | if self.counter_records == self.nrecords: | |
210 | self.flagIsNewFile = 1 |
|
210 | self.flagIsNewFile = 1 | |
211 | if not self.setNextFile(): |
|
211 | if not self.setNextFile(): | |
212 | return 0 |
|
212 | return 0 | |
213 |
|
213 | |||
214 | self.readBlock() |
|
214 | self.readBlock() | |
215 |
|
215 | |||
216 | if (self.datatime.time() < self.startTime) or (self.datatime.time() > self.endTime): |
|
216 | if (self.datatime.time() < self.startTime) or (self.datatime.time() > self.endTime): | |
217 | print "[Reading] Record No. %d/%d -> %s [Skipping]" %( |
|
217 | print "[Reading] Record No. %d/%d -> %s [Skipping]" %( | |
218 | self.counter_records, |
|
218 | self.counter_records, | |
219 | self.nrecords, |
|
219 | self.nrecords, | |
220 | self.datatime.ctime()) |
|
220 | self.datatime.ctime()) | |
221 | continue |
|
221 | continue | |
222 | break |
|
222 | break | |
223 |
|
223 | |||
224 | print "[Reading] Record No. %d/%d -> %s" %( |
|
224 | print "[Reading] Record No. %d/%d -> %s" %( | |
225 | self.counter_records, |
|
225 | self.counter_records, | |
226 | self.nrecords, |
|
226 | self.nrecords, | |
227 | self.datatime.ctime()) |
|
227 | self.datatime.ctime()) | |
228 |
|
228 | |||
229 | return 1 |
|
229 | return 1 | |
230 |
|
230 | |||
231 | def readBlock(self): |
|
231 | def readBlock(self): | |
232 |
|
232 | |||
233 | pointer = self.fp.tell() |
|
233 | pointer = self.fp.tell() | |
234 | header_rec = numpy.fromfile(self.fp, REC_HEADER_STRUCTURE, 1) |
|
234 | header_rec = numpy.fromfile(self.fp, REC_HEADER_STRUCTURE, 1) | |
235 | self.nchannels = header_rec['nchan'][0]/2 |
|
235 | self.nchannels = header_rec['nchan'][0]/2 | |
236 | self.kchan = header_rec['nrxs'][0] |
|
236 | self.kchan = header_rec['nrxs'][0] | |
237 | self.nmodes = header_rec['nmodes'][0] |
|
237 | self.nmodes = header_rec['nmodes'][0] | |
238 | self.nranges = header_rec['nranges'][0] |
|
238 | self.nranges = header_rec['nranges'][0] | |
239 | self.fp.seek(pointer) |
|
239 | self.fp.seek(pointer) | |
240 | self.height = numpy.empty((self.nmodes, self.nranges)) |
|
240 | self.height = numpy.empty((self.nmodes, self.nranges)) | |
241 | self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges)) |
|
241 | self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges)) | |
242 | self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) |
|
242 | self.buffer = numpy.empty((self.nmodes, 3, self.nranges)) | |
243 |
|
243 | |||
244 | for mode in range(self.nmodes): |
|
244 | for mode in range(self.nmodes): | |
245 | self.readHeader() |
|
245 | self.readHeader() | |
246 | data = self.readData() |
|
246 | data = self.readData() | |
247 | self.height[mode] = (data[0] - self.correction) / 1000. |
|
247 | self.height[mode] = (data[0] - self.correction) / 1000. | |
248 | self.buffer[mode] = data[1] |
|
248 | self.buffer[mode] = data[1] | |
249 | self.snr[mode] = data[2] |
|
249 | self.snr[mode] = data[2] | |
250 |
|
250 | |||
251 | self.counter_records = self.counter_records + self.nmodes |
|
251 | self.counter_records = self.counter_records + self.nmodes | |
252 |
|
252 | |||
253 | return |
|
253 | return | |
254 |
|
254 | |||
255 | def readHeader(self): |
|
255 | def readHeader(self): | |
256 | ''' |
|
256 | ''' | |
257 | RecordHeader of BLTR rawdata file |
|
257 | RecordHeader of BLTR rawdata file | |
258 | ''' |
|
258 | ''' | |
259 |
|
259 | |||
260 | header_structure = numpy.dtype( |
|
260 | header_structure = numpy.dtype( | |
261 | REC_HEADER_STRUCTURE.descr + [ |
|
261 | REC_HEADER_STRUCTURE.descr + [ | |
262 | ('antenna_coord', 'f4', (2, self.nchannels)), |
|
262 | ('antenna_coord', 'f4', (2, self.nchannels)), | |
263 | ('rx_gains', 'u4', (self.nchannels,)), |
|
263 | ('rx_gains', 'u4', (self.nchannels,)), | |
264 | ('rx_analysis', 'u4', (self.nchannels,)) |
|
264 | ('rx_analysis', 'u4', (self.nchannels,)) | |
265 | ] |
|
265 | ] | |
266 | ) |
|
266 | ) | |
267 |
|
267 | |||
268 | self.header_rec = numpy.fromfile(self.fp, header_structure, 1) |
|
268 | self.header_rec = numpy.fromfile(self.fp, header_structure, 1) | |
269 | self.lat = self.header_rec['lat'][0] |
|
269 | self.lat = self.header_rec['lat'][0] | |
270 | self.lon = self.header_rec['lon'][0] |
|
270 | self.lon = self.header_rec['lon'][0] | |
271 | self.delta = self.header_rec['delta_r'][0] |
|
271 | self.delta = self.header_rec['delta_r'][0] | |
272 | self.correction = self.header_rec['dmode_rngcorr'][0] |
|
272 | self.correction = self.header_rec['dmode_rngcorr'][0] | |
273 | self.imode = self.header_rec['dmode_index'][0] |
|
273 | self.imode = self.header_rec['dmode_index'][0] | |
274 | self.antenna = self.header_rec['antenna_coord'] |
|
274 | self.antenna = self.header_rec['antenna_coord'] | |
275 | self.rx_gains = self.header_rec['rx_gains'] |
|
275 | self.rx_gains = self.header_rec['rx_gains'] | |
276 | self.time = self.header_rec['time'][0] |
|
276 | self.time = self.header_rec['time'][0] | |
277 | tseconds = self.header_rec['time'][0] |
|
277 | tseconds = self.header_rec['time'][0] | |
278 | local_t1 = time.localtime(tseconds) |
|
278 | local_t1 = time.localtime(tseconds) | |
279 | self.year = local_t1.tm_year |
|
279 | self.year = local_t1.tm_year | |
280 | self.month = local_t1.tm_mon |
|
280 | self.month = local_t1.tm_mon | |
281 | self.day = local_t1.tm_mday |
|
281 | self.day = local_t1.tm_mday | |
282 | self.t = datetime.datetime(self.year, self.month, self.day) |
|
282 | self.t = datetime.datetime(self.year, self.month, self.day) | |
283 | self.datatime = datetime.datetime.utcfromtimestamp(self.time) |
|
283 | self.datatime = datetime.datetime.utcfromtimestamp(self.time) | |
284 |
|
284 | |||
285 | def readData(self): |
|
285 | def readData(self): | |
286 | ''' |
|
286 | ''' | |
287 | Reading and filtering data block record of BLTR rawdata file, filtering is according to status_value. |
|
287 | Reading and filtering data block record of BLTR rawdata file, filtering is according to status_value. | |
288 |
|
288 | |||
289 | Input: |
|
289 | Input: | |
290 | status_value - Array data is set to NAN for values that are not equal to status_value |
|
290 | status_value - Array data is set to NAN for values that are not equal to status_value | |
291 |
|
291 | |||
292 | ''' |
|
292 | ''' | |
293 |
|
293 | |||
294 | data_structure = numpy.dtype( |
|
294 | data_structure = numpy.dtype( | |
295 | DATA_STRUCTURE.descr + [ |
|
295 | DATA_STRUCTURE.descr + [ | |
296 | ('rx_saturation', 'u4', (self.nchannels,)), |
|
296 | ('rx_saturation', 'u4', (self.nchannels,)), | |
297 | ('chan_offset', 'u4', (2 * self.nchannels,)), |
|
297 | ('chan_offset', 'u4', (2 * self.nchannels,)), | |
298 | ('rx_amp', 'u4', (self.nchannels,)), |
|
298 | ('rx_amp', 'u4', (self.nchannels,)), | |
299 | ('rx_snr', 'f4', (self.nchannels,)), |
|
299 | ('rx_snr', 'f4', (self.nchannels,)), | |
300 | ('cross_snr', 'f4', (self.kchan,)), |
|
300 | ('cross_snr', 'f4', (self.kchan,)), | |
301 | ('sea_power_relative', 'f4', (self.kchan,))] |
|
301 | ('sea_power_relative', 'f4', (self.kchan,))] | |
302 | ) |
|
302 | ) | |
303 |
|
303 | |||
304 | data = numpy.fromfile(self.fp, data_structure, self.nranges) |
|
304 | data = numpy.fromfile(self.fp, data_structure, self.nranges) | |
305 |
|
305 | |||
306 | height = data['range'] |
|
306 | height = data['range'] | |
307 | winds = numpy.array((data['zonal'], data['meridional'], data['vertical'])) |
|
307 | winds = numpy.array((data['zonal'], data['meridional'], data['vertical'])) | |
308 | snr = data['rx_snr'].T |
|
308 | snr = data['rx_snr'].T | |
309 |
|
309 | |||
310 | winds[numpy.where(winds == -9999.)] = numpy.nan |
|
310 | winds[numpy.where(winds == -9999.)] = numpy.nan | |
311 | winds[:, numpy.where(data['status'] != self.status_value)] = numpy.nan |
|
311 | winds[:, numpy.where(data['status'] != self.status_value)] = numpy.nan | |
312 | snr[numpy.where(snr == -9999.)] = numpy.nan |
|
312 | snr[numpy.where(snr == -9999.)] = numpy.nan | |
313 | snr[:, numpy.where(data['status'] != self.status_value)] = numpy.nan |
|
313 | snr[:, numpy.where(data['status'] != self.status_value)] = numpy.nan | |
314 | snr = numpy.power(10, snr / 10) |
|
314 | snr = numpy.power(10, snr / 10) | |
315 |
|
315 | |||
316 | return height, winds, snr |
|
316 | return height, winds, snr | |
317 |
|
317 | |||
318 | def set_output(self): |
|
318 | def set_output(self): | |
319 | ''' |
|
319 | ''' | |
320 | Storing data from databuffer to dataOut object |
|
320 | Storing data from databuffer to dataOut object | |
321 | ''' |
|
321 | ''' | |
322 |
|
322 | |||
323 | self.dataOut.data_SNR = self.snr |
|
323 | self.dataOut.data_SNR = self.snr | |
324 | self.dataOut.height = self.height |
|
324 | self.dataOut.height = self.height | |
325 | self.dataOut.data_output = self.buffer |
|
325 | self.dataOut.data_output = self.buffer | |
326 | self.dataOut.utctimeInit = self.time |
|
326 | self.dataOut.utctimeInit = self.time | |
327 | self.dataOut.utctime = self.dataOut.utctimeInit |
|
327 | self.dataOut.utctime = self.dataOut.utctimeInit | |
328 | self.dataOut.counter_records = self.counter_records |
|
|||
329 | self.dataOut.nrecords = self.nrecords |
|
|||
330 | self.dataOut.useLocalTime = False |
|
328 | self.dataOut.useLocalTime = False | |
331 | self.dataOut.paramInterval = 157 |
|
329 | self.dataOut.paramInterval = 157 | |
332 | self.dataOut.timezone = self.timezone |
|
330 | self.dataOut.timezone = self.timezone | |
333 | self.dataOut.site = self.siteFile |
|
331 | self.dataOut.site = self.siteFile | |
334 | self.dataOut.nrecords = self.nrecords |
|
332 | self.dataOut.nrecords = self.nrecords/self.nmodes | |
335 | self.dataOut.sizeOfFile = self.sizeOfFile |
|
333 | self.dataOut.sizeOfFile = self.sizeOfFile | |
336 | self.dataOut.lat = self.lat |
|
334 | self.dataOut.lat = self.lat | |
337 | self.dataOut.lon = self.lon |
|
335 | self.dataOut.lon = self.lon | |
338 | self.dataOut.channelList = range(self.nchannels) |
|
336 | self.dataOut.channelList = range(self.nchannels) | |
339 | self.dataOut.kchan = self.kchan |
|
337 | self.dataOut.kchan = self.kchan | |
340 | # self.dataOut.nHeights = self.nranges |
|
338 | # self.dataOut.nHeights = self.nranges | |
341 | self.dataOut.delta = self.delta |
|
339 | self.dataOut.delta = self.delta | |
342 | self.dataOut.correction = self.correction |
|
340 | self.dataOut.correction = self.correction | |
343 | self.dataOut.nmodes = self.nmodes |
|
341 | self.dataOut.nmodes = self.nmodes | |
344 | self.dataOut.imode = self.imode |
|
342 | self.dataOut.imode = self.imode | |
345 | self.dataOut.antenna = self.antenna |
|
343 | self.dataOut.antenna = self.antenna | |
346 | self.dataOut.rx_gains = self.rx_gains |
|
344 | self.dataOut.rx_gains = self.rx_gains | |
347 | self.dataOut.flagNoData = False |
|
345 | self.dataOut.flagNoData = False | |
348 |
|
346 | |||
349 | def getData(self): |
|
347 | def getData(self): | |
350 | ''' |
|
348 | ''' | |
351 | Storing data from databuffer to dataOut object |
|
349 | Storing data from databuffer to dataOut object | |
352 | ''' |
|
350 | ''' | |
353 | if self.flagNoMoreFiles: |
|
351 | if self.flagNoMoreFiles: | |
354 | self.dataOut.flagNoData = True |
|
352 | self.dataOut.flagNoData = True | |
355 | print 'No file left to process' |
|
353 | print 'No file left to process' | |
356 | return 0 |
|
354 | return 0 | |
357 |
|
355 | |||
358 | if not self.readNextBlock(): |
|
356 | if not self.readNextBlock(): | |
359 | self.dataOut.flagNoData = True |
|
357 | self.dataOut.flagNoData = True | |
360 | return 0 |
|
358 | return 0 | |
361 |
|
359 | |||
362 | self.set_output() |
|
360 | self.set_output() | |
363 |
|
361 | |||
364 | return 1 |
|
362 | return 1 |
@@ -1,375 +1,243 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Aug 1, 2017 |
|
2 | Created on Aug 1, 2017 | |
3 |
|
3 | |||
4 | @author: Juan C. Espinoza |
|
4 | @author: Juan C. Espinoza | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import os |
|
7 | import os | |
8 | import sys |
|
8 | import sys | |
9 | import time |
|
9 | import time | |
|
10 | import json | |||
10 | import datetime |
|
11 | import datetime | |
11 |
|
12 | |||
12 | import numpy |
|
13 | import numpy | |
13 |
|
14 | |||
14 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
|||
15 | from schainpy.model.data.jrodata import Parameters |
|
|||
16 | from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader |
|
|||
17 | from schainpy.model.graphics.jroplot_parameters import WindProfilerPlot |
|
|||
18 | from schainpy.model.io.jroIO_base import * |
|
|||
19 |
|
||||
20 | try: |
|
15 | try: | |
21 | import madrigal |
|
16 | import madrigal | |
22 | import madrigal.cedar |
|
17 | import madrigal.cedar | |
23 | from madrigal.cedar import MadrigalCatalogRecord |
|
|||
24 | except: |
|
18 | except: | |
25 | print 'You should install "madrigal library" module if you want to read/write Madrigal data' |
|
19 | print 'You should install "madrigal library" module if you want to read/write Madrigal data' | |
26 |
|
20 | |||
|
21 | from schainpy.model.proc.jroproc_base import Operation | |||
|
22 | from schainpy.model.data.jrodata import Parameters | |||
|
23 | ||||
|
24 | MISSING = -32767 | |||
|
25 | DEF_CATALOG = { | |||
|
26 | 'principleInvestigator': 'Marco Milla', | |||
|
27 | 'expPurpose': None, | |||
|
28 | 'expMode': None, | |||
|
29 | 'cycleTime': None, | |||
|
30 | 'correlativeExp': None, | |||
|
31 | 'sciRemarks': None, | |||
|
32 | 'instRemarks': None | |||
|
33 | } | |||
|
34 | DEF_HEADER = { | |||
|
35 | 'kindatDesc': None, | |||
|
36 | 'analyst': 'Jicamarca User', | |||
|
37 | 'comments': None, | |||
|
38 | 'history': None | |||
|
39 | } | |||
|
40 | MNEMONICS = { | |||
|
41 | 10: 'jro', | |||
|
42 | 11: 'jbr', | |||
|
43 | 840: 'jul', | |||
|
44 | 13: 'jas', | |||
|
45 | 1000: 'pbr', | |||
|
46 | 1001: 'hbr', | |||
|
47 | 1002: 'obr', | |||
|
48 | } | |||
|
49 | ||||
|
50 | def load_json(obj): | |||
|
51 | ''' | |||
|
52 | Parse json as string instead of unicode | |||
|
53 | ''' | |||
|
54 | ||||
|
55 | if isinstance(obj, str): | |||
|
56 | obj = json.loads(obj) | |||
|
57 | ||||
|
58 | return {str(k): load_json(v) if isinstance(v, dict) else str(v) if isinstance(v, unicode) else v | |||
|
59 | for k, v in obj.items()} | |||
|
60 | ||||
27 |
|
61 | |||
28 | class MADWriter(Operation): |
|
62 | class MAD2Writer(Operation): | |
29 |
|
63 | |||
30 | def __init__(self): |
|
64 | def __init__(self, **kwargs): | |
31 |
|
65 | |||
32 | Operation.__init__(self) |
|
66 | Operation.__init__(self, **kwargs) | |
33 | self.dataOut = Parameters() |
|
67 | self.dataOut = Parameters() | |
34 | self.path = None |
|
68 | self.path = None | |
35 | self.dataOut = None |
|
69 | self.dataOut = None | |
36 | self.flagIsNewFile=1 |
|
70 | self.ext = '.dat' | |
37 | self.ext = ".hdf5" |
|
|||
38 |
|
71 | |||
39 | return |
|
72 | return | |
40 |
|
73 | |||
41 |
def run(self, dataOut, path |
|
74 | def run(self, dataOut, path, oneDList, twoDParam='', twoDList='{}', metadata='{}', **kwargs): | |
42 |
|
75 | ''' | ||
43 | if self.flagIsNewFile: |
|
76 | Inputs: | |
44 | flagdata = self.setup(dataOut, path, modetowrite) |
|
77 | path - path where files will be created | |
|
78 | oneDList - json of one-dimensional parameters in record where keys | |||
|
79 | are Madrigal codes (integers or mnemonics) and values the corresponding | |||
|
80 | dataOut attribute e.g: { | |||
|
81 | 'gdlatr': 'lat', | |||
|
82 | 'gdlonr': 'lon', | |||
|
83 | 'gdlat2':'lat', | |||
|
84 | 'glon2':'lon'} | |||
|
85 | twoDParam - independent parameter to get the number of rows e.g: | |||
|
86 | heighList | |||
|
87 | twoDList - json of two-dimensional parameters in record where keys | |||
|
88 | are Madrigal codes (integers or mnemonics) and values the corresponding | |||
|
89 | dataOut attribute if multidimensional array specify as tupple | |||
|
90 | ('attr', pos) e.g: { | |||
|
91 | 'gdalt': 'heightList', | |||
|
92 | 'vn1p2': ('data_output', 0), | |||
|
93 | 'vn2p2': ('data_output', 1), | |||
|
94 | 'vn3': ('data_output', 2), | |||
|
95 | 'snl': ('data_SNR', 'db') | |||
|
96 | } | |||
|
97 | metadata - json of madrigal metadata (kinst, kindat, catalog and header) | |||
|
98 | ''' | |||
|
99 | if not self.isConfig: | |||
|
100 | self.setup(dataOut, path, oneDList, twoDParam, twoDList, metadata, **kwargs) | |||
|
101 | self.isConfig = True | |||
45 |
|
102 | |||
46 | self.putData() |
|
103 | self.putData() | |
47 | return |
|
104 | return | |
48 |
|
105 | |||
49 |
def setup(self, dataOut, path, |
|
106 | def setup(self, dataOut, path, oneDList, twoDParam, twoDList, metadata, **kwargs): | |
50 | ''' |
|
107 | ''' | |
51 | Recovering data to write in new *.hdf5 file |
|
108 | Configure Operation | |
52 | Inputs: |
|
|||
53 | modew -- mode to write (1 or 2) |
|
|||
54 | path -- destination path |
|
|||
55 |
|
||||
56 | ''' |
|
109 | ''' | |
57 |
|
110 | |||
58 | self.im = modetowrite-1 |
|
|||
59 | if self.im!=0 and self.im!=1: |
|
|||
60 | raise ValueError, 'Check "modetowrite" value. Must be egual to 1 or 2, "{}" is not valid. '.format(modetowrite) |
|
|||
61 |
|
||||
62 | self.dataOut = dataOut |
|
111 | self.dataOut = dataOut | |
63 |
self.nmodes = self.dataOut.nmodes |
|
112 | self.nmodes = self.dataOut.nmodes | |
64 | self.nchannels = self.dataOut.nchannels |
|
|||
65 | self.lat = self.dataOut.lat |
|
|||
66 | self.lon = self.dataOut.lon |
|
|||
67 | self.hcm = 3 |
|
|||
68 | self.thisDate = self.dataOut.utctimeInit |
|
|||
69 | self.year = self.dataOut.year |
|
|||
70 | self.month = self.dataOut.month |
|
|||
71 | self.day = self.dataOut.day |
|
|||
72 | self.path = path |
|
113 | self.path = path | |
73 |
|
114 | self.blocks = kwargs.get('blocks', None) | ||
74 | self.flagIsNewFile = 0 |
|
115 | self.counter = 0 | |
75 |
|
116 | self.oneDList = load_json(oneDList) | ||
76 | return 1 |
|
117 | self.twoDList = load_json(twoDList) | |
77 |
|
118 | self.twoDParam = twoDParam | ||
|
119 | meta = load_json(metadata) | |||
|
120 | self.kinst = meta.get('kinst') | |||
|
121 | self.kindat = meta.get('kindat') | |||
|
122 | self.catalog = meta.get('catalog', DEF_CATALOG) | |||
|
123 | self.header = meta.get('header', DEF_HEADER) | |||
|
124 | ||||
|
125 | return | |||
|
126 | ||||
78 | def setFile(self): |
|
127 | def setFile(self): | |
79 | ''' |
|
128 | ''' | |
80 | - Determining the file name for each mode of operation |
|
129 | Create new cedar file object | |
81 | kinst - Kind of Instrument (mnemotic) |
|
130 | ''' | |
82 | kindat - Kind of Data (mnemotic) |
|
131 | ||
83 |
|
132 | self.mnemonic = MNEMONICS[self.kinst] #TODO get mnemonic from madrigal | ||
84 | - Creating a cedarObject |
|
133 | date = datetime.datetime.utcfromtimestamp(self.dataOut.utctime) | |
85 |
|
134 | |||
86 | ''' |
|
135 | filename = '%s%s_%s%s' % (self.mnemonic, | |
87 | lat_piura = -5.17 |
|
136 | date.strftime('%Y%m%d_%H%M%S'), | |
88 | lat_huancayo = -12.04 |
|
137 | self.dataOut.mode, | |
89 | lat_porcuya = -5.8 |
|
138 | self.ext) | |
90 |
|
||||
91 | if '%2.2f' % self.lat == '%2.2f' % lat_piura: |
|
|||
92 | self.instMnemonic = 'pbr' |
|
|||
93 |
|
||||
94 | elif '%2.2f' % self.lat == '%2.2f' % lat_huancayo: |
|
|||
95 | self.instMnemonic = 'hbr' |
|
|||
96 |
|
||||
97 | elif '%2.2f' % self.lat == '%2.2f' % lat_porcuya: |
|
|||
98 | self.instMnemonic = 'obr' |
|
|||
99 | else: raise Warning, "The site of file read doesn't match any site known. Only file from Huancayo, Piura and Porcuya can be processed.\n Check the file " |
|
|||
100 |
|
||||
101 | mode = ['_mode1','_mode2'] |
|
|||
102 |
|
||||
103 | self.hdf5filename = '%s%4.4d%2.2d%2.2d%s%s' % (self.instMnemonic, |
|
|||
104 | self.year, |
|
|||
105 | self.month, |
|
|||
106 | self.day, |
|
|||
107 | mode[self.im], |
|
|||
108 | self.ext) |
|
|||
109 |
|
139 | |||
110 |
self.fullname=os.path.join(self.path, |
|
140 | self.fullname = os.path.join(self.path, filename) | |
111 |
|
141 | |||
112 | if os.path.isfile(self.fullname) : |
|
142 | if os.path.isfile(self.fullname) : | |
113 | print "Destination path '%s' already exists. Previous file deleted. " %self.fullname |
|
143 | print "Destination path '%s' already exists. Previous file deleted. " %self.fullname | |
114 | os.remove(self.fullname) |
|
144 | os.remove(self.fullname) | |
115 |
|
||||
116 | # Identify kinst and kindat |
|
|||
117 | InstName = self.hdf5filename[0:3] |
|
|||
118 | KinstList = [1000, 1001, 1002] |
|
|||
119 | KinstId = {'pbr':0, 'hbr':1, 'obr':2} # pbr:piura, hbr:huancayo, obr:porcuya |
|
|||
120 | KindatList = [1600, 1601] # mode 1, mode 2 |
|
|||
121 | self.type = KinstId[InstName] |
|
|||
122 | self.kinst = KinstList[self.type] |
|
|||
123 | self.kindat = KindatList[self.im] |
|
|||
124 |
|
145 | |||
125 | try: |
|
146 | try: | |
|
147 | print '[Writing] creating file : %s' % (self.fullname) | |||
126 | self.cedarObj = madrigal.cedar.MadrigalCedarFile(self.fullname, True) |
|
148 | self.cedarObj = madrigal.cedar.MadrigalCedarFile(self.fullname, True) | |
127 |
except ValueError, |
|
149 | except ValueError, e: | |
128 | print '[Error]: Impossible to create a cedar object with "madrigal.cedar.MadrigalCedarFile" ' |
|
150 | print '[Error]: Impossible to create a cedar object with "madrigal.cedar.MadrigalCedarFile" ' | |
129 | return |
|
151 | return | |
130 |
|
152 | |||
131 | return 1 |
|
153 | return 1 | |
132 |
|
154 | |||
133 | def writeBlock(self): |
|
155 | def writeBlock(self): | |
134 | ''' |
|
156 | ''' | |
135 | - Selecting mode of operation: |
|
157 | Add data records to cedar file taking data from oneDList and twoDList | |
136 |
|
158 | attributes. | ||
137 | bltr high resolution mode 1 - Low Atmosphere (0 - 3km) // bltr high resolution mode 2 - High Atmosphere (0 - 10km) |
|
159 | Allowed parameters in: parcodes.tab | |
138 | msnr - Average Signal Noise Ratio in dB |
|
|||
139 | hcm - 3 km |
|
|||
140 |
|
||||
141 | - Filling the cedarObject by a block: each array data entry is assigned a code that defines the parameter to write to the file |
|
|||
142 |
|
||||
143 | GDLATR - Reference geod latitude (deg) |
|
|||
144 | GDLONR - Reference geographic longitude (deg) |
|
|||
145 | GDLAT2 - Geodetic latitude of second inst (deg) |
|
|||
146 | GLON2 - Geographic longitude of second inst (deg) |
|
|||
147 |
|
||||
148 | GDALT - Geodetic altitude (height) (km) |
|
|||
149 | SNL - Log10 (signal to noise ratio) |
|
|||
150 | VN1P2 - Neutral wind in direction 1 (eastward) (m/s), ie zonal wind |
|
|||
151 | VN2P2 - Neutral wind in direction 2 (northward) (m/s), ie meridional wind |
|
|||
152 | EL2 - Ending elevation angle (deg), ie vertical wind |
|
|||
153 |
|
||||
154 | Other parameters: /madrigal3/metadata/parcodes.tab |
|
|||
155 |
|
||||
156 | ''' |
|
160 | ''' | |
157 |
|
161 | |||
158 | self.z_zon = self.dataOut.data_output[0,:,:] |
|
162 | startTime = datetime.datetime.utcfromtimestamp(self.dataOut.utctime) | |
159 | self.z_mer =self.dataOut.data_output[1,:,:] |
|
163 | endTime = startTime + datetime.timedelta(seconds=self.dataOut.paramInterval) | |
160 | self.z_ver = self.dataOut.data_output[2,:,:] |
|
164 | nrows = len(getattr(self.dataOut, self.twoDParam)) | |
161 |
|
165 | |||
162 | if self.im == 0: |
|
166 | rec = madrigal.cedar.MadrigalDataRecord( | |
163 | h_select = numpy.where(numpy.bitwise_and(self.dataOut.height[0, :] >= 0., self.dataOut.height[0, :] <= self.hcm, numpy.isfinite(self.dataOut.height[0, :]))) |
|
167 | self.kinst, | |
164 | else: |
|
168 | self.kindat, | |
165 | h_select = numpy.where(numpy.bitwise_and(self.dataOut.height[0, :] >= 0., self.dataOut.height[0, :] < 20, numpy.isfinite(self.dataOut.height[0, :]))) |
|
169 | startTime.year, | |
166 |
|
170 | startTime.month, | ||
167 | ht = h_select[0] |
|
171 | startTime.day, | |
168 |
|
172 | startTime.hour, | ||
169 | self.o_height = self.dataOut.height[self.im, ht] |
|
173 | startTime.minute, | |
170 | self.o_zon = self.z_zon[ht, self.im] |
|
174 | startTime.second, | |
171 | self.o_mer = self.z_mer[ht, self.im] |
|
175 | startTime.microsecond/10000, | |
172 | self.o_ver = self.z_ver[ht, self.im] |
|
176 | endTime.year, | |
173 | o_snr = self.dataOut.data_SNR[ :, :, self.im] |
|
177 | endTime.month, | |
174 |
|
178 | endTime.day, | ||
175 | o_snr = o_snr[ht, :] |
|
179 | endTime.hour, | |
176 |
|
180 | endTime.minute, | ||
177 | ndiv = numpy.nansum((numpy.isfinite(o_snr)), 1) |
|
181 | endTime.second, | |
178 | ndiv = ndiv.astype(float) |
|
182 | endTime.microsecond/10000, | |
179 |
|
183 | self.oneDList.keys(), | ||
180 | sel_div = numpy.where(ndiv == 0.) |
|
184 | self.twoDList.keys(), | |
181 | ndiv[sel_div] = numpy.nan |
|
185 | nrows | |
182 |
|
186 | ) | ||
183 | if self.nchannels > 1: |
|
|||
184 | msnr = numpy.nansum(o_snr, axis=1) |
|
|||
185 | else: |
|
|||
186 | msnr = o_snr |
|
|||
187 |
|
||||
188 | try: |
|
|||
189 | self.msnr = 10 * numpy.log10(msnr / ndiv) |
|
|||
190 | except ZeroDivisionError: |
|
|||
191 | self.msnr = 10 * numpy.log10(msnr /1) |
|
|||
192 | print 'Number of division (ndiv) egal to 1 by default. Check SNR' |
|
|||
193 |
|
||||
194 | time_t = time.gmtime(self.dataOut.time1) |
|
|||
195 | year = time_t.tm_year |
|
|||
196 | month = time_t.tm_mon |
|
|||
197 | day = time_t.tm_mday |
|
|||
198 | hour = time_t.tm_hour |
|
|||
199 | minute = time_t.tm_min |
|
|||
200 | second = time_t.tm_sec |
|
|||
201 | timedate_0 = datetime.datetime(year, month, day, hour, minute, second) |
|
|||
202 |
|
||||
203 | # 1d parameters |
|
|||
204 | GDLATR = self.lat |
|
|||
205 | GDLONR = self.lon |
|
|||
206 | GDLAT2 = self.lat |
|
|||
207 | GLON2 = self.lon |
|
|||
208 |
|
||||
209 | # 2d parameters |
|
|||
210 | GDALT = self.o_height |
|
|||
211 |
|
||||
212 | SNL = self.msnr |
|
|||
213 | VN1P2 = self.o_zon |
|
|||
214 | VN2P2 = self.o_mer |
|
|||
215 | EL2 = self.o_ver |
|
|||
216 | NROW = len(self.o_height) |
|
|||
217 |
|
||||
218 | startTime = timedate_0 |
|
|||
219 | endTime = startTime |
|
|||
220 | self.dataRec = madrigal.cedar.MadrigalDataRecord(self.kinst, |
|
|||
221 | self.kindat, |
|
|||
222 | startTime.year, |
|
|||
223 | startTime.month, |
|
|||
224 | startTime.day, |
|
|||
225 | startTime.hour, |
|
|||
226 | startTime.minute, |
|
|||
227 | startTime.second, |
|
|||
228 | 0, |
|
|||
229 | endTime.year, |
|
|||
230 | endTime.month, |
|
|||
231 | endTime.day, |
|
|||
232 | endTime.hour, |
|
|||
233 | endTime.minute, |
|
|||
234 | endTime.second, |
|
|||
235 | 0, |
|
|||
236 | ('gdlatr', 'gdlonr', 'gdlat2', 'glon2'), |
|
|||
237 | ('gdalt', 'snl', 'vn1p2', 'vn2p2', 'el2'), |
|
|||
238 | NROW, ind2DList=['gdalt']) |
|
|||
239 |
|
187 | |||
240 | # Setting 1d values |
|
188 | # Setting 1d values | |
241 | self.dataRec.set1D('gdlatr', GDLATR) |
|
189 | for key in self.oneDList: | |
242 | self.dataRec.set1D('gdlonr', GDLONR) |
|
190 | rec.set1D(key, getattr(self.dataOut, self.oneDList[key])) | |
243 | self.dataRec.set1D('gdlat2', GDLAT2) |
|
|||
244 | self.dataRec.set1D('glon2', GLON2) |
|
|||
245 |
|
191 | |||
246 | # Setting 2d values |
|
192 | # Setting 2d values | |
247 | for n in range(self.o_height.shape[0]): |
|
193 | invalid = numpy.isnan(self.dataOut.data_output) | |
248 | self.dataRec.set2D('gdalt', n, GDALT[n]) |
|
194 | self.dataOut.data_output[invalid] = MISSING | |
249 | self.dataRec.set2D('snl', n, SNL[n]) |
|
195 | out = {} | |
250 | self.dataRec.set2D('vn1p2', n, VN1P2[n]) |
|
196 | for key, value in self.twoDList.items(): | |
251 | self.dataRec.set2D('vn2p2', n, VN2P2[n]) |
|
197 | if isinstance(value, str): | |
252 | self.dataRec.set2D('el2', n, EL2[n]) |
|
198 | out[key] = getattr(self.dataOut, value) | |
253 |
|
199 | elif isinstance(value, tuple): | ||
254 | # Appending new data record |
|
200 | attr, x = value | |
255 | ''' |
|
201 | if isinstance(x, (int, float)): | |
256 | [MADRIGAL3]There are two ways to write to a MadrigalCedarFile. Either this method (write) is called after all the |
|
202 | out[key] = getattr(self.dataOut, attr)[int(x)] | |
257 | records have been appended to the MadrigalCedarFile, or dump is called after a certain number of records are appended, |
|
203 | elif x.lower()=='db': | |
258 | and then at the end dump is called a final time if there were any records not yet dumped, followed by addArray. |
|
204 | tmp = getattr(self.dataOut, attr) | |
259 | ''' |
|
205 | SNRavg = numpy.average(tmp, axis=0) | |
260 |
|
206 | out[key] = 10*numpy.log10(SNRavg) | ||
261 | self.cedarObj.append(self.dataRec) |
|
207 | ||
262 | print ' [Writing] records {} (mode {}).'.format(self.dataOut.counter_records,self.im+1) |
|
208 | for n in range(nrows): | |
|
209 | for key in out: | |||
|
210 | rec.set2D(key, n, out[key][n]) | |||
|
211 | ||||
|
212 | self.cedarObj.append(rec) | |||
263 | self.cedarObj.dump() |
|
213 | self.cedarObj.dump() | |
264 |
|
214 | print '[Writing] Record No. {} (mode {}).'.format( | ||
265 |
|
215 | self.counter, | ||
|
216 | self.dataOut.mode | |||
|
217 | ) | |||
266 |
|
218 | |||
267 |
|
||||
268 | def setHeader(self): |
|
219 | def setHeader(self): | |
269 | ''' |
|
220 | ''' | |
270 | - Creating self.catHeadObj |
|
221 | Create an add catalog and header to cedar file | |
271 | - Adding information catalog |
|
|||
272 | - Writing file header |
|
|||
273 |
|
||||
274 | ''' |
|
222 | ''' | |
275 | self.catHeadObj = madrigal.cedar.CatalogHeaderCreator(self.fullname) |
|
|||
276 | kindatDesc, comments, analyst, history, principleInvestigator = self._info_BLTR() |
|
|||
277 |
|
||||
278 | self.catHeadObj.createCatalog(principleInvestigator="Jarjar", |
|
|||
279 | expPurpose='characterize the atmospheric dynamics in this region where frequently it happens the El Nino', |
|
|||
280 | sciRemarks="http://madrigal3.haystack.mit.edu/static/CEDARMadrigalHdf5Format.pdf") |
|
|||
281 |
|
||||
282 | self.catHeadObj.createHeader(kindatDesc, analyst, comments, history) |
|
|||
283 |
|
||||
284 | self.catHeadObj.write() |
|
|||
285 |
|
223 | |||
286 | print '[File created] path: %s' % (self.fullname) |
|
224 | header = madrigal.cedar.CatalogHeaderCreator(self.fullname) | |
|
225 | header.createCatalog(**self.catalog) | |||
|
226 | header.createHeader(**self.header) | |||
|
227 | header.write() | |||
287 |
|
228 | |||
288 | def putData(self): |
|
229 | def putData(self): | |
289 |
|
230 | |||
290 | if self.dataOut.flagNoData: |
|
231 | if self.dataOut.flagNoData: | |
291 | return 0 |
|
232 | return 0 | |
292 |
|
233 | |||
293 |
if self. |
|
234 | if self.counter == 0: | |
294 | self.setFile() |
|
235 | self.setFile() | |
295 | print '[Writing] Setting new hdf5 file for the mode {}'.format(self.im+1) |
|
|||
296 |
|
236 | |||
297 |
if self. |
|
237 | if self.counter <= self.dataOut.nrecords: | |
298 | self.writeBlock() |
|
238 | self.writeBlock() | |
299 |
|
239 | self.counter += 1 | ||
300 |
|
240 | |||
301 |
if self. |
|
241 | if self.counter == self.dataOut.nrecords or self.counter == self.blocks: | |
302 | self.cedarObj.addArray() |
|
|||
303 |
|
||||
304 | self.setHeader() |
|
242 | self.setHeader() | |
305 |
self. |
|
243 | self.counter = 0 | |
306 |
|
||||
307 | def _info_BLTR(self): |
|
|||
308 |
|
||||
309 | kindatDesc = '''--This header is for KINDAT = %d''' % self.kindat |
|
|||
310 | history = None |
|
|||
311 | analyst = '''Jarjar''' |
|
|||
312 | principleInvestigator = ''' |
|
|||
313 | Jarjar |
|
|||
314 | Radio Observatorio de Jicamarca |
|
|||
315 | Instituto Geofisico del Peru |
|
|||
316 |
|
||||
317 | ''' |
|
|||
318 | if self.type == 1: |
|
|||
319 | comments = ''' |
|
|||
320 |
|
||||
321 | --These data are provided by two Boundary Layer and Tropospheric Radar (BLTR) deployed at two different locations at Peru(GMT-5), one of them at Piura(5.17 S, 80.64W) and another located at Huancayo (12.04 S, 75.32 W). |
|
|||
322 |
|
||||
323 | --The purpose of conducting these observations is to measure wind in the differents levels of height, this radar makes measurements the Zonal(U), Meridional(V) and Vertical(W) wind velocities component in northcoast from Peru. And the main purpose of these mensurations is to characterize the atmospheric dynamics in this region where frequently it happens the 'El Nino Phenomenon' |
|
|||
324 |
|
||||
325 | --In Kindat = 1600, contains information of wind velocities component since 0 Km to 3 Km. |
|
|||
326 |
|
||||
327 | --In Kindat = 1601, contains information of wind velocities component since 0 Km to 10 Km. |
|
|||
328 |
|
||||
329 | --The Huancayo-BLTR is a VHF Profiler Radar System is a 3 channel coherent receiver pulsed radar utilising state-of-the-art software and computing techniques to acquire, decode, and translate signals obtained from partial reflection echoes in the troposphere, lower stratosphere and mesosphere. It uses an array of three horizontal spaced and vertically directed receiving antennas. The data is recorded thirty seconds, averaged to one minute mean values of Height, Zonal, Meridional and Vertical wind. |
|
|||
330 |
|
||||
331 | --The Huancayo-BLTR was installed in January 2010. This instrument was designed and constructed by Genesis Soft Pty. Ltd. Is constituted by three groups of spaced antennas (distributed) forming an isosceles triangle. |
|
|||
332 |
|
||||
333 |
|
||||
334 | Station _______ Geographic Coord ______ Geomagnetic Coord |
|
|||
335 |
|
||||
336 | _______________ Latitude _ Longitude __ Latitude _ Longitude |
|
|||
337 |
|
||||
338 | Huancayo (HUA) __12.04 S ___ 75.32 W _____ -12.05 ____ 352.85 |
|
|||
339 | Piura (PIU) _____ 5.17 S ___ 80.64 W ______ 5.18 ____ 350.93 |
|
|||
340 |
|
||||
341 | WIND OBSERVATIONS |
|
|||
342 |
|
||||
343 | --To obtain wind the BLTR uses Spaced Antenna technique (e.g., Briggs 1984). The scatter and reflection it still provided by variations in the refractive index as in the Doppler method(Gage and Basley,1978; Balsley and Gage 1982; Larsen and Rottger 1982), but instead of using the Doppler shift to derive the velocity components, the cross-correlation between signals in an array of three horizontally spaced and vertically directed receiving antennas is used. |
|
|||
344 |
|
||||
345 | ...................................................................... |
|
|||
346 | For more information, consult the following references: |
|
|||
347 | - Balsley, B. B., and K. S. Gage., On the use of radars for operational wind profiling, Bull. Amer. Meteor.Soc.,63, 1009-1018, 1982. |
|
|||
348 |
|
||||
349 | - Briggs, B. H., The analysis of spaced sensor data by correations techniques, Handbook for MAP, Vol. 13, SCOTEP Secretariat, University of Illinois, Urbana, 166-186, 1984. |
|
|||
350 |
|
||||
351 | - Gage, K. S., and B.B. Balsley., Doppler radar probing of the clear atmosphere, Bull. Amer. Meteor.Soc., 59, 1074-1093, 1978. |
|
|||
352 |
|
||||
353 | - Larsen, M. F., The Spaced Antenna Technique for Radar Wind Profiling, Journal of Atm. and Ocean. Technology. , Vol.6, 920-937, 1989. |
|
|||
354 |
|
||||
355 | - Larsen, M. F., A method for single radar voracity measurements?, Handbook for MAP,SCOSTEP Secretariat, University of the Illinois, Urban, in press, 1989. |
|
|||
356 | ...................................................................... |
|
|||
357 |
|
||||
358 | ACKNOWLEDGEMENTS: |
|
|||
359 |
|
||||
360 | --The Piura and Huancayo BLTR are part of the network of instruments operated by the Jicamarca Radio Observatory. |
|
|||
361 |
|
||||
362 | --The Jicamarca Radio Observatory is a facility of the Instituto Geofisico del Peru operated with support from the NSF Cooperative Agreement ATM-0432565 through Cornell University |
|
|||
363 |
|
||||
364 | ...................................................................... |
|
|||
365 |
|
||||
366 | Further questions and comments should be addressed to: |
|
|||
367 | Radio Observatorio de Jicamarca |
|
|||
368 | Instituto Geofisico del Peru |
|
|||
369 | Lima, Peru |
|
|||
370 | Web URL: http://jro.igp.gob.pe |
|
|||
371 | ...................................................................... |
|
|||
372 | ''' |
|
|||
373 |
|
||||
374 | return kindatDesc, comments, analyst, history, principleInvestigator |
|
|||
375 |
|
@@ -1,393 +1,403 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Oct 24, 2016 |
|
2 | Created on Oct 24, 2016 | |
3 |
|
3 | |||
4 | @author: roj- LouVD |
|
4 | @author: roj- LouVD | |
5 | ''' |
|
5 | ''' | |
6 |
|
6 | |||
7 | import numpy |
|
7 | import numpy | |
8 | import copy |
|
8 | import copy | |
9 | import datetime |
|
9 | import datetime | |
10 | import time |
|
10 | import time | |
11 | from time import gmtime |
|
11 | 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, Operation | |
16 | from schainpy.model.data.jrodata import Parameters |
|
16 | from schainpy.model.data.jrodata import Parameters | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | class BLTRParametersProc(ProcessingUnit): |
|
19 | class BLTRParametersProc(ProcessingUnit): | |
20 | ''' |
|
20 | ''' | |
21 | Processing unit for BLTR parameters data (winds) |
|
21 | Processing unit for BLTR parameters data (winds) | |
22 |
|
22 | |||
23 | Inputs: |
|
23 | Inputs: | |
24 | self.dataOut.nmodes - Number of operation modes |
|
24 | self.dataOut.nmodes - Number of operation modes | |
25 | self.dataOut.nchannels - Number of channels |
|
25 | self.dataOut.nchannels - Number of channels | |
26 | self.dataOut.nranges - Number of ranges |
|
26 | self.dataOut.nranges - Number of ranges | |
27 |
|
27 | |||
28 | self.dataOut.data_SNR - SNR array |
|
28 | self.dataOut.data_SNR - SNR array | |
29 | self.dataOut.data_output - Zonal, Vertical and Meridional velocity array |
|
29 | self.dataOut.data_output - Zonal, Vertical and Meridional velocity array | |
30 | self.dataOut.height - Height array (km) |
|
30 | self.dataOut.height - Height array (km) | |
31 | self.dataOut.time - Time array (seconds) |
|
31 | self.dataOut.time - Time array (seconds) | |
32 |
|
32 | |||
33 | self.dataOut.fileIndex -Index of the file currently read |
|
33 | self.dataOut.fileIndex -Index of the file currently read | |
34 | self.dataOut.lat - Latitude coordinate of BLTR location |
|
34 | self.dataOut.lat - Latitude coordinate of BLTR location | |
35 |
|
35 | |||
36 | self.dataOut.doy - Experiment doy (number of the day in the current year) |
|
36 | self.dataOut.doy - Experiment doy (number of the day in the current year) | |
37 | self.dataOut.month - Experiment month |
|
37 | self.dataOut.month - Experiment month | |
38 | self.dataOut.day - Experiment day |
|
38 | self.dataOut.day - Experiment day | |
39 | self.dataOut.year - Experiment year |
|
39 | self.dataOut.year - Experiment year | |
40 | ''' |
|
40 | ''' | |
41 |
|
41 | |||
42 | def __init__(self, **kwargs): |
|
42 | def __init__(self, **kwargs): | |
43 | ''' |
|
43 | ''' | |
44 | Inputs: None |
|
44 | Inputs: None | |
45 | ''' |
|
45 | ''' | |
46 | ProcessingUnit.__init__(self, **kwargs) |
|
46 | ProcessingUnit.__init__(self, **kwargs) | |
47 | self.dataOut = Parameters() |
|
47 | self.dataOut = Parameters() | |
|
48 | self.isConfig = False | |||
48 |
|
49 | |||
49 |
def |
|
50 | def setup(self, mode): | |
|
51 | ''' | |||
50 |
|
|
52 | ''' | |
|
53 | self.dataOut.mode = mode | |||
51 |
|
54 | |||
|
55 | def run(self, mode, snr_threshold=None): | |||
|
56 | ''' | |||
52 | Inputs: |
|
57 | Inputs: | |
53 | mode = High resolution (0) or Low resolution (1) data |
|
58 | mode = High resolution (0) or Low resolution (1) data | |
54 | snr_threshold = snr filter value |
|
59 | snr_threshold = snr filter value | |
55 | ''' |
|
60 | ''' | |
|
61 | ||||
|
62 | if not self.isConfig: | |||
|
63 | self.setup(mode) | |||
|
64 | self.isConfig = True | |||
|
65 | ||||
56 | if self.dataIn.type == 'Parameters': |
|
66 | if self.dataIn.type == 'Parameters': | |
57 | self.dataOut.copy(self.dataIn) |
|
67 | self.dataOut.copy(self.dataIn) | |
58 |
|
68 | |||
59 | self.dataOut.data_output = self.dataOut.data_output[mode] |
|
69 | self.dataOut.data_output = self.dataOut.data_output[mode] | |
60 | self.dataOut.heightList = self.dataOut.height[0] |
|
70 | self.dataOut.heightList = self.dataOut.height[0] | |
61 | self.dataOut.data_SNR = self.dataOut.data_SNR[mode] |
|
71 | self.dataOut.data_SNR = self.dataOut.data_SNR[mode] | |
62 |
|
72 | |||
63 | if snr_threshold is not None: |
|
73 | if snr_threshold is not None: | |
64 | SNRavg = numpy.average(self.dataOut.data_SNR, axis=0) |
|
74 | SNRavg = numpy.average(self.dataOut.data_SNR, axis=0) | |
65 | SNRavgdB = 10*numpy.log10(SNRavg) |
|
75 | SNRavgdB = 10*numpy.log10(SNRavg) | |
66 | for i in range(3): |
|
76 | for i in range(3): | |
67 | self.dataOut.data_output[i][SNRavgdB <= snr_threshold] = numpy.nan |
|
77 | self.dataOut.data_output[i][SNRavgdB <= snr_threshold] = numpy.nan | |
68 |
|
78 | |||
69 | # TODO |
|
79 | # TODO | |
70 | class OutliersFilter(Operation): |
|
80 | class OutliersFilter(Operation): | |
71 |
|
81 | |||
72 | def __init__(self, **kwargs): |
|
82 | def __init__(self, **kwargs): | |
73 | ''' |
|
83 | ''' | |
74 | ''' |
|
84 | ''' | |
75 | Operation.__init__(self, **kwargs) |
|
85 | Operation.__init__(self, **kwargs) | |
76 |
|
86 | |||
77 | def run(self, svalue2, method, factor, filter, npoints=9): |
|
87 | def run(self, svalue2, method, factor, filter, npoints=9): | |
78 | ''' |
|
88 | ''' | |
79 | Inputs: |
|
89 | Inputs: | |
80 | svalue - string to select array velocity |
|
90 | svalue - string to select array velocity | |
81 | svalue2 - string to choose axis filtering |
|
91 | svalue2 - string to choose axis filtering | |
82 | method - 0 for SMOOTH or 1 for MEDIAN |
|
92 | method - 0 for SMOOTH or 1 for MEDIAN | |
83 | factor - number used to set threshold |
|
93 | factor - number used to set threshold | |
84 | filter - 1 for data filtering using the standard deviation criteria else 0 |
|
94 | filter - 1 for data filtering using the standard deviation criteria else 0 | |
85 | npoints - number of points for mask filter |
|
95 | npoints - number of points for mask filter | |
86 | ''' |
|
96 | ''' | |
87 |
|
97 | |||
88 | print ' Outliers Filter {} {} / threshold = {}'.format(svalue, svalue, factor) |
|
98 | print ' Outliers Filter {} {} / threshold = {}'.format(svalue, svalue, factor) | |
89 |
|
99 | |||
90 |
|
100 | |||
91 | yaxis = self.dataOut.heightList |
|
101 | yaxis = self.dataOut.heightList | |
92 | xaxis = numpy.array([[self.dataOut.utctime]]) |
|
102 | xaxis = numpy.array([[self.dataOut.utctime]]) | |
93 |
|
103 | |||
94 | # Zonal |
|
104 | # Zonal | |
95 | value_temp = self.dataOut.data_output[0] |
|
105 | value_temp = self.dataOut.data_output[0] | |
96 |
|
106 | |||
97 | # Zonal |
|
107 | # Zonal | |
98 | value_temp = self.dataOut.data_output[1] |
|
108 | value_temp = self.dataOut.data_output[1] | |
99 |
|
109 | |||
100 | # Vertical |
|
110 | # Vertical | |
101 | value_temp = numpy.transpose(self.dataOut.data_output[2]) |
|
111 | value_temp = numpy.transpose(self.dataOut.data_output[2]) | |
102 |
|
112 | |||
103 | htemp = yaxis |
|
113 | htemp = yaxis | |
104 | std = value_temp |
|
114 | std = value_temp | |
105 | for h in range(len(htemp)): |
|
115 | for h in range(len(htemp)): | |
106 | nvalues_valid = len(numpy.where(numpy.isfinite(value_temp[h]))[0]) |
|
116 | nvalues_valid = len(numpy.where(numpy.isfinite(value_temp[h]))[0]) | |
107 | minvalid = npoints |
|
117 | minvalid = npoints | |
108 |
|
118 | |||
109 | #only if valid values greater than the minimum required (10%) |
|
119 | #only if valid values greater than the minimum required (10%) | |
110 | if nvalues_valid > minvalid: |
|
120 | if nvalues_valid > minvalid: | |
111 |
|
121 | |||
112 | if method == 0: |
|
122 | if method == 0: | |
113 | #SMOOTH |
|
123 | #SMOOTH | |
114 | w = value_temp[h] - self.Smooth(input=value_temp[h], width=npoints, edge_truncate=1) |
|
124 | w = value_temp[h] - self.Smooth(input=value_temp[h], width=npoints, edge_truncate=1) | |
115 |
|
125 | |||
116 |
|
126 | |||
117 | if method == 1: |
|
127 | if method == 1: | |
118 | #MEDIAN |
|
128 | #MEDIAN | |
119 | w = value_temp[h] - self.Median(input=value_temp[h], width = npoints) |
|
129 | w = value_temp[h] - self.Median(input=value_temp[h], width = npoints) | |
120 |
|
130 | |||
121 | dw = numpy.std(w[numpy.where(numpy.isfinite(w))],ddof = 1) |
|
131 | dw = numpy.std(w[numpy.where(numpy.isfinite(w))],ddof = 1) | |
122 |
|
132 | |||
123 | threshold = dw*factor |
|
133 | threshold = dw*factor | |
124 | value_temp[numpy.where(w > threshold),h] = numpy.nan |
|
134 | value_temp[numpy.where(w > threshold),h] = numpy.nan | |
125 | value_temp[numpy.where(w < -1*threshold),h] = numpy.nan |
|
135 | value_temp[numpy.where(w < -1*threshold),h] = numpy.nan | |
126 |
|
136 | |||
127 |
|
137 | |||
128 | #At the end |
|
138 | #At the end | |
129 | if svalue2 == 'inHeight': |
|
139 | if svalue2 == 'inHeight': | |
130 | value_temp = numpy.transpose(value_temp) |
|
140 | value_temp = numpy.transpose(value_temp) | |
131 | output_array[:,m] = value_temp |
|
141 | output_array[:,m] = value_temp | |
132 |
|
142 | |||
133 | if svalue == 'zonal': |
|
143 | if svalue == 'zonal': | |
134 | self.dataOut.data_output[0] = output_array |
|
144 | self.dataOut.data_output[0] = output_array | |
135 |
|
145 | |||
136 | elif svalue == 'meridional': |
|
146 | elif svalue == 'meridional': | |
137 | self.dataOut.data_output[1] = output_array |
|
147 | self.dataOut.data_output[1] = output_array | |
138 |
|
148 | |||
139 | elif svalue == 'vertical': |
|
149 | elif svalue == 'vertical': | |
140 | self.dataOut.data_output[2] = output_array |
|
150 | self.dataOut.data_output[2] = output_array | |
141 |
|
151 | |||
142 | return self.dataOut.data_output |
|
152 | return self.dataOut.data_output | |
143 |
|
153 | |||
144 |
|
154 | |||
145 | def Median(self,input,width): |
|
155 | def Median(self,input,width): | |
146 | ''' |
|
156 | ''' | |
147 | Inputs: |
|
157 | Inputs: | |
148 | input - Velocity array |
|
158 | input - Velocity array | |
149 | width - Number of points for mask filter |
|
159 | width - Number of points for mask filter | |
150 |
|
160 | |||
151 | ''' |
|
161 | ''' | |
152 |
|
162 | |||
153 | if numpy.mod(width,2) == 1: |
|
163 | if numpy.mod(width,2) == 1: | |
154 | pc = int((width - 1) / 2) |
|
164 | pc = int((width - 1) / 2) | |
155 | cont = 0 |
|
165 | cont = 0 | |
156 | output = [] |
|
166 | output = [] | |
157 |
|
167 | |||
158 | for i in range(len(input)): |
|
168 | for i in range(len(input)): | |
159 | if i >= pc and i < len(input) - pc: |
|
169 | if i >= pc and i < len(input) - pc: | |
160 | new2 = input[i-pc:i+pc+1] |
|
170 | new2 = input[i-pc:i+pc+1] | |
161 | temp = numpy.where(numpy.isfinite(new2)) |
|
171 | temp = numpy.where(numpy.isfinite(new2)) | |
162 | new = new2[temp] |
|
172 | new = new2[temp] | |
163 | value = numpy.median(new) |
|
173 | value = numpy.median(new) | |
164 | output.append(value) |
|
174 | output.append(value) | |
165 |
|
175 | |||
166 | output = numpy.array(output) |
|
176 | output = numpy.array(output) | |
167 | output = numpy.hstack((input[0:pc],output)) |
|
177 | output = numpy.hstack((input[0:pc],output)) | |
168 | output = numpy.hstack((output,input[-pc:len(input)])) |
|
178 | output = numpy.hstack((output,input[-pc:len(input)])) | |
169 |
|
179 | |||
170 | return output |
|
180 | return output | |
171 |
|
181 | |||
172 | def Smooth(self,input,width,edge_truncate = None): |
|
182 | def Smooth(self,input,width,edge_truncate = None): | |
173 | ''' |
|
183 | ''' | |
174 | Inputs: |
|
184 | Inputs: | |
175 | input - Velocity array |
|
185 | input - Velocity array | |
176 | width - Number of points for mask filter |
|
186 | width - Number of points for mask filter | |
177 | edge_truncate - 1 for truncate the convolution product else |
|
187 | edge_truncate - 1 for truncate the convolution product else | |
178 |
|
188 | |||
179 | ''' |
|
189 | ''' | |
180 |
|
190 | |||
181 | if numpy.mod(width,2) == 0: |
|
191 | if numpy.mod(width,2) == 0: | |
182 | real_width = width + 1 |
|
192 | real_width = width + 1 | |
183 | nzeros = width / 2 |
|
193 | nzeros = width / 2 | |
184 | else: |
|
194 | else: | |
185 | real_width = width |
|
195 | real_width = width | |
186 | nzeros = (width - 1) / 2 |
|
196 | nzeros = (width - 1) / 2 | |
187 |
|
197 | |||
188 | half_width = int(real_width)/2 |
|
198 | half_width = int(real_width)/2 | |
189 | length = len(input) |
|
199 | length = len(input) | |
190 |
|
200 | |||
191 | gate = numpy.ones(real_width,dtype='float') |
|
201 | gate = numpy.ones(real_width,dtype='float') | |
192 | norm_of_gate = numpy.sum(gate) |
|
202 | norm_of_gate = numpy.sum(gate) | |
193 |
|
203 | |||
194 | nan_process = 0 |
|
204 | nan_process = 0 | |
195 | nan_id = numpy.where(numpy.isnan(input)) |
|
205 | nan_id = numpy.where(numpy.isnan(input)) | |
196 | if len(nan_id[0]) > 0: |
|
206 | if len(nan_id[0]) > 0: | |
197 | nan_process = 1 |
|
207 | nan_process = 1 | |
198 | pb = numpy.zeros(len(input)) |
|
208 | pb = numpy.zeros(len(input)) | |
199 | pb[nan_id] = 1. |
|
209 | pb[nan_id] = 1. | |
200 | input[nan_id] = 0. |
|
210 | input[nan_id] = 0. | |
201 |
|
211 | |||
202 | if edge_truncate == True: |
|
212 | if edge_truncate == True: | |
203 | output = numpy.convolve(input/norm_of_gate,gate,mode='same') |
|
213 | output = numpy.convolve(input/norm_of_gate,gate,mode='same') | |
204 | elif edge_truncate == False or edge_truncate == None: |
|
214 | elif edge_truncate == False or edge_truncate == None: | |
205 | output = numpy.convolve(input/norm_of_gate,gate,mode='valid') |
|
215 | output = numpy.convolve(input/norm_of_gate,gate,mode='valid') | |
206 | output = numpy.hstack((input[0:half_width],output)) |
|
216 | output = numpy.hstack((input[0:half_width],output)) | |
207 | output = numpy.hstack((output,input[len(input)-half_width:len(input)])) |
|
217 | output = numpy.hstack((output,input[len(input)-half_width:len(input)])) | |
208 |
|
218 | |||
209 | if nan_process: |
|
219 | if nan_process: | |
210 | pb = numpy.convolve(pb/norm_of_gate,gate,mode='valid') |
|
220 | pb = numpy.convolve(pb/norm_of_gate,gate,mode='valid') | |
211 | pb = numpy.hstack((numpy.zeros(half_width),pb)) |
|
221 | pb = numpy.hstack((numpy.zeros(half_width),pb)) | |
212 | pb = numpy.hstack((pb,numpy.zeros(half_width))) |
|
222 | pb = numpy.hstack((pb,numpy.zeros(half_width))) | |
213 | output[numpy.where(pb > 0.9999)] = numpy.nan |
|
223 | output[numpy.where(pb > 0.9999)] = numpy.nan | |
214 | input[nan_id] = numpy.nan |
|
224 | input[nan_id] = numpy.nan | |
215 | return output |
|
225 | return output | |
216 |
|
226 | |||
217 | def Average(self,aver=0,nhaver=1): |
|
227 | def Average(self,aver=0,nhaver=1): | |
218 | ''' |
|
228 | ''' | |
219 | Inputs: |
|
229 | Inputs: | |
220 | aver - Indicates the time period over which is averaged or consensus data |
|
230 | aver - Indicates the time period over which is averaged or consensus data | |
221 | nhaver - Indicates the decimation factor in heights |
|
231 | nhaver - Indicates the decimation factor in heights | |
222 |
|
232 | |||
223 | ''' |
|
233 | ''' | |
224 | nhpoints = 48 |
|
234 | nhpoints = 48 | |
225 |
|
235 | |||
226 | lat_piura = -5.17 |
|
236 | lat_piura = -5.17 | |
227 | lat_huancayo = -12.04 |
|
237 | lat_huancayo = -12.04 | |
228 | lat_porcuya = -5.8 |
|
238 | lat_porcuya = -5.8 | |
229 |
|
239 | |||
230 | if '%2.2f'%self.dataOut.lat == '%2.2f'%lat_piura: |
|
240 | if '%2.2f'%self.dataOut.lat == '%2.2f'%lat_piura: | |
231 | hcm = 3. |
|
241 | hcm = 3. | |
232 | if self.dataOut.year == 2003 : |
|
242 | if self.dataOut.year == 2003 : | |
233 | if self.dataOut.doy >= 25 and self.dataOut.doy < 64: |
|
243 | if self.dataOut.doy >= 25 and self.dataOut.doy < 64: | |
234 | nhpoints = 12 |
|
244 | nhpoints = 12 | |
235 |
|
245 | |||
236 | elif '%2.2f'%self.dataOut.lat == '%2.2f'%lat_huancayo: |
|
246 | elif '%2.2f'%self.dataOut.lat == '%2.2f'%lat_huancayo: | |
237 | hcm = 3. |
|
247 | hcm = 3. | |
238 | if self.dataOut.year == 2003 : |
|
248 | if self.dataOut.year == 2003 : | |
239 | if self.dataOut.doy >= 25 and self.dataOut.doy < 64: |
|
249 | if self.dataOut.doy >= 25 and self.dataOut.doy < 64: | |
240 | nhpoints = 12 |
|
250 | nhpoints = 12 | |
241 |
|
251 | |||
242 |
|
252 | |||
243 | elif '%2.2f'%self.dataOut.lat == '%2.2f'%lat_porcuya: |
|
253 | elif '%2.2f'%self.dataOut.lat == '%2.2f'%lat_porcuya: | |
244 | hcm = 5.#2 |
|
254 | hcm = 5.#2 | |
245 |
|
255 | |||
246 | pdata = 0.2 |
|
256 | pdata = 0.2 | |
247 | taver = [1,2,3,4,6,8,12,24] |
|
257 | taver = [1,2,3,4,6,8,12,24] | |
248 | t0 = 0 |
|
258 | t0 = 0 | |
249 | tf = 24 |
|
259 | tf = 24 | |
250 | ntime =(tf-t0)/taver[aver] |
|
260 | ntime =(tf-t0)/taver[aver] | |
251 | ti = numpy.arange(ntime) |
|
261 | ti = numpy.arange(ntime) | |
252 | tf = numpy.arange(ntime) + taver[aver] |
|
262 | tf = numpy.arange(ntime) + taver[aver] | |
253 |
|
263 | |||
254 |
|
264 | |||
255 | old_height = self.dataOut.heightList |
|
265 | old_height = self.dataOut.heightList | |
256 |
|
266 | |||
257 | if nhaver > 1: |
|
267 | if nhaver > 1: | |
258 | num_hei = len(self.dataOut.heightList)/nhaver/self.dataOut.nmodes |
|
268 | num_hei = len(self.dataOut.heightList)/nhaver/self.dataOut.nmodes | |
259 | deltha = 0.05*nhaver |
|
269 | deltha = 0.05*nhaver | |
260 | minhvalid = pdata*nhaver |
|
270 | minhvalid = pdata*nhaver | |
261 | for im in range(self.dataOut.nmodes): |
|
271 | for im in range(self.dataOut.nmodes): | |
262 | new_height = numpy.arange(num_hei)*deltha + self.dataOut.height[im,0] + deltha/2. |
|
272 | new_height = numpy.arange(num_hei)*deltha + self.dataOut.height[im,0] + deltha/2. | |
263 |
|
273 | |||
264 |
|
274 | |||
265 | data_fHeigths_List = [] |
|
275 | data_fHeigths_List = [] | |
266 | data_fZonal_List = [] |
|
276 | data_fZonal_List = [] | |
267 | data_fMeridional_List = [] |
|
277 | data_fMeridional_List = [] | |
268 | data_fVertical_List = [] |
|
278 | data_fVertical_List = [] | |
269 | startDTList = [] |
|
279 | startDTList = [] | |
270 |
|
280 | |||
271 |
|
281 | |||
272 | for i in range(ntime): |
|
282 | for i in range(ntime): | |
273 | height = old_height |
|
283 | height = old_height | |
274 |
|
284 | |||
275 | start = datetime.datetime(self.dataOut.year,self.dataOut.month,self.dataOut.day) + datetime.timedelta(hours = int(ti[i])) - datetime.timedelta(hours = 5) |
|
285 | start = datetime.datetime(self.dataOut.year,self.dataOut.month,self.dataOut.day) + datetime.timedelta(hours = int(ti[i])) - datetime.timedelta(hours = 5) | |
276 | stop = datetime.datetime(self.dataOut.year,self.dataOut.month,self.dataOut.day) + datetime.timedelta(hours = int(tf[i])) - datetime.timedelta(hours = 5) |
|
286 | stop = datetime.datetime(self.dataOut.year,self.dataOut.month,self.dataOut.day) + datetime.timedelta(hours = int(tf[i])) - datetime.timedelta(hours = 5) | |
277 |
|
287 | |||
278 |
|
288 | |||
279 | limit_sec1 = time.mktime(start.timetuple()) |
|
289 | limit_sec1 = time.mktime(start.timetuple()) | |
280 | limit_sec2 = time.mktime(stop.timetuple()) |
|
290 | limit_sec2 = time.mktime(stop.timetuple()) | |
281 |
|
291 | |||
282 | t1 = numpy.where(self.f_timesec >= limit_sec1) |
|
292 | t1 = numpy.where(self.f_timesec >= limit_sec1) | |
283 | t2 = numpy.where(self.f_timesec < limit_sec2) |
|
293 | t2 = numpy.where(self.f_timesec < limit_sec2) | |
284 | time_select = [] |
|
294 | time_select = [] | |
285 | for val_sec in t1[0]: |
|
295 | for val_sec in t1[0]: | |
286 | if val_sec in t2[0]: |
|
296 | if val_sec in t2[0]: | |
287 | time_select.append(val_sec) |
|
297 | time_select.append(val_sec) | |
288 |
|
298 | |||
289 |
|
299 | |||
290 | time_select = numpy.array(time_select,dtype = 'int') |
|
300 | time_select = numpy.array(time_select,dtype = 'int') | |
291 | minvalid = numpy.ceil(pdata*nhpoints) |
|
301 | minvalid = numpy.ceil(pdata*nhpoints) | |
292 |
|
302 | |||
293 | zon_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
303 | zon_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
294 | mer_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
304 | mer_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
295 | ver_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
305 | ver_aver = numpy.zeros([self.dataOut.nranges,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
296 |
|
306 | |||
297 | if nhaver > 1: |
|
307 | if nhaver > 1: | |
298 | new_zon_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
308 | new_zon_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
299 | new_mer_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
309 | new_mer_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
300 | new_ver_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan |
|
310 | new_ver_aver = numpy.zeros([num_hei,self.dataOut.nmodes],dtype='f4') + numpy.nan | |
301 |
|
311 | |||
302 | if len(time_select) > minvalid: |
|
312 | if len(time_select) > minvalid: | |
303 | time_average = self.f_timesec[time_select] |
|
313 | time_average = self.f_timesec[time_select] | |
304 |
|
314 | |||
305 | for im in range(self.dataOut.nmodes): |
|
315 | for im in range(self.dataOut.nmodes): | |
306 |
|
316 | |||
307 | for ih in range(self.dataOut.nranges): |
|
317 | for ih in range(self.dataOut.nranges): | |
308 | if numpy.sum(numpy.isfinite(self.f_zon[time_select,ih,im])) >= minvalid: |
|
318 | if numpy.sum(numpy.isfinite(self.f_zon[time_select,ih,im])) >= minvalid: | |
309 | zon_aver[ih,im] = numpy.nansum(self.f_zon[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_zon[time_select,ih,im])) |
|
319 | zon_aver[ih,im] = numpy.nansum(self.f_zon[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_zon[time_select,ih,im])) | |
310 |
|
320 | |||
311 | if numpy.sum(numpy.isfinite(self.f_mer[time_select,ih,im])) >= minvalid: |
|
321 | if numpy.sum(numpy.isfinite(self.f_mer[time_select,ih,im])) >= minvalid: | |
312 | mer_aver[ih,im] = numpy.nansum(self.f_mer[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_mer[time_select,ih,im])) |
|
322 | mer_aver[ih,im] = numpy.nansum(self.f_mer[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_mer[time_select,ih,im])) | |
313 |
|
323 | |||
314 | if numpy.sum(numpy.isfinite(self.f_ver[time_select,ih,im])) >= minvalid: |
|
324 | if numpy.sum(numpy.isfinite(self.f_ver[time_select,ih,im])) >= minvalid: | |
315 | ver_aver[ih,im] = numpy.nansum(self.f_ver[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_ver[time_select,ih,im])) |
|
325 | ver_aver[ih,im] = numpy.nansum(self.f_ver[time_select,ih,im]) / numpy.sum(numpy.isfinite(self.f_ver[time_select,ih,im])) | |
316 |
|
326 | |||
317 | if nhaver > 1: |
|
327 | if nhaver > 1: | |
318 | for ih in range(num_hei): |
|
328 | for ih in range(num_hei): | |
319 | hvalid = numpy.arange(nhaver) + nhaver*ih |
|
329 | hvalid = numpy.arange(nhaver) + nhaver*ih | |
320 |
|
330 | |||
321 | if numpy.sum(numpy.isfinite(zon_aver[hvalid,im])) >= minvalid: |
|
331 | if numpy.sum(numpy.isfinite(zon_aver[hvalid,im])) >= minvalid: | |
322 | new_zon_aver[ih,im] = numpy.nansum(zon_aver[hvalid,im]) / numpy.sum(numpy.isfinite(zon_aver[hvalid,im])) |
|
332 | new_zon_aver[ih,im] = numpy.nansum(zon_aver[hvalid,im]) / numpy.sum(numpy.isfinite(zon_aver[hvalid,im])) | |
323 |
|
333 | |||
324 | if numpy.sum(numpy.isfinite(mer_aver[hvalid,im])) >= minvalid: |
|
334 | if numpy.sum(numpy.isfinite(mer_aver[hvalid,im])) >= minvalid: | |
325 | new_mer_aver[ih,im] = numpy.nansum(mer_aver[hvalid,im]) / numpy.sum(numpy.isfinite(mer_aver[hvalid,im])) |
|
335 | new_mer_aver[ih,im] = numpy.nansum(mer_aver[hvalid,im]) / numpy.sum(numpy.isfinite(mer_aver[hvalid,im])) | |
326 |
|
336 | |||
327 | if numpy.sum(numpy.isfinite(ver_aver[hvalid,im])) >= minvalid: |
|
337 | if numpy.sum(numpy.isfinite(ver_aver[hvalid,im])) >= minvalid: | |
328 | new_ver_aver[ih,im] = numpy.nansum(ver_aver[hvalid,im]) / numpy.sum(numpy.isfinite(ver_aver[hvalid,im])) |
|
338 | new_ver_aver[ih,im] = numpy.nansum(ver_aver[hvalid,im]) / numpy.sum(numpy.isfinite(ver_aver[hvalid,im])) | |
329 | if nhaver > 1: |
|
339 | if nhaver > 1: | |
330 | zon_aver = new_zon_aver |
|
340 | zon_aver = new_zon_aver | |
331 | mer_aver = new_mer_aver |
|
341 | mer_aver = new_mer_aver | |
332 | ver_aver = new_ver_aver |
|
342 | ver_aver = new_ver_aver | |
333 | height = new_height |
|
343 | height = new_height | |
334 |
|
344 | |||
335 |
|
345 | |||
336 | tstart = time_average[0] |
|
346 | tstart = time_average[0] | |
337 | tend = time_average[-1] |
|
347 | tend = time_average[-1] | |
338 | startTime = time.gmtime(tstart) |
|
348 | startTime = time.gmtime(tstart) | |
339 |
|
349 | |||
340 | year = startTime.tm_year |
|
350 | year = startTime.tm_year | |
341 | month = startTime.tm_mon |
|
351 | month = startTime.tm_mon | |
342 | day = startTime.tm_mday |
|
352 | day = startTime.tm_mday | |
343 | hour = startTime.tm_hour |
|
353 | hour = startTime.tm_hour | |
344 | minute = startTime.tm_min |
|
354 | minute = startTime.tm_min | |
345 | second = startTime.tm_sec |
|
355 | second = startTime.tm_sec | |
346 |
|
356 | |||
347 | startDTList.append(datetime.datetime(year,month,day,hour,minute,second)) |
|
357 | startDTList.append(datetime.datetime(year,month,day,hour,minute,second)) | |
348 |
|
358 | |||
349 |
|
359 | |||
350 | o_height = numpy.array([]) |
|
360 | o_height = numpy.array([]) | |
351 | o_zon_aver = numpy.array([]) |
|
361 | o_zon_aver = numpy.array([]) | |
352 | o_mer_aver = numpy.array([]) |
|
362 | o_mer_aver = numpy.array([]) | |
353 | o_ver_aver = numpy.array([]) |
|
363 | o_ver_aver = numpy.array([]) | |
354 | if self.dataOut.nmodes > 1: |
|
364 | if self.dataOut.nmodes > 1: | |
355 | for im in range(self.dataOut.nmodes): |
|
365 | for im in range(self.dataOut.nmodes): | |
356 |
|
366 | |||
357 | if im == 0: |
|
367 | if im == 0: | |
358 | h_select = numpy.where(numpy.bitwise_and(height[0,:] >=0,height[0,:] <= hcm,numpy.isfinite(height[0,:]))) |
|
368 | h_select = numpy.where(numpy.bitwise_and(height[0,:] >=0,height[0,:] <= hcm,numpy.isfinite(height[0,:]))) | |
359 | else: |
|
369 | else: | |
360 | h_select = numpy.where(numpy.bitwise_and(height[1,:] > hcm,height[1,:] < 20,numpy.isfinite(height[1,:]))) |
|
370 | h_select = numpy.where(numpy.bitwise_and(height[1,:] > hcm,height[1,:] < 20,numpy.isfinite(height[1,:]))) | |
361 |
|
371 | |||
362 |
|
372 | |||
363 | ht = h_select[0] |
|
373 | ht = h_select[0] | |
364 |
|
374 | |||
365 | o_height = numpy.hstack((o_height,height[im,ht])) |
|
375 | o_height = numpy.hstack((o_height,height[im,ht])) | |
366 | o_zon_aver = numpy.hstack((o_zon_aver,zon_aver[ht,im])) |
|
376 | o_zon_aver = numpy.hstack((o_zon_aver,zon_aver[ht,im])) | |
367 | o_mer_aver = numpy.hstack((o_mer_aver,mer_aver[ht,im])) |
|
377 | o_mer_aver = numpy.hstack((o_mer_aver,mer_aver[ht,im])) | |
368 | o_ver_aver = numpy.hstack((o_ver_aver,ver_aver[ht,im])) |
|
378 | o_ver_aver = numpy.hstack((o_ver_aver,ver_aver[ht,im])) | |
369 |
|
379 | |||
370 | data_fHeigths_List.append(o_height) |
|
380 | data_fHeigths_List.append(o_height) | |
371 | data_fZonal_List.append(o_zon_aver) |
|
381 | data_fZonal_List.append(o_zon_aver) | |
372 | data_fMeridional_List.append(o_mer_aver) |
|
382 | data_fMeridional_List.append(o_mer_aver) | |
373 | data_fVertical_List.append(o_ver_aver) |
|
383 | data_fVertical_List.append(o_ver_aver) | |
374 |
|
384 | |||
375 |
|
385 | |||
376 | else: |
|
386 | else: | |
377 | h_select = numpy.where(numpy.bitwise_and(height[0,:] <= hcm,numpy.isfinite(height[0,:]))) |
|
387 | h_select = numpy.where(numpy.bitwise_and(height[0,:] <= hcm,numpy.isfinite(height[0,:]))) | |
378 | ht = h_select[0] |
|
388 | ht = h_select[0] | |
379 | o_height = numpy.hstack((o_height,height[im,ht])) |
|
389 | o_height = numpy.hstack((o_height,height[im,ht])) | |
380 | o_zon_aver = numpy.hstack((o_zon_aver,zon_aver[ht,im])) |
|
390 | o_zon_aver = numpy.hstack((o_zon_aver,zon_aver[ht,im])) | |
381 | o_mer_aver = numpy.hstack((o_mer_aver,mer_aver[ht,im])) |
|
391 | o_mer_aver = numpy.hstack((o_mer_aver,mer_aver[ht,im])) | |
382 | o_ver_aver = numpy.hstack((o_ver_aver,ver_aver[ht,im])) |
|
392 | o_ver_aver = numpy.hstack((o_ver_aver,ver_aver[ht,im])) | |
383 |
|
393 | |||
384 | data_fHeigths_List.append(o_height) |
|
394 | data_fHeigths_List.append(o_height) | |
385 | data_fZonal_List.append(o_zon_aver) |
|
395 | data_fZonal_List.append(o_zon_aver) | |
386 | data_fMeridional_List.append(o_mer_aver) |
|
396 | data_fMeridional_List.append(o_mer_aver) | |
387 | data_fVertical_List.append(o_ver_aver) |
|
397 | data_fVertical_List.append(o_ver_aver) | |
388 |
|
398 | |||
389 |
|
399 | |||
390 | return startDTList, data_fHeigths_List, data_fZonal_List, data_fMeridional_List, data_fVertical_List |
|
400 | return startDTList, data_fHeigths_List, data_fZonal_List, data_fMeridional_List, data_fVertical_List | |
391 |
|
401 | |||
392 |
|
402 | |||
393 | No newline at end of file |
|
403 |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
1 | NO CONTENT: file was removed, binary diff hidden |
|
NO CONTENT: file was removed, binary diff hidden |
General Comments 0
You need to be logged in to leave comments.
Login now