@@ -15,12 +15,12 import datetime | |||
|
15 | 15 | from collections import deque |
|
16 | 16 | from functools import wraps |
|
17 | 17 | from threading import Thread |
|
18 | import matplotlib | |
|
18 | import matplotlib,re | |
|
19 | 19 | |
|
20 | 20 | if 'BACKEND' in os.environ: |
|
21 | 21 | matplotlib.use(os.environ['BACKEND']) |
|
22 | 22 | elif 'linux' in sys.platform: |
|
23 |
matplotlib.use(" |
|
|
23 | matplotlib.use("Agg")#TkAgg | |
|
24 | 24 | elif 'darwin' in sys.platform: |
|
25 | 25 | matplotlib.use('MacOSX') |
|
26 | 26 | else: |
@@ -44,8 +44,11 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list( | |||
|
44 | 44 | 'jro', numpy.vstack((blu_values, jet_values))) |
|
45 | 45 | matplotlib.pyplot.register_cmap(cmap=ncmap) |
|
46 | 46 | |
|
47 | rwg=matplotlib.colors.LinearSegmentedColormap.from_list('rwg',["r", "w", "g"], N=256) | |
|
48 | matplotlib.pyplot.register_cmap(cmap=rwg) | |
|
49 | ||
|
47 | 50 | CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'viridis', |
|
48 | 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm')] | |
|
51 | 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm','rwg')] | |
|
49 | 52 | |
|
50 | 53 | EARTH_RADIUS = 6.3710e3 |
|
51 | 54 | |
@@ -486,7 +489,10 class Plot(Operation): | |||
|
486 | 489 | figpause(0.01) |
|
487 | 490 | |
|
488 | 491 | if self.save: |
|
489 | self.save_figure(n) | |
|
492 | if self.CODE=="PPI" or self.CODE=="RHI": | |
|
493 | self.save_figure(n,stitle =self.titles) | |
|
494 | else: | |
|
495 | self.save_figure(n) | |
|
490 | 496 | |
|
491 | 497 | if self.server: |
|
492 | 498 | self.send_to_server() |
@@ -505,9 +511,13 class Plot(Operation): | |||
|
505 | 511 | metadata.update(meta) |
|
506 | 512 | self.data.update(data, timestamp, metadata) |
|
507 | 513 | |
|
508 | def save_figure(self, n): | |
|
514 | def save_figure(self, n,stitle=None): | |
|
509 | 515 | ''' |
|
510 | 516 | ''' |
|
517 | if stitle is not None: | |
|
518 | s_string = re.sub(r"[^A-Z0-9.]","",str(stitle)) | |
|
519 | new_string=s_string[:3]+"_"+"_"+s_string[4:6]+"_"+s_string[6:] | |
|
520 | ||
|
511 | 521 | if self.oneFigure: |
|
512 | 522 | if (self.data.max_time - self.save_time) <= self.save_period: |
|
513 | 523 | return |
@@ -518,16 +528,29 class Plot(Operation): | |||
|
518 | 528 | |
|
519 | 529 | if self.throttle == 0: |
|
520 | 530 | if self.oneFigure: |
|
521 |
|
|
|
522 |
|
|
|
523 |
self.save |
|
|
524 | '{}_{}.png'.format( | |
|
531 | if stitle is not None: | |
|
532 | figname = os.path.join( | |
|
533 | self.save, | |
|
525 | 534 | self.save_code, |
|
526 | self.getDateTime(self.data.max_time).strftime( | |
|
527 |
|
|
|
528 | ), | |
|
535 | '{}_{}_{}.png'.format( | |
|
536 | self.save_code, | |
|
537 | self.getDateTime(self.data.max_time).strftime( | |
|
538 | '%Y%m%d_%H%M%S', | |
|
539 | ), | |
|
540 | new_string, | |
|
541 | ) | |
|
529 | 542 | ) |
|
530 |
|
|
|
543 | else: | |
|
544 | figname = os.path.join( | |
|
545 | self.save, | |
|
546 | self.save_code, | |
|
547 | '{}_{}.png'.format( | |
|
548 | self.save_code, | |
|
549 | self.getDateTime(self.data.max_time).strftime( | |
|
550 | '%Y%m%d_%H%M%S' | |
|
551 | ), | |
|
552 | ) | |
|
553 | ) | |
|
531 | 554 | else: |
|
532 | 555 | figname = os.path.join( |
|
533 | 556 | self.save, |
General Comments 0
You need to be logged in to leave comments.
Login now