##// END OF EJS Templates
add information in save plot and barcolor rwg
jespinoza -
r1477:ac0997d078b2
parent child
Show More
@@ -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("TkAgg")
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,6 +489,9 class Plot(Operation):
486 489 figpause(0.01)
487 490
488 491 if self.save:
492 if self.CODE=="PPI" or self.CODE=="RHI":
493 self.save_figure(n,stitle =self.titles)
494 else:
489 495 self.save_figure(n)
490 496
491 497 if self.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,6 +528,19 class Plot(Operation):
518 528
519 529 if self.throttle == 0:
520 530 if self.oneFigure:
531 if stitle is not None:
532 figname = os.path.join(
533 self.save,
534 self.save_code,
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 )
542 )
543 else:
521 544 figname = os.path.join(
522 545 self.save,
523 546 self.save_code,
General Comments 0
You need to be logged in to leave comments. Login now