def setup_plots(self): """setup plotting commands""" depends = self.get_option(self.sctn,'depends') if depends == None: depends = '' self.plots = {} for v in self.variables: plot = plotcommand.plot('%s_%s'%(self.basename,v),[self.source],depends.split()) com = '%s -v%s'%(self.get_option(self.sctn,'plotcommand'),v) extra = self.get_option(self.sctn,v) if extra != None: com = '%s %s'%(com,extra) plot.plot_command = '%s %s'%(com,self.plotwidth) plot.convert_options = self.get_option(self.sctn,'convertargs') plot.thumb_size = int(self.get_option(self.sctn,'thumb_size')) # setup animation if self.animate: fps = self.get_option(self.sctn,'anim_fps') if fps != None: plot.avi_fps = int(fps) asize = self.get_option(self.sctn,'anim_size') if asize != None: plot.avi_size = int(asize) self.plots[v] = plot
def setup_plots(self): """setup plotting commands""" self.plots = {} basic_plot = self.get_option(self.sctn,'plotcommand') # check whether we should plot profile locations first_prof = 0 if self.plotlocation: first_prof = 1 # get names of profiles profstring = '' for p in self.variables[first_prof:]: profile = self.get_option(self.sctn,'%s_prof'%p) if profile==None: print 'Warning, no profile definition for profile %s'%v continue profstring = '%s -p%s'%(profstring,profile) plot = plotcommand.plot('%s_ploc'%(self.basename),[self.source]) plot.plot_command = '%s %s %s'%(self.get_option(self.sctn,'plotloc_command'),self.plotwidth,profstring) plot.convert_options = self.get_option(self.sctn,'plotloc_convert') plot.thumb_size = int(self.get_option(self.sctn,'thumb_size')) self.plots['locations'] = plot for v in self.variables[first_prof:]: profile = self.get_option(self.sctn,'%s_prof'%v) if profile==None: print 'Warning, no profile definition for profile %s'%v continue prof_extra = self.get_option(self.sctn,'%s_extra'%v) if prof_extra==None: prof_extra = '' plot = plotcommand.plot('%s_%s'%(self.basename,v),[self.source],[profile]) plot.plot_command = '%s -p%s %s'%(basic_plot,profile,prof_extra) plot.convert_options = self.get_option(self.sctn,'convertargs') plot.thumb_size = int(self.get_option(self.sctn,'thumb_size')) # setup animation if self.animate: fps = self.get_option(self.sctn,'anim_fps') if fps != None: plot.avi_fps = int(fps) asize = self.get_option(self.sctn,'anim_size') if asize != None: plot.avi_size = int(asize) self.plots[v] = plot
def __init__(self,basename,config,sctn): self.section_type = 'RSL' self.template_name = 'rsl.tmpl' section.__init__(self,basename,config,sctn) TITLES = {'rsl':'relative sea-level curves', 'hist':'time dependent histograms of RSL residuals', 'res':'distribution of mean RSL residuals'} self.rslplots = ['rsl','hist','res'] rsldb = self.get_option(sctn,'rsldb') if rsldb != "": rsldb = "-r %s"%rsldb self.plots = {} for r in self.rslplots: plot = plotcommand.plot('%s_%s'%(basename,r),[self.source]) com = '%s %s'%(self.get_option(sctn,'%scommand'%r),rsldb) plot.plot_command = com cargs = self.get_option(sctn,'%sconvert'%r) if cargs==None: cargs = '' plot.convert_options = cargs plot.thumb_size = int(self.get_option(sctn,'thumb_size')) self.plots[r] = plot # create plots rsl = {} for r in self.rslplots: rsl[r] = {} rsl[r]['ps'] = os.path.basename(self.plots[r].plotps()) rsl[r]['png'] = os.path.basename(self.plots[r].plotpng()) rsl[r]['thumb'] = os.path.basename(self.plots[r].plotthumb()) rsl[r]['title'] = TITLES[r] # filling template self.template.rsl = self.rslplots self.template.numr = len(self.rslplots) self.template.rslplots = rsl