The requested changes are too big and content was truncated. Show full diff
@@ -1,509 +1,517 | |||
|
1 | 1 | import os |
|
2 | 2 | import datetime |
|
3 | 3 | import numpy |
|
4 | 4 | |
|
5 | 5 | from schainpy.model.graphics.jroplot_base import Plot, plt |
|
6 | 6 | from schainpy.model.graphics.jroplot_spectra import SpectraPlot, RTIPlot, CoherencePlot, SpectraCutPlot |
|
7 | 7 | from schainpy.utils import log |
|
8 | 8 | # libreria wradlib |
|
9 | 9 | import wradlib as wrl |
|
10 | 10 | |
|
11 | 11 | EARTH_RADIUS = 6.3710e3 |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | def ll2xy(lat1, lon1, lat2, lon2): |
|
15 | 15 | |
|
16 | 16 | p = 0.017453292519943295 |
|
17 | 17 | a = 0.5 - numpy.cos((lat2 - lat1) * p)/2 + numpy.cos(lat1 * p) * \ |
|
18 | 18 | numpy.cos(lat2 * p) * (1 - numpy.cos((lon2 - lon1) * p)) / 2 |
|
19 | 19 | r = 12742 * numpy.arcsin(numpy.sqrt(a)) |
|
20 | 20 | theta = numpy.arctan2(numpy.sin((lon2-lon1)*p)*numpy.cos(lat2*p), numpy.cos(lat1*p) |
|
21 | 21 | * numpy.sin(lat2*p)-numpy.sin(lat1*p)*numpy.cos(lat2*p)*numpy.cos((lon2-lon1)*p)) |
|
22 | 22 | theta = -theta + numpy.pi/2 |
|
23 | 23 | return r*numpy.cos(theta), r*numpy.sin(theta) |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | def km2deg(km): |
|
27 | 27 | ''' |
|
28 | 28 | Convert distance in km to degrees |
|
29 | 29 | ''' |
|
30 | 30 | |
|
31 | 31 | return numpy.rad2deg(km/EARTH_RADIUS) |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | |
|
35 | 35 | class SpectralMomentsPlot(SpectraPlot): |
|
36 | 36 | ''' |
|
37 | 37 | Plot for Spectral Moments |
|
38 | 38 | ''' |
|
39 | 39 | CODE = 'spc_moments' |
|
40 | 40 | # colormap = 'jet' |
|
41 | 41 | # plot_type = 'pcolor' |
|
42 | 42 | |
|
43 | 43 | class DobleGaussianPlot(SpectraPlot): |
|
44 | 44 | ''' |
|
45 | 45 | Plot for Double Gaussian Plot |
|
46 | 46 | ''' |
|
47 | 47 | CODE = 'gaussian_fit' |
|
48 | 48 | # colormap = 'jet' |
|
49 | 49 | # plot_type = 'pcolor' |
|
50 | 50 | |
|
51 | 51 | class DoubleGaussianSpectraCutPlot(SpectraCutPlot): |
|
52 | 52 | ''' |
|
53 | 53 | Plot SpectraCut with Double Gaussian Fit |
|
54 | 54 | ''' |
|
55 | 55 | CODE = 'cut_gaussian_fit' |
|
56 | 56 | |
|
57 | 57 | class SnrPlot(RTIPlot): |
|
58 | 58 | ''' |
|
59 | 59 | Plot for SNR Data |
|
60 | 60 | ''' |
|
61 | 61 | |
|
62 | 62 | CODE = 'snr' |
|
63 | 63 | colormap = 'jet' |
|
64 | 64 | |
|
65 | 65 | def update(self, dataOut): |
|
66 | 66 | |
|
67 | 67 | data = { |
|
68 | 68 | 'snr': 10*numpy.log10(dataOut.data_snr) |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | return data, {} |
|
72 | 72 | |
|
73 | 73 | class DopplerPlot(RTIPlot): |
|
74 | 74 | ''' |
|
75 | 75 | Plot for DOPPLER Data (1st moment) |
|
76 | 76 | ''' |
|
77 | 77 | |
|
78 | 78 | CODE = 'dop' |
|
79 | 79 | colormap = 'jet' |
|
80 | 80 | |
|
81 | 81 | def update(self, dataOut): |
|
82 | 82 | |
|
83 | 83 | data = { |
|
84 | 84 | 'dop': 10*numpy.log10(dataOut.data_dop) |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | return data, {} |
|
88 | 88 | |
|
89 | 89 | class PowerPlot(RTIPlot): |
|
90 | 90 | ''' |
|
91 | 91 | Plot for Power Data (0 moment) |
|
92 | 92 | ''' |
|
93 | 93 | |
|
94 | 94 | CODE = 'pow' |
|
95 | 95 | colormap = 'jet' |
|
96 | 96 | |
|
97 | 97 | def update(self, dataOut): |
|
98 | 98 | data = { |
|
99 | 99 | 'pow': 10*numpy.log10(dataOut.data_pow/dataOut.normFactor) |
|
100 | 100 | } |
|
101 | 101 | return data, {} |
|
102 | 102 | |
|
103 | 103 | class SpectralWidthPlot(RTIPlot): |
|
104 | 104 | ''' |
|
105 | 105 | Plot for Spectral Width Data (2nd moment) |
|
106 | 106 | ''' |
|
107 | 107 | |
|
108 | 108 | CODE = 'width' |
|
109 | 109 | colormap = 'jet' |
|
110 | 110 | |
|
111 | 111 | def update(self, dataOut): |
|
112 | 112 | |
|
113 | 113 | data = { |
|
114 | 114 | 'width': dataOut.data_width |
|
115 | 115 | } |
|
116 | 116 | |
|
117 | 117 | return data, {} |
|
118 | 118 | |
|
119 | 119 | class SkyMapPlot(Plot): |
|
120 | 120 | ''' |
|
121 | 121 | Plot for meteors detection data |
|
122 | 122 | ''' |
|
123 | 123 | |
|
124 | 124 | CODE = 'param' |
|
125 | 125 | |
|
126 | 126 | def setup(self): |
|
127 | 127 | |
|
128 | 128 | self.ncols = 1 |
|
129 | 129 | self.nrows = 1 |
|
130 | 130 | self.width = 7.2 |
|
131 | 131 | self.height = 7.2 |
|
132 | 132 | self.nplots = 1 |
|
133 | 133 | self.xlabel = 'Zonal Zenith Angle (deg)' |
|
134 | 134 | self.ylabel = 'Meridional Zenith Angle (deg)' |
|
135 | 135 | self.polar = True |
|
136 | 136 | self.ymin = -180 |
|
137 | 137 | self.ymax = 180 |
|
138 | 138 | self.colorbar = False |
|
139 | 139 | |
|
140 | 140 | def plot(self): |
|
141 | 141 | |
|
142 | 142 | arrayParameters = numpy.concatenate(self.data['param']) |
|
143 | 143 | error = arrayParameters[:, -1] |
|
144 | 144 | indValid = numpy.where(error == 0)[0] |
|
145 | 145 | finalMeteor = arrayParameters[indValid, :] |
|
146 | 146 | finalAzimuth = finalMeteor[:, 3] |
|
147 | 147 | finalZenith = finalMeteor[:, 4] |
|
148 | 148 | |
|
149 | 149 | x = finalAzimuth * numpy.pi / 180 |
|
150 | 150 | y = finalZenith |
|
151 | 151 | |
|
152 | 152 | ax = self.axes[0] |
|
153 | 153 | |
|
154 | 154 | if ax.firsttime: |
|
155 | 155 | ax.plot = ax.plot(x, y, 'bo', markersize=5)[0] |
|
156 | 156 | else: |
|
157 | 157 | ax.plot.set_data(x, y) |
|
158 | 158 | |
|
159 | 159 | dt1 = self.getDateTime(self.data.min_time).strftime('%y/%m/%d %H:%M:%S') |
|
160 | 160 | dt2 = self.getDateTime(self.data.max_time).strftime('%y/%m/%d %H:%M:%S') |
|
161 | 161 | title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1, |
|
162 | 162 | dt2, |
|
163 | 163 | len(x)) |
|
164 | 164 | self.titles[0] = title |
|
165 | 165 | |
|
166 | 166 | |
|
167 | 167 | class GenericRTIPlot(Plot): |
|
168 | 168 | ''' |
|
169 | 169 | Plot for data_xxxx object |
|
170 | 170 | ''' |
|
171 | 171 | |
|
172 | 172 | CODE = 'param' |
|
173 | 173 | colormap = 'viridis' |
|
174 | 174 | plot_type = 'pcolorbuffer' |
|
175 | 175 | |
|
176 | 176 | def setup(self): |
|
177 | 177 | self.xaxis = 'time' |
|
178 | 178 | self.ncols = 1 |
|
179 | 179 | self.nrows = self.data.shape('param')[0] |
|
180 | 180 | self.nplots = self.nrows |
|
181 | 181 | self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95, 'top': 0.95}) |
|
182 | 182 | |
|
183 | 183 | if not self.xlabel: |
|
184 | 184 | self.xlabel = 'Time' |
|
185 | 185 | |
|
186 | 186 | self.ylabel = 'Range [km]' |
|
187 | 187 | if not self.titles: |
|
188 | 188 | self.titles = ['Param {}'.format(x) for x in range(self.nrows)] |
|
189 | 189 | |
|
190 | 190 | def update(self, dataOut): |
|
191 | 191 | |
|
192 | 192 | data = { |
|
193 | 193 | 'param' : numpy.concatenate([getattr(dataOut, attr) for attr in self.attr_data], axis=0) |
|
194 | 194 | } |
|
195 | 195 | |
|
196 | 196 | meta = {} |
|
197 | 197 | |
|
198 | 198 | return data, meta |
|
199 | 199 | |
|
200 | 200 | def plot(self): |
|
201 | 201 | # self.data.normalize_heights() |
|
202 | 202 | self.x = self.data.times |
|
203 | 203 | self.y = self.data.yrange |
|
204 | 204 | self.z = self.data['param'] |
|
205 | 205 | self.z = 10*numpy.log10(self.z) |
|
206 | 206 | self.z = numpy.ma.masked_invalid(self.z) |
|
207 | 207 | |
|
208 | 208 | if self.decimation is None: |
|
209 | 209 | x, y, z = self.fill_gaps(self.x, self.y, self.z) |
|
210 | 210 | else: |
|
211 | 211 | x, y, z = self.fill_gaps(*self.decimate()) |
|
212 | 212 | |
|
213 | 213 | for n, ax in enumerate(self.axes): |
|
214 | 214 | |
|
215 | 215 | self.zmax = self.zmax if self.zmax is not None else numpy.max( |
|
216 | 216 | self.z[n]) |
|
217 | 217 | self.zmin = self.zmin if self.zmin is not None else numpy.min( |
|
218 | 218 | self.z[n]) |
|
219 | 219 | |
|
220 | 220 | if ax.firsttime: |
|
221 | 221 | if self.zlimits is not None: |
|
222 | 222 | self.zmin, self.zmax = self.zlimits[n] |
|
223 | 223 | |
|
224 | 224 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
225 | 225 | vmin=self.zmin, |
|
226 | 226 | vmax=self.zmax, |
|
227 | 227 | cmap=self.cmaps[n] |
|
228 | 228 | ) |
|
229 | 229 | else: |
|
230 | 230 | if self.zlimits is not None: |
|
231 | 231 | self.zmin, self.zmax = self.zlimits[n] |
|
232 | 232 | ax.collections.remove(ax.collections[0]) |
|
233 | 233 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
234 | 234 | vmin=self.zmin, |
|
235 | 235 | vmax=self.zmax, |
|
236 | 236 | cmap=self.cmaps[n] |
|
237 | 237 | ) |
|
238 | 238 | |
|
239 | 239 | |
|
240 | 240 | class PolarMapPlot(Plot): |
|
241 | 241 | ''' |
|
242 | 242 | Plot for weather radar |
|
243 | 243 | ''' |
|
244 | 244 | |
|
245 | 245 | CODE = 'param' |
|
246 | 246 | colormap = 'seismic' |
|
247 | 247 | |
|
248 | 248 | def setup(self): |
|
249 | 249 | self.ncols = 1 |
|
250 | 250 | self.nrows = 1 |
|
251 | 251 | self.width = 9 |
|
252 | 252 | self.height = 8 |
|
253 | 253 | self.mode = self.data.meta['mode'] |
|
254 | 254 | if self.channels is not None: |
|
255 | 255 | self.nplots = len(self.channels) |
|
256 | 256 | self.nrows = len(self.channels) |
|
257 | 257 | else: |
|
258 | 258 | self.nplots = self.data.shape(self.CODE)[0] |
|
259 | 259 | self.nrows = self.nplots |
|
260 | 260 | self.channels = list(range(self.nplots)) |
|
261 | 261 | if self.mode == 'E': |
|
262 | 262 | self.xlabel = 'Longitude' |
|
263 | 263 | self.ylabel = 'Latitude' |
|
264 | 264 | else: |
|
265 | 265 | self.xlabel = 'Range (km)' |
|
266 | 266 | self.ylabel = 'Height (km)' |
|
267 | 267 | self.bgcolor = 'white' |
|
268 | 268 | self.cb_labels = self.data.meta['units'] |
|
269 | 269 | self.lat = self.data.meta['latitude'] |
|
270 | 270 | self.lon = self.data.meta['longitude'] |
|
271 | 271 | self.xmin, self.xmax = float( |
|
272 | 272 | km2deg(self.xmin) + self.lon), float(km2deg(self.xmax) + self.lon) |
|
273 | 273 | self.ymin, self.ymax = float( |
|
274 | 274 | km2deg(self.ymin) + self.lat), float(km2deg(self.ymax) + self.lat) |
|
275 | 275 | # self.polar = True |
|
276 | 276 | |
|
277 | 277 | def plot(self): |
|
278 | 278 | |
|
279 | 279 | for n, ax in enumerate(self.axes): |
|
280 | 280 | data = self.data['param'][self.channels[n]] |
|
281 | 281 | |
|
282 | 282 | zeniths = numpy.linspace( |
|
283 | 283 | 0, self.data.meta['max_range'], data.shape[1]) |
|
284 | 284 | if self.mode == 'E': |
|
285 | 285 | azimuths = -numpy.radians(self.data.yrange)+numpy.pi/2 |
|
286 | 286 | r, theta = numpy.meshgrid(zeniths, azimuths) |
|
287 | 287 | x, y = r*numpy.cos(theta)*numpy.cos(numpy.radians(self.data.meta['elevation'])), r*numpy.sin( |
|
288 | 288 | theta)*numpy.cos(numpy.radians(self.data.meta['elevation'])) |
|
289 | 289 | x = km2deg(x) + self.lon |
|
290 | 290 | y = km2deg(y) + self.lat |
|
291 | 291 | else: |
|
292 | 292 | azimuths = numpy.radians(self.data.yrange) |
|
293 | 293 | r, theta = numpy.meshgrid(zeniths, azimuths) |
|
294 | 294 | x, y = r*numpy.cos(theta), r*numpy.sin(theta) |
|
295 | 295 | self.y = zeniths |
|
296 | 296 | |
|
297 | 297 | if ax.firsttime: |
|
298 | 298 | if self.zlimits is not None: |
|
299 | 299 | self.zmin, self.zmax = self.zlimits[n] |
|
300 | 300 | ax.plt = ax.pcolormesh( # r, theta, numpy.ma.array(data, mask=numpy.isnan(data)), |
|
301 | 301 | x, y, numpy.ma.array(data, mask=numpy.isnan(data)), |
|
302 | 302 | vmin=self.zmin, |
|
303 | 303 | vmax=self.zmax, |
|
304 | 304 | cmap=self.cmaps[n]) |
|
305 | 305 | else: |
|
306 | 306 | if self.zlimits is not None: |
|
307 | 307 | self.zmin, self.zmax = self.zlimits[n] |
|
308 | 308 | ax.collections.remove(ax.collections[0]) |
|
309 | 309 | ax.plt = ax.pcolormesh( # r, theta, numpy.ma.array(data, mask=numpy.isnan(data)), |
|
310 | 310 | x, y, numpy.ma.array(data, mask=numpy.isnan(data)), |
|
311 | 311 | vmin=self.zmin, |
|
312 | 312 | vmax=self.zmax, |
|
313 | 313 | cmap=self.cmaps[n]) |
|
314 | 314 | |
|
315 | 315 | if self.mode == 'A': |
|
316 | 316 | continue |
|
317 | 317 | |
|
318 | 318 | # plot district names |
|
319 | 319 | f = open('/data/workspace/schain_scripts/distrito.csv') |
|
320 | 320 | for line in f: |
|
321 | 321 | label, lon, lat = [s.strip() for s in line.split(',') if s] |
|
322 | 322 | lat = float(lat) |
|
323 | 323 | lon = float(lon) |
|
324 | 324 | # ax.plot(lon, lat, '.b', ms=2) |
|
325 | 325 | ax.text(lon, lat, label.decode('utf8'), ha='center', |
|
326 | 326 | va='bottom', size='8', color='black') |
|
327 | 327 | |
|
328 | 328 | # plot limites |
|
329 | 329 | limites = [] |
|
330 | 330 | tmp = [] |
|
331 | 331 | for line in open('/data/workspace/schain_scripts/lima.csv'): |
|
332 | 332 | if '#' in line: |
|
333 | 333 | if tmp: |
|
334 | 334 | limites.append(tmp) |
|
335 | 335 | tmp = [] |
|
336 | 336 | continue |
|
337 | 337 | values = line.strip().split(',') |
|
338 | 338 | tmp.append((float(values[0]), float(values[1]))) |
|
339 | 339 | for points in limites: |
|
340 | 340 | ax.add_patch( |
|
341 | 341 | Polygon(points, ec='k', fc='none', ls='--', lw=0.5)) |
|
342 | 342 | |
|
343 | 343 | # plot Cuencas |
|
344 | 344 | for cuenca in ('rimac', 'lurin', 'mala', 'chillon', 'chilca', 'chancay-huaral'): |
|
345 | 345 | f = open('/data/workspace/schain_scripts/{}.csv'.format(cuenca)) |
|
346 | 346 | values = [line.strip().split(',') for line in f] |
|
347 | 347 | points = [(float(s[0]), float(s[1])) for s in values] |
|
348 | 348 | ax.add_patch(Polygon(points, ec='b', fc='none')) |
|
349 | 349 | |
|
350 | 350 | # plot grid |
|
351 | 351 | for r in (15, 30, 45, 60): |
|
352 | 352 | ax.add_artist(plt.Circle((self.lon, self.lat), |
|
353 | 353 | km2deg(r), color='0.6', fill=False, lw=0.2)) |
|
354 | 354 | ax.text( |
|
355 | 355 | self.lon + (km2deg(r))*numpy.cos(60*numpy.pi/180), |
|
356 | 356 | self.lat + (km2deg(r))*numpy.sin(60*numpy.pi/180), |
|
357 | 357 | '{}km'.format(r), |
|
358 | 358 | ha='center', va='bottom', size='8', color='0.6', weight='heavy') |
|
359 | 359 | |
|
360 | 360 | if self.mode == 'E': |
|
361 | 361 | title = 'El={}$^\circ$'.format(self.data.meta['elevation']) |
|
362 | 362 | label = 'E{:02d}'.format(int(self.data.meta['elevation'])) |
|
363 | 363 | else: |
|
364 | 364 | title = 'Az={}$^\circ$'.format(self.data.meta['azimuth']) |
|
365 | 365 | label = 'A{:02d}'.format(int(self.data.meta['azimuth'])) |
|
366 | 366 | |
|
367 | 367 | self.save_labels = ['{}-{}'.format(lbl, label) for lbl in self.labels] |
|
368 | 368 | self.titles = ['{} {}'.format( |
|
369 | 369 | self.data.parameters[x], title) for x in self.channels] |
|
370 | 370 | |
|
371 | 371 | class WeatherPlot(Plot): |
|
372 | 372 | CODE = 'weather' |
|
373 | 373 | plot_name = 'weather' |
|
374 | 374 | plot_type = 'ppistyle' |
|
375 | 375 | buffering = False |
|
376 | 376 | |
|
377 | 377 | def setup(self): |
|
378 | 378 | self.ncols = 1 |
|
379 | 379 | self.nrows = 1 |
|
380 | 380 | self.nplots= 1 |
|
381 | 381 | self.ylabel= 'Range [Km]' |
|
382 | 382 | self.titles= ['Weather'] |
|
383 | 383 | self.colorbar=False |
|
384 | 384 | self.width =8 |
|
385 | 385 | self.height =8 |
|
386 | 386 | self.ini =0 |
|
387 | 387 | self.len_azi =0 |
|
388 | 388 | self.buffer_ini = None |
|
389 | 389 | self.buffer_azi = None |
|
390 | 390 | self.plots_adjust.update({'wspace': 0.4, 'hspace':0.4, 'left': 0.1, 'right': 0.9, 'bottom': 0.08}) |
|
391 | 391 | self.flag =0 |
|
392 | 392 | self.indicador= 0 |
|
393 | 393 | |
|
394 | 394 | def update(self, dataOut): |
|
395 | 395 | |
|
396 | 396 | data = {} |
|
397 | 397 | meta = {} |
|
398 | data['weather'] = 10*numpy.log10(dataOut.data_360[0]/(250.0)) | |
|
398 | if hasattr(dataOut, 'dataPP_POWER'): | |
|
399 | factor = 1 | |
|
400 | ||
|
401 | if hasattr(dataOut, 'nFFTPoints'): | |
|
402 | factor = dataOut.normFactor | |
|
403 | ||
|
404 | print("factor",factor) | |
|
405 | data['weather'] = 10*numpy.log10(dataOut.data_360[0]/(factor)) | |
|
406 | print("weather",data['weather']) | |
|
399 | 407 | data['azi'] = dataOut.data_azi |
|
400 | 408 | return data, meta |
|
401 | 409 | |
|
402 | 410 | def const_ploteo(self,data_weather,data_azi,step,res): |
|
403 | 411 | if self.ini==0: |
|
404 | 412 | #------- AZIMUTH |
|
405 | 413 | n = (360/res)-len(data_azi) |
|
406 | 414 | start = data_azi[-1] + res |
|
407 | 415 | end = data_azi[0] - res |
|
408 | 416 | if start>end: |
|
409 | 417 | end = end + 360 |
|
410 | 418 | azi_vacia = numpy.linspace(start,end,int(n)) |
|
411 | 419 | azi_vacia = numpy.where(azi_vacia>360,azi_vacia-360,azi_vacia) |
|
412 | 420 | data_azi = numpy.hstack((data_azi,azi_vacia)) |
|
413 | 421 | # RADAR |
|
414 | 422 | val_mean = numpy.mean(data_weather[:,0]) |
|
415 | 423 | data_weather_cmp = numpy.ones([(360-data_weather.shape[0]),data_weather.shape[1]])*val_mean |
|
416 | 424 | data_weather = numpy.vstack((data_weather,data_weather_cmp)) |
|
417 | 425 | else: |
|
418 | 426 | # azimuth |
|
419 | 427 | flag=0 |
|
420 | 428 | start_azi = self.res_azi[0] |
|
421 | 429 | start = data_azi[0] |
|
422 | 430 | end = data_azi[-1] |
|
423 | 431 | print("start",start) |
|
424 | 432 | print("end",end) |
|
425 | 433 | if start< start_azi: |
|
426 | 434 | start = start +360 |
|
427 | 435 | if end <start_azi: |
|
428 | 436 | end = end +360 |
|
429 | 437 | |
|
430 | 438 | print("start",start) |
|
431 | 439 | print("end",end) |
|
432 | 440 | #### AQUI SERA LA MAGIA |
|
433 | 441 | pos_ini = int((start-start_azi)/res) |
|
434 | 442 | len_azi = len(data_azi) |
|
435 | 443 | if (360-pos_ini)<len_azi: |
|
436 | 444 | if pos_ini+1==360: |
|
437 | 445 | pos_ini=0 |
|
438 | 446 | else: |
|
439 | 447 | flag=1 |
|
440 | 448 | dif= 360-pos_ini |
|
441 | 449 | comp= len_azi-dif |
|
442 | 450 | |
|
443 | 451 | print(pos_ini) |
|
444 | 452 | print(len_azi) |
|
445 | 453 | print("shape",self.res_azi.shape) |
|
446 | 454 | if flag==0: |
|
447 | 455 | # AZIMUTH |
|
448 | 456 | self.res_azi[pos_ini:pos_ini+len_azi] = data_azi |
|
449 | 457 | # RADAR |
|
450 | 458 | self.res_weather[pos_ini:pos_ini+len_azi,:] = data_weather |
|
451 | 459 | else: |
|
452 | 460 | # AZIMUTH |
|
453 | 461 | self.res_azi[pos_ini:pos_ini+dif] = data_azi[0:dif] |
|
454 | 462 | self.res_azi[0:comp] = data_azi[dif:] |
|
455 | 463 | # RADAR |
|
456 | 464 | self.res_weather[pos_ini:pos_ini+dif,:] = data_weather[0:dif,:] |
|
457 | 465 | self.res_weather[0:comp,:] = data_weather[dif:,:] |
|
458 | 466 | flag=0 |
|
459 | 467 | data_azi = self.res_azi |
|
460 | 468 | data_weather = self.res_weather |
|
461 | 469 | |
|
462 | 470 | return data_weather,data_azi |
|
463 | 471 | |
|
464 | 472 | def plot(self): |
|
465 | 473 | print("--------------------------------------",self.ini,"-----------------------------------") |
|
466 | 474 | #numpy.set_printoptions(suppress=True) |
|
467 | 475 | #print(self.data.times) |
|
468 | 476 | thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1]) |
|
469 | 477 | data = self.data[-1] |
|
470 | 478 | # ALTURA altura_tmp_h |
|
471 | 479 | altura_h = (data['weather'].shape[1])/10.0 |
|
472 | 480 | stoprange = float(altura_h*1.5)#stoprange = float(33*1.5) por ahora 400 |
|
473 | 481 | rangestep = float(0.15) |
|
474 | 482 | r = numpy.arange(0, stoprange, rangestep) |
|
475 | 483 | self.y = 2*r |
|
476 | 484 | # RADAR |
|
477 | 485 | #data_weather = data['weather'] |
|
478 | 486 | # PEDESTAL |
|
479 | 487 | #data_azi = data['azi'] |
|
480 | 488 | res = 1 |
|
481 | 489 | # STEP |
|
482 | 490 | step = (360/(res*data['weather'].shape[0])) |
|
483 | 491 | #print("shape wr_data", wr_data.shape) |
|
484 | 492 | #print("shape wr_azi",wr_azi.shape) |
|
485 | 493 | #print("step",step) |
|
486 | 494 | print("Time---->",self.data.times[-1],thisDatetime) |
|
487 | 495 | #print("alturas", len(self.y)) |
|
488 | 496 | self.res_weather, self.res_azi = self.const_ploteo(data_weather=data['weather'],data_azi=data['azi'],step=step,res=res) |
|
489 | 497 | #numpy.set_printoptions(suppress=True) |
|
490 | 498 | #print("resultado",self.res_azi) |
|
491 | 499 | ########################################################## |
|
492 | 500 | ################# PLOTEO ################### |
|
493 | 501 | ########################################################## |
|
494 | 502 | |
|
495 | 503 | for i,ax in enumerate(self.axes): |
|
496 | 504 | if ax.firsttime: |
|
497 | 505 | plt.clf() |
|
498 | 506 | cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin=1, vmax=60) |
|
499 | 507 | else: |
|
500 | 508 | plt.clf() |
|
501 |
cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin= |
|
|
509 | cgax, pm = wrl.vis.plot_ppi(self.res_weather,r=r,az=self.res_azi,fig=self.figures[0], proj='cg', vmin=1, vmax=60) | |
|
502 | 510 | caax = cgax.parasites[0] |
|
503 | 511 | paax = cgax.parasites[1] |
|
504 | 512 | cbar = plt.gcf().colorbar(pm, pad=0.075) |
|
505 | 513 | caax.set_xlabel('x_range [km]') |
|
506 | 514 | caax.set_ylabel('y_range [km]') |
|
507 | 515 | plt.text(1.0, 1.05, 'azimuth '+str(thisDatetime)+"step"+str(self.ini), transform=caax.transAxes, va='bottom',ha='right') |
|
508 | 516 | |
|
509 | 517 | self.ini= self.ini+1 |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file |
@@ -1,216 +1,216 | |||
|
1 | 1 | # Ing. AVP |
|
2 | 2 | # 06/10/2021 |
|
3 | 3 | # ARCHIVO DE LECTURA |
|
4 | 4 | import os, sys |
|
5 | 5 | import datetime |
|
6 | 6 | import time |
|
7 | 7 | from schainpy.controller import Project |
|
8 | 8 | #### NOTA########################################### |
|
9 | 9 | # INPUT : |
|
10 | 10 | # VELOCIDAD PARAMETRO : V = 2Β°/seg |
|
11 | 11 | # MODO PULSE PAIR O MOMENTOS: 0 : Pulse Pair ,1 : Momentos |
|
12 | 12 | ###################################################### |
|
13 | 13 | ##### PROCESAMIENTO ################################## |
|
14 | 14 | ##### OJO TENER EN CUENTA EL n= para el Pulse Pair ## |
|
15 | 15 | ##### O EL n= nFFTPoints ### |
|
16 | 16 | ###################################################### |
|
17 | 17 | ######## BUSCAMOS EL numero de IPP equivalente 1Β°##### |
|
18 | 18 | ######## Sea V la velocidad del Pedestal en Β°/seg##### |
|
19 | 19 | ######## 1Β° sera Recorrido en un tiempo de 1/V ###### |
|
20 | 20 | ######## IPP del Radar 400 useg --> 60 Km ############ |
|
21 | 21 | ######## n = 1/(V(Β°/seg)*IPP(Km)) , NUMERO DE IPP ## |
|
22 | 22 | ######## n = 1/(V*IPP) ############################# |
|
23 | 23 | ######## VELOCIDAD DEL PEDESTAL ###################### |
|
24 | 24 | print("SETUP- RADAR METEOROLOGICO") |
|
25 | 25 | V = 10 |
|
26 | 26 | mode = 1 |
|
27 | 27 | #path = '/DATA_RM/23/6v' |
|
28 | 28 | ####path = '/DATA_RM/TEST_INTEGRACION_2M' |
|
29 | 29 | #path = '/DATA_RM/TEST_19OCTUBRE/10MHZ' |
|
30 | 30 | path = '/DATA_RM/WR_20_OCT' |
|
31 | 31 | #### path_ped='/DATA_RM/TEST_PEDESTAL/P20211012-082745' |
|
32 | 32 |
#### |
|
33 | 33 | figpath_pp = "/home/soporte/Pictures/TEST_PP" |
|
34 | 34 | figpath_spec = "/home/soporte/Pictures/TEST_MOM" |
|
35 |
plot = |
|
|
36 |
integration = |
|
|
35 | plot = 0 | |
|
36 | integration = 1 | |
|
37 | 37 | save = 0 |
|
38 | 38 | if save == 1: |
|
39 | 39 | if mode==0: |
|
40 | 40 | path_save = '/DATA_RM/TEST_HDF5_PP_23/6v' |
|
41 | 41 | path_save = '/DATA_RM/TEST_HDF5_PP' |
|
42 | 42 | path_save = '/DATA_RM/TEST_HDF5_PP_100' |
|
43 | 43 | else: |
|
44 | 44 | path_save = '/DATA_RM/TEST_HDF5_SPEC_23_V2/6v' |
|
45 | 45 | |
|
46 | 46 | print("* PATH data ADQ :", path) |
|
47 | 47 | print("* Velocidad Pedestal :",V,"Β°/seg") |
|
48 | 48 | ############################ NRO Perfiles PROCESAMIENTO ################### |
|
49 | 49 | V=V |
|
50 | 50 | IPP=400*1e-6 |
|
51 | 51 | n= int(1/(V*IPP)) |
|
52 | 52 | print("* n - NRO Perfiles Proc:", n ) |
|
53 | 53 | ################################## MODE ################################### |
|
54 | 54 | print("* Modo de Operacion :",mode) |
|
55 | 55 | if mode ==0: |
|
56 | 56 | print("* Met. Seleccionado : Pulse Pair") |
|
57 | 57 | else: |
|
58 | 58 | print("* Met. Momentos : Momentos") |
|
59 | 59 | |
|
60 | 60 | ################################## MODE ################################### |
|
61 | 61 | print("* Grabado de datos :",save) |
|
62 | 62 | if save ==1: |
|
63 | 63 | if mode==0: |
|
64 | 64 | ope= "Pulse Pair" |
|
65 | 65 | else: |
|
66 | 66 | ope= "Momentos" |
|
67 | 67 | print("* Path-Save Data -", ope , path_save) |
|
68 | 68 | |
|
69 | 69 | print("* Integracion de datos :",integration) |
|
70 | 70 | |
|
71 | 71 | time.sleep(15) |
|
72 | 72 | #remotefolder = "/home/wmaster/graficos" |
|
73 | 73 | ####################################################################### |
|
74 | 74 | ################# RANGO DE PLOTEO###################################### |
|
75 | 75 | dBmin = '1' |
|
76 | 76 | dBmax = '65' |
|
77 | 77 | xmin = '13.2' |
|
78 | 78 | xmax = '13.5' |
|
79 | 79 | ymin = '0' |
|
80 | 80 | ymax = '60' |
|
81 | 81 | ####################################################################### |
|
82 | 82 | ########################FECHA########################################## |
|
83 | 83 | str = datetime.date.today() |
|
84 | 84 | today = str.strftime("%Y/%m/%d") |
|
85 | 85 | str2 = str - datetime.timedelta(days=1) |
|
86 | 86 | yesterday = str2.strftime("%Y/%m/%d") |
|
87 | 87 | ####################################################################### |
|
88 | 88 | ########################SIGNAL CHAIN ################################## |
|
89 | 89 | ####################################################################### |
|
90 | 90 | desc = "USRP_test" |
|
91 | 91 | filename = "USRP_processing.xml" |
|
92 | 92 | controllerObj = Project() |
|
93 | 93 | controllerObj.setup(id = '191', name='Test_USRP', description=desc) |
|
94 | 94 | ####################################################################### |
|
95 | 95 | ######################## UNIDAD DE LECTURA############################# |
|
96 | 96 | ####################################################################### |
|
97 | 97 | readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader', |
|
98 | 98 | path=path, |
|
99 | 99 | startDate="2021/01/01",#today, |
|
100 | 100 | endDate="2021/12/30",#today, |
|
101 | 101 | startTime='00:00:00', |
|
102 | 102 | endTime='23:59:59', |
|
103 | 103 | delay=0, |
|
104 | 104 | #set=0, |
|
105 | 105 | online=0, |
|
106 | 106 | walk=1, |
|
107 | 107 | ippKm = 60) |
|
108 | 108 | |
|
109 | 109 | opObj11 = readUnitConfObj.addOperation(name='printInfo') |
|
110 | 110 | |
|
111 | 111 | procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) |
|
112 | 112 | |
|
113 | 113 | if mode ==0: |
|
114 | 114 | ####################### METODO PULSE PAIR ###################################################################### |
|
115 | 115 | opObj11 = procUnitConfObjA.addOperation(name='PulsePair', optype='other') |
|
116 | 116 | opObj11.addParameter(name='n', value=int(n), format='int')#10 VOY A USAR 250 DADO QUE LA VELOCIDAD ES 10 GRADOS |
|
117 | 117 | #opObj11.addParameter(name='removeDC', value=1, format='int') |
|
118 | 118 | ####################### METODO Parametros ###################################################################### |
|
119 | 119 | procUnitConfObjB= controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjA.getId()) |
|
120 | 120 | if plot==1: |
|
121 | 121 | opObj11 = procUnitConfObjB.addOperation(name='GenericRTIPlot',optype='external') |
|
122 | 122 | opObj11.addParameter(name='attr_data', value='dataPP_POWER') |
|
123 | 123 | opObj11.addParameter(name='colormap', value='jet') |
|
124 | 124 | opObj11.addParameter(name='xmin', value=xmin) |
|
125 | 125 | opObj11.addParameter(name='xmax', value=xmax) |
|
126 | 126 | opObj11.addParameter(name='zmin', value=dBmin) |
|
127 | 127 | opObj11.addParameter(name='zmax', value=dBmax) |
|
128 | 128 | opObj11.addParameter(name='save', value=figpath_pp) |
|
129 | 129 | opObj11.addParameter(name='showprofile', value=0) |
|
130 | 130 | opObj11.addParameter(name='save_period', value=10) |
|
131 | 131 | |
|
132 | 132 | ####################### METODO ESCRITURA ####################################################################### |
|
133 | 133 | if save==1: |
|
134 | 134 | opObj10 = procUnitConfObjB.addOperation(name='HDFWriter') |
|
135 | 135 | opObj10.addParameter(name='path',value=path_save) |
|
136 | 136 | #opObj10.addParameter(name='mode',value=0) |
|
137 | 137 | opObj10.addParameter(name='blocksPerFile',value='100',format='int') |
|
138 | 138 | opObj10.addParameter(name='metadataList',value='utctimeInit,timeZone,paramInterval,profileIndex,channelList,heightList,flagDataAsBlock',format='list') |
|
139 | 139 | opObj10.addParameter(name='dataList',value='dataPP_POWER,dataPP_DOP,utctime',format='list')#,format='list' |
|
140 | 140 | if integration==1: |
|
141 | 141 | V=10 |
|
142 | 142 | blocksPerfile=360 |
|
143 | 143 | print("* Velocidad del Pedestal:",V) |
|
144 | 144 | tmp_blocksPerfile = 100 |
|
145 | 145 | f_a_p= int(tmp_blocksPerfile/V) |
|
146 | 146 | |
|
147 | 147 | opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation') |
|
148 | 148 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
149 | 149 | #opObj11.addParameter(name='path_adq', value=path_adq) |
|
150 | 150 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
151 | 151 | opObj11.addParameter(name='blocksPerfile', value=blocksPerfile, format='int') |
|
152 | 152 | opObj11.addParameter(name='n_Muestras_p', value='100', format='float') |
|
153 | 153 | opObj11.addParameter(name='f_a_p', value=f_a_p, format='int') |
|
154 | 154 | opObj11.addParameter(name='online', value='0', format='int') |
|
155 | 155 | |
|
156 | 156 | opObj11 = procUnitConfObjB.addOperation(name='Block360') |
|
157 | 157 | opObj11.addParameter(name='n', value='10', format='int') |
|
158 | 158 | opObj11.addParameter(name='mode', value=mode, format='int') |
|
159 | 159 | |
|
160 | 160 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
161 | 161 | |
|
162 | 162 | opObj11= procUnitConfObjB.addOperation(name='WeatherPlot',optype='other') |
|
163 | 163 | |
|
164 | 164 | |
|
165 | 165 | else: |
|
166 | 166 | ####################### METODO SPECTROS ###################################################################### |
|
167 | 167 | procUnitConfObjB = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjA.getId()) |
|
168 | 168 | procUnitConfObjB.addParameter(name='nFFTPoints', value=n, format='int') |
|
169 | 169 | procUnitConfObjB.addParameter(name='nProfiles' , value=n, format='int') |
|
170 | 170 | |
|
171 | 171 | procUnitConfObjC = controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjB.getId()) |
|
172 | 172 | procUnitConfObjC.addOperation(name='SpectralMoments') |
|
173 | 173 | if plot==1: |
|
174 | 174 | dBmin = '1' |
|
175 | 175 | dBmax = '65' |
|
176 | 176 | opObj11 = procUnitConfObjC.addOperation(name='PowerPlot',optype='external') |
|
177 | 177 | opObj11.addParameter(name='xmin', value=xmin) |
|
178 | 178 | opObj11.addParameter(name='xmax', value=xmax) |
|
179 | 179 | opObj11.addParameter(name='zmin', value=dBmin) |
|
180 | 180 | opObj11.addParameter(name='zmax', value=dBmax) |
|
181 | 181 | opObj11.addParameter(name='save', value=figpath_spec) |
|
182 | 182 | opObj11.addParameter(name='showprofile', value=0) |
|
183 | 183 | opObj11.addParameter(name='save_period', value=10) |
|
184 | 184 | |
|
185 | 185 | if save==1: |
|
186 | 186 | opObj10 = procUnitConfObjC.addOperation(name='HDFWriter') |
|
187 | 187 | opObj10.addParameter(name='path',value=path_save) |
|
188 | 188 | #opObj10.addParameter(name='mode',value=0) |
|
189 | 189 | opObj10.addParameter(name='blocksPerFile',value='360',format='int') |
|
190 | 190 | #opObj10.addParameter(name='metadataList',value='utctimeInit,heightList,nIncohInt,nCohInt,nProfiles,channelList',format='list')#profileIndex |
|
191 | 191 | opObj10.addParameter(name='metadataList',value='utctimeInit,heightList,nIncohInt,nCohInt,nProfiles,channelList',format='list')#profileIndex |
|
192 | 192 | opObj10.addParameter(name='dataList',value='data_pow,data_dop,utctime',format='list')#,format='list' |
|
193 | 193 | |
|
194 | 194 | if integration==1: |
|
195 | 195 | V=10 |
|
196 | 196 | blocksPerfile=360 |
|
197 | 197 | print("* Velocidad del Pedestal:",V) |
|
198 | 198 | tmp_blocksPerfile = 100 |
|
199 | 199 | f_a_p= int(tmp_blocksPerfile/V) |
|
200 | 200 | |
|
201 | 201 | opObj11 = procUnitConfObjC.addOperation(name='PedestalInformation') |
|
202 | 202 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
203 | 203 | #opObj11.addParameter(name='path_adq', value=path_adq) |
|
204 | 204 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
205 | 205 | opObj11.addParameter(name='blocksPerfile', value=blocksPerfile, format='int') |
|
206 | 206 | opObj11.addParameter(name='n_Muestras_p', value='100', format='float') |
|
207 | 207 | opObj11.addParameter(name='f_a_p', value=f_a_p, format='int') |
|
208 | 208 | opObj11.addParameter(name='online', value='0', format='int') |
|
209 | 209 | |
|
210 | 210 | opObj11 = procUnitConfObjC.addOperation(name='Block360') |
|
211 | 211 | opObj11.addParameter(name='n', value='10', format='int') |
|
212 | 212 | opObj11.addParameter(name='mode', value=mode, format='int') |
|
213 | 213 | |
|
214 | 214 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
215 | 215 | opObj11= procUnitConfObjC.addOperation(name='WeatherPlot',optype='other') |
|
216 | 216 | controllerObj.start() |
@@ -1,217 +1,217 | |||
|
1 | 1 | # Ing. AVP |
|
2 | 2 | # 06/10/2021 |
|
3 | 3 | # ARCHIVO DE LECTURA |
|
4 | 4 | import os, sys |
|
5 | 5 | import datetime |
|
6 | 6 | import time |
|
7 | 7 | from schainpy.controller import Project |
|
8 | 8 | #### NOTA########################################### |
|
9 | 9 | # INPUT : |
|
10 | 10 | # VELOCIDAD PARAMETRO : V = 2Β°/seg |
|
11 | 11 | # MODO PULSE PAIR O MOMENTOS: 0 : Pulse Pair ,1 : Momentos |
|
12 | 12 | ###################################################### |
|
13 | 13 | ##### PROCESAMIENTO ################################## |
|
14 | 14 | ##### OJO TENER EN CUENTA EL n= para el Pulse Pair ## |
|
15 | 15 | ##### O EL n= nFFTPoints ### |
|
16 | 16 | ###################################################### |
|
17 | 17 | ######## BUSCAMOS EL numero de IPP equivalente 1Β°##### |
|
18 | 18 | ######## Sea V la velocidad del Pedestal en Β°/seg##### |
|
19 | 19 | ######## 1Β° sera Recorrido en un tiempo de 1/V ###### |
|
20 | 20 | ######## IPP del Radar 400 useg --> 60 Km ############ |
|
21 | 21 | ######## n = 1/(V(Β°/seg)*IPP(Km)) , NUMERO DE IPP ## |
|
22 | 22 | ######## n = 1/(V*IPP) ############################# |
|
23 | 23 | ######## VELOCIDAD DEL PEDESTAL ###################### |
|
24 | 24 | print("SETUP- RADAR METEOROLOGICO") |
|
25 | 25 | V = 10 |
|
26 | 26 | mode = 1 |
|
27 | 27 | #path = '/DATA_RM/23/6v' |
|
28 | 28 | #path = '/DATA_RM/TEST_INTEGRACION_2M' |
|
29 | 29 | path = '/DATA_RM/WR_20_OCT' |
|
30 | 30 | |
|
31 | 31 | #path_ped='/DATA_RM/TEST_PEDESTAL/P20211012-082745' |
|
32 | 32 | path_ped='/DATA_RM/TEST_PEDESTAL/P20211020-131248' |
|
33 | 33 | |
|
34 | 34 | figpath_pp = "/home/soporte/Pictures/TEST_PP" |
|
35 | 35 | figpath_mom = "/home/soporte/Pictures/TEST_MOM" |
|
36 | 36 | plot = 0 |
|
37 | 37 | integration = 1 |
|
38 | 38 | save = 0 |
|
39 | 39 | if save == 1: |
|
40 | 40 | if mode==0: |
|
41 | 41 | path_save = '/DATA_RM/TEST_HDF5_PP_23/6v' |
|
42 | 42 | path_save = '/DATA_RM/TEST_HDF5_PP' |
|
43 | 43 | path_save = '/DATA_RM/TEST_HDF5_PP_100' |
|
44 | 44 | else: |
|
45 | 45 | path_save = '/DATA_RM/TEST_HDF5_SPEC_23_V2/6v' |
|
46 | 46 | |
|
47 | 47 | print("* PATH data ADQ :", path) |
|
48 | 48 | print("* Velocidad Pedestal :",V,"Β°/seg") |
|
49 | 49 | ############################ NRO Perfiles PROCESAMIENTO ################### |
|
50 | 50 | V=V |
|
51 | 51 | IPP=400*1e-6 |
|
52 | 52 | n= int(1/(V*IPP)) |
|
53 | 53 | print("* n - NRO Perfiles Proc:", n ) |
|
54 | 54 | ################################## MODE ################################### |
|
55 | 55 | print("* Modo de Operacion :",mode) |
|
56 | 56 | if mode ==0: |
|
57 | 57 | print("* Met. Seleccionado : Pulse Pair") |
|
58 | 58 | else: |
|
59 | 59 | print("* Met. Momentos : Momentos") |
|
60 | 60 | |
|
61 | 61 | ################################## MODE ################################### |
|
62 | 62 | print("* Grabado de datos :",save) |
|
63 | 63 | if save ==1: |
|
64 | 64 | if mode==0: |
|
65 | 65 | ope= "Pulse Pair" |
|
66 | 66 | else: |
|
67 | 67 | ope= "Momentos" |
|
68 | 68 | print("* Path-Save Data -", ope , path_save) |
|
69 | 69 | |
|
70 | 70 | print("* Integracion de datos :",integration) |
|
71 | 71 | |
|
72 |
time.sleep( |
|
|
72 | time.sleep(5) | |
|
73 | 73 | #remotefolder = "/home/wmaster/graficos" |
|
74 | 74 | ####################################################################### |
|
75 | 75 | ################# RANGO DE PLOTEO###################################### |
|
76 | 76 | dBmin = '1' |
|
77 | 77 | dBmax = '85' |
|
78 | 78 | xmin = '15' |
|
79 | 79 | xmax = '15.25' |
|
80 | 80 | ymin = '0' |
|
81 | 81 | ymax = '600' |
|
82 | 82 | ####################################################################### |
|
83 | 83 | ########################FECHA########################################## |
|
84 | 84 | str = datetime.date.today() |
|
85 | 85 | today = str.strftime("%Y/%m/%d") |
|
86 | 86 | str2 = str - datetime.timedelta(days=1) |
|
87 | 87 | yesterday = str2.strftime("%Y/%m/%d") |
|
88 | 88 | ####################################################################### |
|
89 | 89 | ########################SIGNAL CHAIN ################################## |
|
90 | 90 | ####################################################################### |
|
91 | 91 | desc = "USRP_test" |
|
92 | 92 | filename = "USRP_processing.xml" |
|
93 | 93 | controllerObj = Project() |
|
94 | 94 | controllerObj.setup(id = '191', name='Test_USRP', description=desc) |
|
95 | 95 | ####################################################################### |
|
96 | 96 | ######################## UNIDAD DE LECTURA############################# |
|
97 | 97 | ####################################################################### |
|
98 | 98 | readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader', |
|
99 | 99 | path=path, |
|
100 | 100 | startDate="2021/01/01",#today, |
|
101 | 101 | endDate="2021/12/30",#today, |
|
102 | 102 | startTime='00:00:00', |
|
103 | 103 | endTime='23:59:59', |
|
104 | 104 | delay=0, |
|
105 | 105 | #set=0, |
|
106 | 106 | online=0, |
|
107 | 107 | walk=1, |
|
108 | 108 | ippKm = 60) |
|
109 | 109 | |
|
110 | 110 | opObj11 = readUnitConfObj.addOperation(name='printInfo') |
|
111 | 111 | |
|
112 | 112 | procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) |
|
113 | 113 | |
|
114 | 114 | if mode ==0: |
|
115 | 115 | ####################### METODO PULSE PAIR ###################################################################### |
|
116 | 116 | opObj11 = procUnitConfObjA.addOperation(name='PulsePair', optype='other') |
|
117 | 117 | opObj11.addParameter(name='n', value=int(n), format='int')#10 VOY A USAR 250 DADO QUE LA VELOCIDAD ES 10 GRADOS |
|
118 | 118 | #opObj11.addParameter(name='removeDC', value=1, format='int') |
|
119 | 119 | ####################### METODO Parametros ###################################################################### |
|
120 | 120 | procUnitConfObjB= controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjA.getId()) |
|
121 | 121 | if plot==1: |
|
122 | 122 | opObj11 = procUnitConfObjB.addOperation(name='GenericRTIPlot',optype='external') |
|
123 | 123 | opObj11.addParameter(name='attr_data', value='dataPP_POW') |
|
124 | 124 | opObj11.addParameter(name='colormap', value='jet') |
|
125 | 125 | opObj11.addParameter(name='xmin', value=xmin) |
|
126 | 126 | opObj11.addParameter(name='xmax', value=xmax) |
|
127 | 127 | opObj11.addParameter(name='zmin', value=dBmin) |
|
128 | 128 | opObj11.addParameter(name='zmax', value=dBmax) |
|
129 | 129 | opObj11.addParameter(name='save', value=figpath_pp) |
|
130 | 130 | opObj11.addParameter(name='showprofile', value=0) |
|
131 | 131 | opObj11.addParameter(name='save_period', value=50) |
|
132 | 132 | |
|
133 | 133 | ####################### METODO ESCRITURA ####################################################################### |
|
134 | 134 | if save==1: |
|
135 | 135 | opObj10 = procUnitConfObjB.addOperation(name='HDFWriter') |
|
136 | 136 | opObj10.addParameter(name='path',value=path_save) |
|
137 | 137 | #opObj10.addParameter(name='mode',value=0) |
|
138 | 138 | opObj10.addParameter(name='blocksPerFile',value='100',format='int') |
|
139 | 139 | opObj10.addParameter(name='metadataList',value='utctimeInit,timeZone,paramInterval,profileIndex,channelList,heightList,flagDataAsBlock',format='list') |
|
140 | 140 | opObj10.addParameter(name='dataList',value='dataPP_POW,dataPP_DOP,utctime',format='list')#,format='list' |
|
141 | 141 | if integration==1: |
|
142 | 142 | V=10 |
|
143 | 143 | blocksPerfile=360 |
|
144 | 144 | print("* Velocidad del Pedestal:",V) |
|
145 | 145 | tmp_blocksPerfile = 100 |
|
146 | 146 | f_a_p= int(tmp_blocksPerfile/V) |
|
147 | 147 | |
|
148 | 148 | opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation') |
|
149 | 149 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
150 | 150 | #opObj11.addParameter(name='path_adq', value=path_adq) |
|
151 | 151 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
152 | 152 | opObj11.addParameter(name='blocksPerfile', value=blocksPerfile, format='int') |
|
153 | 153 | opObj11.addParameter(name='n_Muestras_p', value='100', format='float') |
|
154 | 154 | opObj11.addParameter(name='f_a_p', value=f_a_p, format='int') |
|
155 | 155 | opObj11.addParameter(name='online', value='0', format='int') |
|
156 | 156 | |
|
157 | 157 | opObj11 = procUnitConfObjB.addOperation(name='Block360') |
|
158 | 158 | opObj11.addParameter(name='n', value='10', format='int') |
|
159 | 159 | opObj11.addParameter(name='mode', value=mode, format='int') |
|
160 | 160 | |
|
161 | 161 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
162 | 162 | |
|
163 | 163 | opObj11= procUnitConfObjB.addOperation(name='WeatherPlot',optype='other') |
|
164 | 164 | |
|
165 | 165 | |
|
166 | 166 | else: |
|
167 | 167 | ####################### METODO SPECTROS ###################################################################### |
|
168 | 168 | procUnitConfObjB = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjA.getId()) |
|
169 | 169 | procUnitConfObjB.addParameter(name='nFFTPoints', value=n, format='int') |
|
170 | 170 | procUnitConfObjB.addParameter(name='nProfiles' , value=n, format='int') |
|
171 | 171 | |
|
172 | 172 | procUnitConfObjC = controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjB.getId()) |
|
173 | 173 | procUnitConfObjC.addOperation(name='SpectralMoments') |
|
174 | 174 | if plot==1: |
|
175 | 175 | dBmin = '1' |
|
176 | 176 | dBmax = '65' |
|
177 | 177 | opObj11 = procUnitConfObjC.addOperation(name='PowerPlot',optype='external') |
|
178 | 178 | opObj11.addParameter(name='xmin', value=xmin) |
|
179 | 179 | opObj11.addParameter(name='xmax', value=xmax) |
|
180 | 180 | opObj11.addParameter(name='zmin', value=dBmin) |
|
181 | 181 | opObj11.addParameter(name='zmax', value=dBmax) |
|
182 | 182 | opObj11.addParameter(name='save', value=figpath_mom) |
|
183 | 183 | opObj11.addParameter(name='showprofile', value=0) |
|
184 | 184 | opObj11.addParameter(name='save_period', value=100) |
|
185 | 185 | |
|
186 | 186 | if save==1: |
|
187 | 187 | opObj10 = procUnitConfObjC.addOperation(name='HDFWriter') |
|
188 | 188 | opObj10.addParameter(name='path',value=path_save) |
|
189 | 189 | #opObj10.addParameter(name='mode',value=0) |
|
190 | 190 | opObj10.addParameter(name='blocksPerFile',value='360',format='int') |
|
191 | 191 | #opObj10.addParameter(name='metadataList',value='utctimeInit,heightList,nIncohInt,nCohInt,nProfiles,channelList',format='list')#profileIndex |
|
192 | 192 | opObj10.addParameter(name='metadataList',value='utctimeInit,heightList,nIncohInt,nCohInt,nProfiles,channelList',format='list')#profileIndex |
|
193 | 193 | opObj10.addParameter(name='dataList',value='data_pow,data_dop,utctime',format='list')#,format='list' |
|
194 | 194 | |
|
195 | 195 | if integration==1: |
|
196 | 196 | V=10 |
|
197 | 197 | blocksPerfile=360 |
|
198 | 198 | print("* Velocidad del Pedestal:",V) |
|
199 | 199 | tmp_blocksPerfile = 100 |
|
200 | 200 | f_a_p= int(tmp_blocksPerfile/V) |
|
201 | 201 | |
|
202 | 202 | opObj11 = procUnitConfObjC.addOperation(name='PedestalInformation') |
|
203 | 203 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
204 | 204 | #opObj11.addParameter(name='path_adq', value=path_adq) |
|
205 | 205 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
206 | 206 | opObj11.addParameter(name='blocksPerfile', value=blocksPerfile, format='int') |
|
207 | 207 | opObj11.addParameter(name='n_Muestras_p', value='100', format='float') |
|
208 | 208 | opObj11.addParameter(name='f_a_p', value=f_a_p, format='int') |
|
209 | 209 | opObj11.addParameter(name='online', value='0', format='int') |
|
210 | 210 | |
|
211 | 211 | opObj11 = procUnitConfObjC.addOperation(name='Block360') |
|
212 |
opObj11.addParameter(name='n', value=' |
|
|
212 | opObj11.addParameter(name='n', value='10', format='int') | |
|
213 | 213 | opObj11.addParameter(name='mode', value=mode, format='int') |
|
214 | 214 | |
|
215 | 215 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
216 | 216 | opObj11= procUnitConfObjC.addOperation(name='WeatherPlot',optype='other') |
|
217 | 217 | controllerObj.start() |
General Comments 0
You need to be logged in to leave comments.
Login now