@@ -1,659 +1,660 | |||
|
1 | 1 | # Copyright (c) 2012-2020 Jicamarca Radio Observatory |
|
2 | 2 | # All rights reserved. |
|
3 | 3 | # |
|
4 | 4 | # Distributed under the terms of the BSD 3-clause license. |
|
5 | 5 | """API to create signal chain projects |
|
6 | 6 | |
|
7 | 7 | The API is provide through class: Project |
|
8 | 8 | """ |
|
9 | 9 | |
|
10 | 10 | import re |
|
11 | 11 | import sys |
|
12 | 12 | import ast |
|
13 | 13 | import datetime |
|
14 | 14 | import traceback |
|
15 | 15 | import time |
|
16 | 16 | import multiprocessing |
|
17 | 17 | from multiprocessing import Process, Queue |
|
18 | 18 | from threading import Thread |
|
19 | 19 | from xml.etree.ElementTree import ElementTree, Element, SubElement |
|
20 | 20 | |
|
21 | 21 | from schainpy.admin import Alarm, SchainWarning |
|
22 | 22 | from schainpy.model import * |
|
23 | 23 | from schainpy.utils import log |
|
24 | 24 | |
|
25 | 25 | if 'darwin' in sys.platform and sys.version_info[0] == 3 and sys.version_info[1] > 7: |
|
26 | 26 | multiprocessing.set_start_method('fork') |
|
27 | 27 | |
|
28 | 28 | class ConfBase(): |
|
29 | 29 | |
|
30 | 30 | def __init__(self): |
|
31 | 31 | |
|
32 | 32 | self.id = '0' |
|
33 | 33 | self.name = None |
|
34 | 34 | self.priority = None |
|
35 | 35 | self.parameters = {} |
|
36 | 36 | self.object = None |
|
37 | 37 | self.operations = [] |
|
38 | 38 | |
|
39 | 39 | def getId(self): |
|
40 | 40 | |
|
41 | 41 | return self.id |
|
42 | ||
|
42 | ||
|
43 | 43 | def getNewId(self): |
|
44 | 44 | |
|
45 | 45 | return int(self.id) * 10 + len(self.operations) + 1 |
|
46 | 46 | |
|
47 | 47 | def updateId(self, new_id): |
|
48 | 48 | |
|
49 | 49 | self.id = str(new_id) |
|
50 | 50 | |
|
51 | 51 | n = 1 |
|
52 | 52 | for conf in self.operations: |
|
53 | 53 | conf_id = str(int(new_id) * 10 + n) |
|
54 | 54 | conf.updateId(conf_id) |
|
55 | 55 | n += 1 |
|
56 | 56 | |
|
57 | 57 | def getKwargs(self): |
|
58 | 58 | |
|
59 | 59 | params = {} |
|
60 | 60 | |
|
61 | 61 | for key, value in self.parameters.items(): |
|
62 | 62 | if value not in (None, '', ' '): |
|
63 | 63 | params[key] = value |
|
64 | ||
|
64 | ||
|
65 | 65 | return params |
|
66 | 66 | |
|
67 | 67 | def update(self, **kwargs): |
|
68 | 68 | |
|
69 | 69 | for key, value in kwargs.items(): |
|
70 | 70 | self.addParameter(name=key, value=value) |
|
71 | 71 | |
|
72 | 72 | def addParameter(self, name, value, format=None): |
|
73 | 73 | ''' |
|
74 | 74 | ''' |
|
75 | ||
|
76 | if isinstance(value, str) and re.search(r'(\d+/\d+/\d+)', value): | |
|
75 | if os.path.isdir(value): | |
|
76 | self.parameters[name] = value | |
|
77 | elif isinstance(value, str) and re.search(r'(\d+/\d+/\d+)', value): | |
|
77 | 78 | self.parameters[name] = datetime.date(*[int(x) for x in value.split('/')]) |
|
78 | 79 | elif isinstance(value, str) and re.search(r'(\d+:\d+:\d+)', value): |
|
79 | 80 | self.parameters[name] = datetime.time(*[int(x) for x in value.split(':')]) |
|
80 | 81 | else: |
|
81 | 82 | try: |
|
82 | 83 | self.parameters[name] = ast.literal_eval(value) |
|
83 | 84 | except: |
|
84 | 85 | if isinstance(value, str) and ',' in value: |
|
85 | 86 | self.parameters[name] = value.split(',') |
|
86 | 87 | else: |
|
87 | 88 | self.parameters[name] = value |
|
88 | 89 | |
|
89 | 90 | def getParameters(self): |
|
90 | 91 | |
|
91 | 92 | params = {} |
|
92 | 93 | for key, value in self.parameters.items(): |
|
93 | 94 | s = type(value).__name__ |
|
94 | 95 | if s == 'date': |
|
95 | 96 | params[key] = value.strftime('%Y/%m/%d') |
|
96 | 97 | elif s == 'time': |
|
97 | 98 | params[key] = value.strftime('%H:%M:%S') |
|
98 | 99 | else: |
|
99 | 100 | params[key] = str(value) |
|
100 | 101 | |
|
101 | 102 | return params |
|
102 | ||
|
103 | ||
|
103 | 104 | def makeXml(self, element): |
|
104 | 105 | |
|
105 | 106 | xml = SubElement(element, self.ELEMENTNAME) |
|
106 | 107 | for label in self.xml_labels: |
|
107 | 108 | xml.set(label, str(getattr(self, label))) |
|
108 | ||
|
109 | ||
|
109 | 110 | for key, value in self.getParameters().items(): |
|
110 | 111 | xml_param = SubElement(xml, 'Parameter') |
|
111 | 112 | xml_param.set('name', key) |
|
112 | 113 | xml_param.set('value', value) |
|
113 | ||
|
114 | ||
|
114 | 115 | for conf in self.operations: |
|
115 | 116 | conf.makeXml(xml) |
|
116 | ||
|
117 | ||
|
117 | 118 | def __str__(self): |
|
118 | 119 | |
|
119 | 120 | if self.ELEMENTNAME == 'Operation': |
|
120 | 121 | s = ' {}[id={}]\n'.format(self.name, self.id) |
|
121 | 122 | else: |
|
122 | 123 | s = '{}[id={}, inputId={}]\n'.format(self.name, self.id, self.inputId) |
|
123 | 124 | |
|
124 | 125 | for key, value in self.parameters.items(): |
|
125 | 126 | if self.ELEMENTNAME == 'Operation': |
|
126 | 127 | s += ' {}: {}\n'.format(key, value) |
|
127 | 128 | else: |
|
128 | 129 | s += ' {}: {}\n'.format(key, value) |
|
129 | ||
|
130 | ||
|
130 | 131 | for conf in self.operations: |
|
131 | 132 | s += str(conf) |
|
132 | 133 | |
|
133 | 134 | return s |
|
134 | 135 | |
|
135 | 136 | class OperationConf(ConfBase): |
|
136 | 137 | |
|
137 | 138 | ELEMENTNAME = 'Operation' |
|
138 | 139 | xml_labels = ['id', 'name'] |
|
139 | 140 | |
|
140 | 141 | def setup(self, id, name, priority, project_id, err_queue): |
|
141 | 142 | |
|
142 | 143 | self.id = str(id) |
|
143 | 144 | self.project_id = project_id |
|
144 | 145 | self.name = name |
|
145 | 146 | self.type = 'other' |
|
146 | 147 | self.err_queue = err_queue |
|
147 | 148 | |
|
148 | 149 | def readXml(self, element, project_id, err_queue): |
|
149 | 150 | |
|
150 | 151 | self.id = element.get('id') |
|
151 | 152 | self.name = element.get('name') |
|
152 | 153 | self.type = 'other' |
|
153 | 154 | self.project_id = str(project_id) |
|
154 | 155 | self.err_queue = err_queue |
|
155 | 156 | |
|
156 | 157 | for elm in element.iter('Parameter'): |
|
157 | 158 | self.addParameter(elm.get('name'), elm.get('value')) |
|
158 | 159 | |
|
159 | 160 | def createObject(self): |
|
160 | 161 | |
|
161 | 162 | className = eval(self.name) |
|
162 | 163 | |
|
163 | 164 | if 'Plot' in self.name or 'Writer' in self.name or 'Send' in self.name or 'print' in self.name: |
|
164 | 165 | kwargs = self.getKwargs() |
|
165 | 166 | opObj = className(self.id, self.id, self.project_id, self.err_queue, **kwargs) |
|
166 | 167 | opObj.start() |
|
167 | 168 | self.type = 'external' |
|
168 | 169 | else: |
|
169 | 170 | opObj = className() |
|
170 | 171 | |
|
171 | 172 | self.object = opObj |
|
172 | 173 | return opObj |
|
173 | 174 | |
|
174 | 175 | class ProcUnitConf(ConfBase): |
|
175 | 176 | |
|
176 | 177 | ELEMENTNAME = 'ProcUnit' |
|
177 | 178 | xml_labels = ['id', 'inputId', 'name'] |
|
178 | 179 | |
|
179 | 180 | def setup(self, project_id, id, name, datatype, inputId, err_queue): |
|
180 | 181 | ''' |
|
181 | 182 | ''' |
|
182 | ||
|
183 | ||
|
183 | 184 | if datatype == None and name == None: |
|
184 | 185 | raise ValueError('datatype or name should be defined') |
|
185 | 186 | |
|
186 | 187 | if name == None: |
|
187 | 188 | if 'Proc' in datatype: |
|
188 | 189 | name = datatype |
|
189 | 190 | else: |
|
190 | 191 | name = '%sProc' % (datatype) |
|
191 | 192 | |
|
192 | 193 | if datatype == None: |
|
193 | 194 | datatype = name.replace('Proc', '') |
|
194 | 195 | |
|
195 | 196 | self.id = str(id) |
|
196 | 197 | self.project_id = project_id |
|
197 | 198 | self.name = name |
|
198 | 199 | self.datatype = datatype |
|
199 | 200 | self.inputId = inputId |
|
200 | 201 | self.err_queue = err_queue |
|
201 | 202 | self.operations = [] |
|
202 | 203 | self.parameters = {} |
|
203 | 204 | |
|
204 | 205 | def removeOperation(self, id): |
|
205 | 206 | |
|
206 | 207 | i = [1 if x.id==id else 0 for x in self.operations] |
|
207 | 208 | self.operations.pop(i.index(1)) |
|
208 | ||
|
209 | ||
|
209 | 210 | def getOperation(self, id): |
|
210 | 211 | |
|
211 | 212 | for conf in self.operations: |
|
212 | 213 | if conf.id == id: |
|
213 | 214 | return conf |
|
214 | 215 | |
|
215 | 216 | def addOperation(self, name, optype='self'): |
|
216 | 217 | ''' |
|
217 | 218 | ''' |
|
218 | 219 | |
|
219 | 220 | id = self.getNewId() |
|
220 | 221 | conf = OperationConf() |
|
221 | 222 | conf.setup(id, name=name, priority='0', project_id=self.project_id, err_queue=self.err_queue) |
|
222 | 223 | self.operations.append(conf) |
|
223 | 224 | |
|
224 | 225 | return conf |
|
225 | 226 | |
|
226 | 227 | def readXml(self, element, project_id, err_queue): |
|
227 | 228 | |
|
228 | 229 | self.id = element.get('id') |
|
229 | 230 | self.name = element.get('name') |
|
230 | 231 | self.inputId = None if element.get('inputId') == 'None' else element.get('inputId') |
|
231 | 232 | self.datatype = element.get('datatype', self.name.replace(self.ELEMENTNAME.replace('Unit', ''), '')) |
|
232 | 233 | self.project_id = str(project_id) |
|
233 | 234 | self.err_queue = err_queue |
|
234 | 235 | self.operations = [] |
|
235 | 236 | self.parameters = {} |
|
236 | ||
|
237 | ||
|
237 | 238 | for elm in element: |
|
238 | 239 | if elm.tag == 'Parameter': |
|
239 | 240 | self.addParameter(elm.get('name'), elm.get('value')) |
|
240 | 241 | elif elm.tag == 'Operation': |
|
241 | 242 | conf = OperationConf() |
|
242 | 243 | conf.readXml(elm, project_id, err_queue) |
|
243 | 244 | self.operations.append(conf) |
|
244 | 245 | |
|
245 | 246 | def createObjects(self): |
|
246 | 247 | ''' |
|
247 | 248 | Instancia de unidades de procesamiento. |
|
248 | 249 | ''' |
|
249 | 250 | |
|
250 | 251 | className = eval(self.name) |
|
251 | 252 | kwargs = self.getKwargs() |
|
252 | 253 | procUnitObj = className() |
|
253 | 254 | procUnitObj.name = self.name |
|
254 | 255 | log.success('creating process...', self.name) |
|
255 | 256 | |
|
256 | 257 | for conf in self.operations: |
|
257 | ||
|
258 | ||
|
258 | 259 | opObj = conf.createObject() |
|
259 | ||
|
260 | ||
|
260 | 261 | log.success('adding operation: {}, type:{}'.format( |
|
261 | 262 | conf.name, |
|
262 | 263 | conf.type), self.name) |
|
263 | ||
|
264 | ||
|
264 | 265 | procUnitObj.addOperation(conf, opObj) |
|
265 | ||
|
266 | ||
|
266 | 267 | self.object = procUnitObj |
|
267 | 268 | |
|
268 | 269 | def run(self): |
|
269 | 270 | ''' |
|
270 | 271 | ''' |
|
271 | ||
|
272 | ||
|
272 | 273 | return self.object.call(**self.getKwargs()) |
|
273 | 274 | |
|
274 | 275 | |
|
275 | 276 | class ReadUnitConf(ProcUnitConf): |
|
276 | 277 | |
|
277 | 278 | ELEMENTNAME = 'ReadUnit' |
|
278 | 279 | |
|
279 | 280 | def __init__(self): |
|
280 | 281 | |
|
281 | 282 | self.id = None |
|
282 | 283 | self.datatype = None |
|
283 | 284 | self.name = None |
|
284 | 285 | self.inputId = None |
|
285 | 286 | self.operations = [] |
|
286 | 287 | self.parameters = {} |
|
287 | ||
|
288 | ||
|
288 | 289 | def setup(self, project_id, id, name, datatype, err_queue, path='', startDate='', endDate='', |
|
289 | 290 | startTime='', endTime='', server=None, **kwargs): |
|
290 | ||
|
291 | ||
|
291 | 292 | if datatype == None and name == None: |
|
292 | 293 | raise ValueError('datatype or name should be defined') |
|
293 | 294 | if name == None: |
|
294 | 295 | if 'Reader' in datatype: |
|
295 | 296 | name = datatype |
|
296 | 297 | datatype = name.replace('Reader','') |
|
297 | 298 | else: |
|
298 | 299 | name = '{}Reader'.format(datatype) |
|
299 | 300 | if datatype == None: |
|
300 | 301 | if 'Reader' in name: |
|
301 | 302 | datatype = name.replace('Reader','') |
|
302 | 303 | else: |
|
303 | 304 | datatype = name |
|
304 | 305 | name = '{}Reader'.format(name) |
|
305 | 306 | |
|
306 | 307 | self.id = id |
|
307 | 308 | self.project_id = project_id |
|
308 | 309 | self.name = name |
|
309 | 310 | self.datatype = datatype |
|
310 |
self.err_queue = err_queue |
|
|
311 | ||
|
311 | self.err_queue = err_queue | |
|
312 | ||
|
312 | 313 | self.addParameter(name='path', value=path) |
|
313 | 314 | self.addParameter(name='startDate', value=startDate) |
|
314 | 315 | self.addParameter(name='endDate', value=endDate) |
|
315 | 316 | self.addParameter(name='startTime', value=startTime) |
|
316 | 317 | self.addParameter(name='endTime', value=endTime) |
|
317 | 318 | |
|
318 | 319 | for key, value in kwargs.items(): |
|
319 | 320 | self.addParameter(name=key, value=value) |
|
320 | 321 | |
|
321 | 322 | |
|
322 | 323 | class Project(Process): |
|
323 | 324 | """API to create signal chain projects""" |
|
324 | 325 | |
|
325 | 326 | ELEMENTNAME = 'Project' |
|
326 | 327 | |
|
327 | 328 | def __init__(self, name=''): |
|
328 | 329 | |
|
329 | 330 | Process.__init__(self) |
|
330 | 331 | self.id = '1' |
|
331 | 332 | if name: |
|
332 | 333 | self.name = '{} ({})'.format(Process.__name__, name) |
|
333 | 334 | self.filename = None |
|
334 | 335 | self.description = None |
|
335 | 336 | self.email = None |
|
336 | 337 | self.alarm = [] |
|
337 | 338 | self.configurations = {} |
|
338 | 339 | # self.err_queue = Queue() |
|
339 | 340 | self.err_queue = None |
|
340 | 341 | self.started = False |
|
341 | 342 | |
|
342 | 343 | def getNewId(self): |
|
343 | 344 | |
|
344 | 345 | idList = list(self.configurations.keys()) |
|
345 | 346 | id = int(self.id) * 10 |
|
346 | 347 | |
|
347 | 348 | while True: |
|
348 | 349 | id += 1 |
|
349 | 350 | |
|
350 | 351 | if str(id) in idList: |
|
351 | 352 | continue |
|
352 | 353 | |
|
353 | 354 | break |
|
354 | 355 | |
|
355 | 356 | return str(id) |
|
356 | 357 | |
|
357 | 358 | def updateId(self, new_id): |
|
358 | 359 | |
|
359 | 360 | self.id = str(new_id) |
|
360 | 361 | |
|
361 | 362 | keyList = list(self.configurations.keys()) |
|
362 | 363 | keyList.sort() |
|
363 | 364 | |
|
364 | 365 | n = 1 |
|
365 | 366 | new_confs = {} |
|
366 | 367 | |
|
367 | 368 | for procKey in keyList: |
|
368 | 369 | |
|
369 | 370 | conf = self.configurations[procKey] |
|
370 | 371 | idProcUnit = str(int(self.id) * 10 + n) |
|
371 | 372 | conf.updateId(idProcUnit) |
|
372 | 373 | new_confs[idProcUnit] = conf |
|
373 | 374 | n += 1 |
|
374 | 375 | |
|
375 | 376 | self.configurations = new_confs |
|
376 | 377 | |
|
377 | 378 | def setup(self, id=1, name='', description='', email=None, alarm=[]): |
|
378 | 379 | |
|
379 | 380 | self.id = str(id) |
|
380 |
self.description = description |
|
|
381 | self.description = description | |
|
381 | 382 | self.email = email |
|
382 | 383 | self.alarm = alarm |
|
383 | 384 | if name: |
|
384 | 385 | self.name = '{} ({})'.format(Process.__name__, name) |
|
385 | 386 | |
|
386 | 387 | def update(self, **kwargs): |
|
387 | 388 | |
|
388 | 389 | for key, value in kwargs.items(): |
|
389 | 390 | setattr(self, key, value) |
|
390 | 391 | |
|
391 | 392 | def clone(self): |
|
392 | 393 | |
|
393 | 394 | p = Project() |
|
394 | 395 | p.id = self.id |
|
395 | 396 | p.name = self.name |
|
396 | 397 | p.description = self.description |
|
397 | 398 | p.configurations = self.configurations.copy() |
|
398 | 399 | |
|
399 | 400 | return p |
|
400 | 401 | |
|
401 | 402 | def addReadUnit(self, id=None, datatype=None, name=None, **kwargs): |
|
402 | 403 | |
|
403 | 404 | ''' |
|
404 | 405 | ''' |
|
405 | 406 | |
|
406 | 407 | if id is None: |
|
407 | 408 | idReadUnit = self.getNewId() |
|
408 | 409 | else: |
|
409 | 410 | idReadUnit = str(id) |
|
410 | 411 | |
|
411 | 412 | conf = ReadUnitConf() |
|
412 | 413 | conf.setup(self.id, idReadUnit, name, datatype, self.err_queue, **kwargs) |
|
413 | 414 | self.configurations[conf.id] = conf |
|
414 | ||
|
415 | ||
|
415 | 416 | return conf |
|
416 | 417 | |
|
417 | 418 | def addProcUnit(self, id=None, inputId='0', datatype=None, name=None): |
|
418 | 419 | |
|
419 | 420 | ''' |
|
420 | 421 | ''' |
|
421 | 422 | |
|
422 | 423 | if id is None: |
|
423 | 424 | idProcUnit = self.getNewId() |
|
424 | 425 | else: |
|
425 | 426 | idProcUnit = id |
|
426 | ||
|
427 | ||
|
427 | 428 | conf = ProcUnitConf() |
|
428 | 429 | conf.setup(self.id, idProcUnit, name, datatype, inputId, self.err_queue) |
|
429 | 430 | self.configurations[conf.id] = conf |
|
430 | 431 | |
|
431 | 432 | return conf |
|
432 | 433 | |
|
433 | 434 | def removeProcUnit(self, id): |
|
434 | 435 | |
|
435 | 436 | if id in self.configurations: |
|
436 | 437 | self.configurations.pop(id) |
|
437 | 438 | |
|
438 | 439 | def getReadUnit(self): |
|
439 | 440 | |
|
440 | 441 | for obj in list(self.configurations.values()): |
|
441 | 442 | if obj.ELEMENTNAME == 'ReadUnit': |
|
442 | 443 | return obj |
|
443 | 444 | |
|
444 | 445 | return None |
|
445 | 446 | |
|
446 | 447 | def getProcUnit(self, id): |
|
447 | 448 | |
|
448 | 449 | return self.configurations[id] |
|
449 | 450 | |
|
450 | 451 | def getUnits(self): |
|
451 | 452 | |
|
452 | 453 | keys = list(self.configurations) |
|
453 | 454 | keys.sort() |
|
454 | 455 | |
|
455 | 456 | for key in keys: |
|
456 | 457 | yield self.configurations[key] |
|
457 | 458 | |
|
458 | 459 | def updateUnit(self, id, **kwargs): |
|
459 | 460 | |
|
460 | 461 | conf = self.configurations[id].update(**kwargs) |
|
461 | ||
|
462 | ||
|
462 | 463 | def makeXml(self): |
|
463 | 464 | |
|
464 | 465 | xml = Element('Project') |
|
465 | 466 | xml.set('id', str(self.id)) |
|
466 | 467 | xml.set('name', self.name) |
|
467 | 468 | xml.set('description', self.description) |
|
468 | 469 | |
|
469 | 470 | for conf in self.configurations.values(): |
|
470 | 471 | conf.makeXml(xml) |
|
471 | 472 | |
|
472 | 473 | self.xml = xml |
|
473 | 474 | |
|
474 | 475 | def writeXml(self, filename=None): |
|
475 | 476 | |
|
476 | 477 | if filename == None: |
|
477 | 478 | if self.filename: |
|
478 | 479 | filename = self.filename |
|
479 | 480 | else: |
|
480 | 481 | filename = 'schain.xml' |
|
481 | 482 | |
|
482 | 483 | if not filename: |
|
483 | 484 | print('filename has not been defined. Use setFilename(filename) for do it.') |
|
484 | 485 | return 0 |
|
485 | 486 | |
|
486 | 487 | abs_file = os.path.abspath(filename) |
|
487 | 488 | |
|
488 | 489 | if not os.access(os.path.dirname(abs_file), os.W_OK): |
|
489 | 490 | print('No write permission on %s' % os.path.dirname(abs_file)) |
|
490 | 491 | return 0 |
|
491 | 492 | |
|
492 | 493 | if os.path.isfile(abs_file) and not(os.access(abs_file, os.W_OK)): |
|
493 | 494 | print('File %s already exists and it could not be overwriten' % abs_file) |
|
494 | 495 | return 0 |
|
495 | 496 | |
|
496 | 497 | self.makeXml() |
|
497 | 498 | |
|
498 | 499 | ElementTree(self.xml).write(abs_file, method='xml') |
|
499 | 500 | |
|
500 | 501 | self.filename = abs_file |
|
501 | 502 | |
|
502 | 503 | return 1 |
|
503 | 504 | |
|
504 | 505 | def readXml(self, filename): |
|
505 | 506 | |
|
506 | 507 | abs_file = os.path.abspath(filename) |
|
507 | 508 | |
|
508 | 509 | self.configurations = {} |
|
509 | 510 | |
|
510 | 511 | try: |
|
511 | 512 | self.xml = ElementTree().parse(abs_file) |
|
512 | 513 | except: |
|
513 | 514 | log.error('Error reading %s, verify file format' % filename) |
|
514 | 515 | return 0 |
|
515 | 516 | |
|
516 | 517 | self.id = self.xml.get('id') |
|
517 | 518 | self.name = self.xml.get('name') |
|
518 | 519 | self.description = self.xml.get('description') |
|
519 | 520 | |
|
520 | 521 | for element in self.xml: |
|
521 | 522 | if element.tag == 'ReadUnit': |
|
522 | 523 | conf = ReadUnitConf() |
|
523 | 524 | conf.readXml(element, self.id, self.err_queue) |
|
524 | 525 | self.configurations[conf.id] = conf |
|
525 | 526 | elif element.tag == 'ProcUnit': |
|
526 | 527 | conf = ProcUnitConf() |
|
527 | 528 | input_proc = self.configurations[element.get('inputId')] |
|
528 | 529 | conf.readXml(element, self.id, self.err_queue) |
|
529 | 530 | self.configurations[conf.id] = conf |
|
530 | 531 | |
|
531 | 532 | self.filename = abs_file |
|
532 | ||
|
533 | ||
|
533 | 534 | return 1 |
|
534 | 535 | |
|
535 | 536 | def __str__(self): |
|
536 | 537 | |
|
537 | 538 | text = '\nProject[id=%s, name=%s, description=%s]\n\n' % ( |
|
538 | 539 | self.id, |
|
539 | 540 | self.name, |
|
540 | 541 | self.description, |
|
541 | 542 | ) |
|
542 | 543 | |
|
543 | 544 | for conf in self.configurations.values(): |
|
544 | 545 | text += '{}'.format(conf) |
|
545 | 546 | |
|
546 | 547 | return text |
|
547 | 548 | |
|
548 | 549 | def createObjects(self): |
|
549 | 550 | |
|
550 | 551 | keys = list(self.configurations.keys()) |
|
551 | 552 | keys.sort() |
|
552 | 553 | for key in keys: |
|
553 | 554 | conf = self.configurations[key] |
|
554 | 555 | conf.createObjects() |
|
555 | 556 | if conf.inputId is not None: |
|
556 | 557 | conf.object.setInput(self.configurations[conf.inputId].object) |
|
557 | 558 | |
|
558 | 559 | def monitor(self): |
|
559 | 560 | |
|
560 | 561 | t = Thread(target=self._monitor, args=(self.err_queue, self.ctx)) |
|
561 | 562 | t.start() |
|
562 | ||
|
563 | ||
|
563 | 564 | def _monitor(self, queue, ctx): |
|
564 | 565 | |
|
565 | 566 | import socket |
|
566 | ||
|
567 | ||
|
567 | 568 | procs = 0 |
|
568 | 569 | err_msg = '' |
|
569 | ||
|
570 | ||
|
570 | 571 | while True: |
|
571 | 572 | msg = queue.get() |
|
572 | 573 | if '#_start_#' in msg: |
|
573 | 574 | procs += 1 |
|
574 | 575 | elif '#_end_#' in msg: |
|
575 | 576 | procs -=1 |
|
576 | 577 | else: |
|
577 | 578 | err_msg = msg |
|
578 | ||
|
579 |
if procs == 0 or 'Traceback' in err_msg: |
|
|
579 | ||
|
580 | if procs == 0 or 'Traceback' in err_msg: | |
|
580 | 581 | break |
|
581 | 582 | time.sleep(0.1) |
|
582 | ||
|
583 | ||
|
583 | 584 | if '|' in err_msg: |
|
584 | 585 | name, err = err_msg.split('|') |
|
585 | 586 | if 'SchainWarning' in err: |
|
586 | 587 | log.warning(err.split('SchainWarning:')[-1].split('\n')[0].strip(), name) |
|
587 | 588 | elif 'SchainError' in err: |
|
588 | 589 | log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), name) |
|
589 | 590 | else: |
|
590 | 591 | log.error(err, name) |
|
591 |
else: |
|
|
592 | else: | |
|
592 | 593 | name, err = self.name, err_msg |
|
593 | ||
|
594 | ||
|
594 | 595 | time.sleep(1) |
|
595 | ||
|
596 | ||
|
596 | 597 | ctx.term() |
|
597 | 598 | |
|
598 | 599 | message = ''.join(err) |
|
599 | 600 | |
|
600 | 601 | if err_msg: |
|
601 | 602 | subject = 'SChain v%s: Error running %s\n' % ( |
|
602 | 603 | schainpy.__version__, self.name) |
|
603 | 604 | |
|
604 | 605 | subtitle = 'Hostname: %s\n' % socket.gethostbyname( |
|
605 | 606 | socket.gethostname()) |
|
606 | 607 | subtitle += 'Working directory: %s\n' % os.path.abspath('./') |
|
607 | 608 | subtitle += 'Configuration file: %s\n' % self.filename |
|
608 | 609 | subtitle += 'Time: %s\n' % str(datetime.datetime.now()) |
|
609 | 610 | |
|
610 | 611 | readUnitConfObj = self.getReadUnit() |
|
611 | 612 | if readUnitConfObj: |
|
612 | 613 | subtitle += '\nInput parameters:\n' |
|
613 | 614 | subtitle += '[Data path = %s]\n' % readUnitConfObj.parameters['path'] |
|
614 | 615 | subtitle += '[Start date = %s]\n' % readUnitConfObj.parameters['startDate'] |
|
615 | 616 | subtitle += '[End date = %s]\n' % readUnitConfObj.parameters['endDate'] |
|
616 | 617 | subtitle += '[Start time = %s]\n' % readUnitConfObj.parameters['startTime'] |
|
617 | 618 | subtitle += '[End time = %s]\n' % readUnitConfObj.parameters['endTime'] |
|
618 | 619 | |
|
619 | 620 | a = Alarm( |
|
620 |
modes=self.alarm, |
|
|
621 | modes=self.alarm, | |
|
621 | 622 | email=self.email, |
|
622 | 623 | message=message, |
|
623 | 624 | subject=subject, |
|
624 | 625 | subtitle=subtitle, |
|
625 | 626 | filename=self.filename |
|
626 | 627 | ) |
|
627 | 628 | |
|
628 | 629 | a.start() |
|
629 | 630 | |
|
630 | 631 | def setFilename(self, filename): |
|
631 | 632 | |
|
632 | 633 | self.filename = filename |
|
633 | 634 | |
|
634 | 635 | def runProcs(self): |
|
635 | 636 | |
|
636 | 637 | err = False |
|
637 | 638 | n = len(self.configurations) |
|
638 | ||
|
639 | ||
|
639 | 640 | while not err: |
|
640 | 641 | for conf in self.getUnits(): |
|
641 |
ok = conf.run() |
|
|
642 | ok = conf.run() | |
|
642 | 643 | if ok == 'Error': |
|
643 | 644 | n -= 1 |
|
644 | 645 | continue |
|
645 | 646 | elif not ok: |
|
646 | 647 | break |
|
647 | 648 | if n == 0: |
|
648 | 649 | err = True |
|
649 | ||
|
650 | ||
|
650 | 651 | def run(self): |
|
651 | 652 | |
|
652 | 653 | log.success('\nStarting Project {} [id={}]'.format(self.name, self.id), tag='') |
|
653 | 654 | self.started = True |
|
654 |
self.start_time = time.time() |
|
|
655 | self.start_time = time.time() | |
|
655 | 656 | self.createObjects() |
|
656 | 657 | self.runProcs() |
|
657 | 658 | log.success('{} Done (Time: {:4.2f}s)'.format( |
|
658 | 659 | self.name, |
|
659 | 660 | time.time()-self.start_time), '') |
@@ -1,242 +1,251 | |||
|
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 | |
|
24 | 24 | #-------------------------VELOCIDAD DEL PEDESTAL Y MODO ------------------------ |
|
25 | 25 | print("SETUP- RADAR METEOROLOGICO") |
|
26 | 26 | IPP = 400*1e-6 |
|
27 | 27 | V = 6 |
|
28 | 28 | samp_rate = 10# VERIFICAR |
|
29 | 29 | MODE_TABLE = 1 # PUEDE SER 1 O 0 |
|
30 | 30 | AXIS = [1,1,1,1] # AZIMUTH 1 ELEVACION 0 |
|
31 | 31 | SPEED_AXIS = [10,10,10,10] # VELOCIDAD |
|
32 | 32 | ANGLE_AXIS = [20,25,30,15] # ANGULOS |
|
33 | 33 | mode_proc = 0 |
|
34 | 34 | #-----------------------------PATH ADQ Y PEDESTAL------------------------------- |
|
35 | 35 | #ath = "/DATA_RM/TEST_MARTES_22_1M_1us" |
|
36 | 36 | #path_ped = "/DATA_RM/TEST_PEDESTAL/P20220322-171722" |
|
37 | 37 | #path = "/DATA_RM/DRONE01ABRIL" |
|
38 | 38 | #path = "/DATA_RM/DRONE01ABRIL1429" |
|
39 | 39 | #path_ped = "/DATA_RM/TEST_PEDESTAL/P20220322-171722" |
|
40 | 40 | #path = "/DATA_RM/DRONE01ABRIL1701" |
|
41 | path = "/DATA_RM/DATA/Torre_con_bola_1649092242/rawdata" | |
|
42 | path="/DATA_RM/DRONE01ABRIL1727" | |
|
41 | ##path = "/DATA_RM/DATA/Torre_con_bola_1649092242/rawdata" | |
|
42 | ##path="/DATA_RM/DRONE01ABRIL1727" | |
|
43 | path ="/DATA_RM/DATA/TEST@2022-04-11T17:29:56/rawdata" | |
|
44 | #path="/DATA_RM/TEST172956_0411" | |
|
45 | ||
|
46 | ||
|
47 | #path = "/DATA_RM/DATA/TEST@2022-04-11T17:29:56/rawdata" | |
|
48 | ||
|
43 | 49 | #path_ped = "/DATA_RM/DRONE01ABRIL1450" |
|
44 | path_ped="/DATA_RM/TEST_PEDESTAL/P20220401-172744" | |
|
50 | #path_ped="/DATA_RM/TEST_PEDESTAL/P20220401-172744" | |
|
51 | ||
|
52 | path_ped="/DATA_RM/TEST_PEDESTAL/P20220411-173017" | |
|
53 | ||
|
45 | 54 | #path_ped = "/DATA_RM/DATA/Torre_con_bola_1649092242/position/2022-04-04T17-00-00" |
|
46 | 55 | #------------------------------------------------------------------------------- |
|
47 |
figpath_pp = "/home/soporte/Pictures/T |
|
|
56 | figpath_pp = "/home/soporte/Pictures/TEST" | |
|
48 | 57 | #figpath_pp = "/home/soporte/Pictures/MARTES_22_PP_1M_1us" |
|
49 | 58 | figpath_spec = "/home/soporte/Pictures/MARTES_22_1M_1us" |
|
50 |
figpath_pp_ppi = "/home/soporte/Pictures/ |
|
|
59 | figpath_pp_ppi = "/home/soporte/Pictures/PPILUNES11042022" | |
|
51 | 60 | |
|
52 | 61 | |
|
53 | 62 | figpath_pp_rhi = "/DATA_RM/LUNES04ABRIL_1200_RHI" |
|
54 | 63 | #--------------------------OPCIONES--------------------------------------------- |
|
55 |
plot_ppi = |
|
|
56 | plot = 0 | |
|
57 | plot_rhi = 1 | |
|
58 | integration = 1 | |
|
64 | plot_ppi = 1 | |
|
65 | plot = 0#0 | |
|
66 | plot_rhi = 0#1 | |
|
67 | integration = 1#1 | |
|
59 | 68 | save = 0 |
|
60 | 69 | plot_spec = 0 |
|
61 | 70 | #---------------------------SAVE HDF5 PROCESADO/-------------------------------- |
|
62 | 71 | if save == 1: |
|
63 | 72 | if mode_proc==0: |
|
64 | 73 | path_save = '/DATA_RM/TEST_HDF5_PP_MAR22/6v' |
|
65 | 74 | else: |
|
66 | 75 | path_save = '/DATA_RM/TEST_HDF5_SPEC_MAR22/6v' |
|
67 | 76 | print("[SETUP]-RADAR METEOROLOGICO-") |
|
68 | 77 | print("* PATH data ADQ :", path) |
|
69 | 78 | print("* PATH data PED :", path_ped) |
|
70 | 79 | print("* SAMPLE RATE ADQ Mhz :", samp_rate) |
|
71 | 80 | print("* Velocidad Pedestal :",V,"Β°/seg") |
|
72 | 81 | print("* Configuracion del Pedestal *") |
|
73 | 82 | |
|
74 | 83 | print("*** AXIS :",AXIS) |
|
75 | 84 | print("*** SPEED_AXIS:",SPEED_AXIS) |
|
76 | 85 | print("*** ANGLE_AXIS:",ANGLE_AXIS) |
|
77 | 86 | num_alturas = int(samp_rate*IPP*1e6) |
|
78 | 87 | print("* Nro de Altura :",num_alturas) |
|
79 | 88 | |
|
80 | 89 | ############################ NRO Perfiles PROCESAMIENTO ################### |
|
81 | 90 | V=V |
|
82 | 91 | n= int(1/(V*IPP)) |
|
83 | 92 | print("* n - NRO Perfiles Proc:", n ) |
|
84 | 93 | ################################## MODE ################################### |
|
85 | 94 | print("* Modo de Operacion :",mode_proc) |
|
86 | 95 | if mode_proc ==0: |
|
87 | 96 | print("* Met. Seleccionado : Pulse Pair") |
|
88 | 97 | else: |
|
89 | 98 | print("* Met. Momentos : Momentos") |
|
90 | 99 | ################################## MODE ################################### |
|
91 | 100 | print("* Grabado de datos :",save) |
|
92 | 101 | if save ==1: |
|
93 | 102 | if mode_proc==0: |
|
94 | 103 | print("[ ON ] MODE PULSEPAIR") |
|
95 | 104 | |
|
96 | 105 | else: |
|
97 | 106 | print("[ ON ] MODE FREQUENCY") |
|
98 | 107 | |
|
99 | 108 | print("* Integracion de datos :",integration) |
|
100 | 109 | |
|
101 | 110 | print("* Ploteo de datos Parameters:", plot) |
|
102 | 111 | if plot==1: |
|
103 | 112 | print("* Path PP plot :", figpath_pp ) |
|
104 | 113 | |
|
105 | 114 | if plot_ppi==1: |
|
106 | 115 | print("* Path PPI plot :", figpath_pp_ppi ) |
|
107 | 116 | |
|
108 | 117 | time.sleep(4) |
|
109 | 118 | #remotefolder = "/home/wmaster/graficos" |
|
110 | 119 | ################# RANGO DE PLOTEO###################################### |
|
111 | 120 | dBmin = '20' |
|
112 | 121 | dBmax = '60' |
|
113 |
xmin = '1 |
|
|
114 |
xmax = '1 |
|
|
122 | xmin = '17.4' #17.1,17.5 | |
|
123 | xmax = '17.7' #17.2,17.8 | |
|
115 | 124 | ymin = '0' #### PONER A 0 |
|
116 |
ymax = '1. |
|
|
125 | ymax = '1.5' #### PONER A 8 | |
|
117 | 126 | ########################FECHA########################################## |
|
118 | 127 | str1 = datetime.date.today() |
|
119 | 128 | today = str1.strftime("%Y/%m/%d") |
|
120 | 129 | str2 = str1 - datetime.timedelta(days=1) |
|
121 | 130 | yesterday = str2.strftime("%Y/%m/%d") |
|
122 | 131 | |
|
123 | 132 | #------------------------SIGNAL CHAIN------------------------------------------- |
|
124 | 133 | desc = "USRP_test" |
|
125 | 134 | filename = "USRP_processing.xml" |
|
126 | 135 | controllerObj = Project() |
|
127 | 136 | controllerObj.setup(id = '191', name='Test_USRP', description=desc) |
|
128 | 137 | #------------------------ UNIDAD DE LECTURA------------------------------------- |
|
129 | 138 | readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader', |
|
130 | 139 | path=path, |
|
131 |
startDate="2022/04/ |
|
|
132 |
endDate="2022/04/ |
|
|
133 |
startTime=' |
|
|
140 | startDate="2022/04/11",#today, | |
|
141 | endDate="2022/04/11",#today, | |
|
142 | startTime='17:36:00',#'17:39:25', | |
|
134 | 143 | endTime='23:59:59',#23:59:59', |
|
135 | 144 | delay=0, |
|
136 | 145 | #set=0, |
|
137 | 146 | online=0, |
|
138 | 147 | walk=1, |
|
139 | 148 | ippKm = 60) |
|
140 | 149 | |
|
141 | 150 | opObj11 = readUnitConfObj.addOperation(name='printInfo') |
|
142 | 151 | |
|
143 | 152 | procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=readUnitConfObj.getId()) |
|
144 | 153 | ''' |
|
145 | 154 | opObj10 = procUnitConfObjA.addOperation(name='ScopePlot', optype='external') |
|
146 | 155 | opObj10.addParameter(name='id', value='10', format='int') |
|
147 | 156 | opObj10.addParameter(name='zmin', value='0', format='int') |
|
148 | 157 | opObj10.addParameter(name='zmax', value='3', format='int') |
|
149 | 158 | opObj10.addParameter(name='type', value='iq') |
|
150 | 159 | opObj10.addParameter(name='ymin', value='-1200', format='int') |
|
151 | 160 | opObj10.addParameter(name='ymax', value='1200', format='int') |
|
152 | 161 | #opObj10.addParameter(name='save', value=figpath, format='str') |
|
153 | 162 | opObj10.addParameter(name='save_period', value=10, format='int') |
|
154 | 163 | ''' |
|
155 | 164 | opObj11 = procUnitConfObjA.addOperation(name='setH0') |
|
156 |
opObj11.addParameter(name='h0', value='-1. |
|
|
165 | opObj11.addParameter(name='h0', value='-1.0', format='float') | |
|
157 | 166 | |
|
158 | 167 | opObj11 = procUnitConfObjA.addOperation(name='selectHeights') |
|
159 | 168 | opObj11.addParameter(name='minIndex', value='1', format='int') |
|
160 | 169 | #opObj11.addParameter(name='maxIndex', value='1000', format='int') |
|
161 | 170 | #opObj11.addParameter(name='maxIndex', value=str(int(num_alturas/4.0)), format='int') |
|
162 | 171 | # CUARTA PARTE de 60 Km POR ESO ENTRE 4 - 15 Km |
|
163 | 172 | opObj11.addParameter(name='maxIndex', value=str(int(num_alturas/20.0)), format='int') |
|
164 | 173 | # CUARTA PARTE de 60 Km POR ESO ENTRE 10 - 6 Km |
|
165 | 174 | # CUARTA PARTE de 60 Km POR ESO ENTRE 20 - 3 Km |
|
166 | 175 | |
|
167 | 176 | |
|
168 | 177 | ''' |
|
169 | 178 | procUnitConfObjB = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjA.getId()) |
|
170 | 179 | procUnitConfObjB.addParameter(name='nFFTPoints', value='32', format='int') |
|
171 | 180 | procUnitConfObjB.addParameter(name='nProfiles', value='32', format='int') |
|
172 | 181 | |
|
173 | 182 | |
|
174 | 183 | #SpectraPlot |
|
175 | 184 | |
|
176 | 185 | opObj11 = procUnitConfObjB.addOperation(name='SpectraPlot', optype='external') |
|
177 | 186 | opObj11.addParameter(name='id', value='1', format='int') |
|
178 | 187 | opObj11.addParameter(name='wintitle', value='Spectra', format='str') |
|
179 | 188 | #opObj11.addParameter(name='xmin', value=-0.01, format='float') |
|
180 | 189 | #opObj11.addParameter(name='xmax', value=0.01, format='float') |
|
181 | 190 | opObj11.addParameter(name='zmin', value=dBmin, format='int') |
|
182 | 191 | opObj11.addParameter(name='zmax', value=dBmax, format='int') |
|
183 | 192 | opObj11.addParameter(name='ymin', value=ymin, format='int') |
|
184 | 193 | opObj11.addParameter(name='ymax', value=ymax, format='int') |
|
185 | 194 | opObj11.addParameter(name='showprofile', value='1', format='int') |
|
186 | 195 | #opObj11.addParameter(name='save', value=figpath, format='str') |
|
187 | 196 | opObj11.addParameter(name='save_period', value=10, format='int') |
|
188 | 197 | ''' |
|
189 | 198 | |
|
190 | 199 | if mode_proc ==0: |
|
191 | 200 | ####################### METODO PULSE PAIR ###################################################################### |
|
192 | 201 | opObj11 = procUnitConfObjA.addOperation(name='PulsePair', optype='other') |
|
193 | 202 | opObj11.addParameter(name='n', value=int(n), format='int')#10 VOY A USAR 250 DADO QUE LA VELOCIDAD ES 10 GRADOS |
|
194 | 203 | #opObj11.addParameter(name='removeDC', value=1, format='int') |
|
195 | 204 | ####################### METODO Parametros ###################################################################### |
|
196 | 205 | procUnitConfObjB= controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjA.getId()) |
|
197 | 206 | if plot==1: |
|
198 | 207 | opObj11 = procUnitConfObjB.addOperation(name='GenericRTIPlot',optype='external') |
|
199 | 208 | opObj11.addParameter(name='attr_data', value='dataPP_POWER') |
|
200 | 209 | opObj11.addParameter(name='colormap', value='jet') |
|
201 | 210 | opObj11.addParameter(name='xmin', value=xmin) |
|
202 | 211 | opObj11.addParameter(name='xmax', value=xmax) |
|
203 | 212 | opObj11.addParameter(name='ymin', value=ymin) |
|
204 | 213 | opObj11.addParameter(name='ymax', value=ymax) |
|
205 | 214 | opObj11.addParameter(name='zmin', value=dBmin) |
|
206 | 215 | opObj11.addParameter(name='zmax', value=dBmax) |
|
207 | 216 | opObj11.addParameter(name='save', value=figpath_pp) |
|
208 | 217 | opObj11.addParameter(name='showprofile', value=0) |
|
209 | 218 | opObj11.addParameter(name='save_period', value=10) |
|
210 | 219 | ####################### METODO ESCRITURA ####################################################################### |
|
211 | 220 | if save==1: |
|
212 | 221 | opObj10 = procUnitConfObjB.addOperation(name='HDFWriter') |
|
213 | 222 | opObj10.addParameter(name='path',value=path_save) |
|
214 | 223 | #opObj10.addParameter(name='mode',value=0) |
|
215 | 224 | opObj10.addParameter(name='blocksPerFile',value='100',format='int') |
|
216 | 225 | opObj10.addParameter(name='metadataList',value='utctimeInit,timeZone,paramInterval,profileIndex,channelList,heightList,flagDataAsBlock',format='list') |
|
217 | 226 | opObj10.addParhirameter(name='dataList',value='dataPP_POWER,dataPP_DOP,utctime',format='list')#,format='list' |
|
218 | 227 | if integration==1: |
|
219 | 228 | opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation') |
|
220 | 229 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
221 | 230 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
222 | 231 | #opObj11.addParameter(name='wr_exp', value='PPI') |
|
223 | 232 | opObj11.addParameter(name='wr_exp', value='RHI') |
|
224 | 233 | |
|
225 | 234 | if plot_ppi==1: |
|
226 | 235 | opObj11 = procUnitConfObjB.addOperation(name='Block360') |
|
227 | 236 | opObj11.addParameter(name='n', value='10', format='int') |
|
228 | 237 | opObj11.addParameter(name='mode', value=mode_proc, format='int') |
|
229 | 238 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
230 | 239 | opObj11= procUnitConfObjB.addOperation(name='WeatherPlot',optype='other') |
|
231 | 240 | opObj11.addParameter(name='save', value=figpath_pp_ppi) |
|
232 | 241 | opObj11.addParameter(name='save_period', value=1) |
|
233 | 242 | if plot_rhi==1: |
|
234 | 243 | opObj11 = procUnitConfObjB.addOperation(name='Block360') |
|
235 | 244 | opObj11.addParameter(name='n', value='10', format='int') |
|
236 | 245 | opObj11.addParameter(name='mode', value=mode_proc, format='int') |
|
237 | 246 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
238 | 247 | opObj11= procUnitConfObjB.addOperation(name='WeatherRHIPlot',optype='other') |
|
239 | 248 | opObj11.addParameter(name='save', value=figpath_pp_rhi) |
|
240 | 249 | opObj11.addParameter(name='save_period', value=1) |
|
241 | 250 | |
|
242 | 251 | controllerObj.start() |
General Comments 0
You need to be logged in to leave comments.
Login now