class DV3D: def __init__( self, **args ): self.plot = None def init(self, **args ): init_args = args[ 'init' ] ( grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace ) = init_args df = cdms2.open( data_file ) var = df[ varnames[0] ] grid_metadata = var.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) if plot_type == PlotType.Grid: self.plot = RectGridPlot(**args) self.plot.init( **args ) else: self.plot = CPCPlot(**args) self.plot.init( **args ) def getRenderWindow(self): return self.plot.renderWindow
class DV3D: def __init__(self, **args): self.plot = None def init(self, **args): init_args = args['init'] (grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace) = init_args df = cdms2.open(data_file) var = df[varnames[0]] grid_metadata = var.getGrid() plot_type = args.get('plot_type', PlotType.getPointsLayout(grid_metadata)) if plot_type == PlotType.Grid: self.plot = RectGridPlot(**args) self.plot.init(**args) else: self.plot = CPCPlot(**args) self.plot.init(**args) def getRenderWindow(self): return self.plot.renderWindow
def gminit(self, var1, var2, **args ): grid_metadata = var1.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit( var1, var2, **args ) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit( var1, var2, **args ) else: self.plot.updateModule()
def gminit(self, var1, var2, **args ): grid_metadata = var1.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) args[ 'cell_coordinates' ] = self.cell_coordinates if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit( var1, var2, **args ) self.plot.ParameterValueChanged.connect(self.canvas.processParameterChange) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit( var1, var2, **args ) self.plot.ParameterValueChanged.connect(self.canvas.processParameterChange) else: self.plot.updateModule()
def init(self, **args ): var= None init_args = args.get( 'init', None ) if init_args: ( grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace ) = init_args df = cdms2.open( data_file ) var = df[ varnames[0] ] else: print>>sys.stderr, "Error, this method requires an init_args argument" if id(var) <> id(None): grid_metadata = var.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) if plot_type == PlotType.Grid: self.plot = RectGridPlot(**args) self.plot.init( **args ) else: self.plot = CPCPlot(**args) self.plot.init( **args )
def gminit(self, var1, var2, **args): grid_metadata = var1.getGrid() plot_type = args.get('plot_type', PlotType.getPointsLayout(grid_metadata)) args['cell_coordinates'] = self.cell_coordinates if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit(var1, var2, **args) self.plot.ParameterValueChanged.connect( self.canvas.processParameterChange) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit(var1, var2, **args) self.plot.ParameterValueChanged.connect( self.canvas.processParameterChange) else: self.plot.updateModule()
def getParameterList(self, **args): var = args.get('var', None) extra_parms = args.get('extras', []) if var <> None: from Application import getPlotFromVar plot = getPlotFromVar(var, cm=self) else: from RectilinearGridPlot import RectGridPlot from PointCloudViewer import CPCPlot p1 = RectGridPlot(cm=self, display=False) p2 = CPCPlot(cm=self, display=False) parameter_list = set() parameter_list.add('Configure') for cpi in self.parameters.items(): basename = get_parameter_name(cpi[0]) parameter_list.add(basename) for pname in extra_parms: parameter_list.add(pname) # print "Generated parameter_list: " , str( parameter_list ) return parameter_list
class DV3DApp: def __init__( self, canvas, cell_coordinates=None, **args ): self.plot = None self.canvas = canvas self.cell_coordinates = cell_coordinates # def init(self, **args ): # var= None # init_args = args.get( 'init', None ) # if init_args: # ( grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace ) = init_args # df = cdms2.open( data_file ) # var = df[ varnames[0] ] # else: # print>>sys.stderr, "Error, this method requires an init_args argument" # # if id(var) <> id(None): # self.plot = getPlotFromVar( var, **args ) # self.plot.init( **args ) def update( self, tmpl ): if self.plot <> None: self.plot.updateModule() def applyAction( self, action ): if self.plot <> None: self.plot.applyAction( action ) def setAnimationStepper( self, stepper ): self.plot.setAnimationStepper( stepper ) def gminit(self, var1, var2, **args ): grid_metadata = var1.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) args[ 'cell_coordinates' ] = self.cell_coordinates if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit( var1, var2, **args ) self.plot.ParameterValueChanged.connect(self.canvas.processParameterChange) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit( var1, var2, **args ) self.plot.ParameterValueChanged.connect(self.canvas.processParameterChange) else: self.plot.updateModule() def getRenderWindow(self): return self.plot.renderWindow # def onKeyEvent( self, eventArgs ): # return self.plot.onKeyEvent( eventArgs ) def terminate( self ): return self.plot.terminate( ) def start(self): iren = self.plot.renderWindow.GetInteractor() iren.Start()
class DV3DApp: def __init__( self, **args ): self.plot = None def init(self, **args ): var= None init_args = args.get( 'init', None ) if init_args: ( grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace ) = init_args df = cdms2.open( data_file ) var = df[ varnames[0] ] else: print>>sys.stderr, "Error, this method requires an init_args argument" if id(var) <> id(None): grid_metadata = var.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) if plot_type == PlotType.Grid: self.plot = RectGridPlot(**args) self.plot.init( **args ) else: self.plot = CPCPlot(**args) self.plot.init( **args ) def update( self, tmpl ): if self.plot <> None: self.plot.updateModule() def gminit(self, var1, var2, **args ): grid_metadata = var1.getGrid() plot_type = args.get( 'plot_type', PlotType.getPointsLayout( grid_metadata ) ) if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit( var1, var2, **args ) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit( var1, var2, **args ) else: self.plot.updateModule() def getRenderWindow(self): return self.plot.renderWindow # def onKeyEvent( self, eventArgs ): # return self.plot.onKeyEvent( eventArgs ) def terminate( self ): return self.plot.terminate( ) def start(self): iren = self.plot.renderWindow.GetInteractor() iren.Start()
class DV3DApp: def __init__(self, canvas, cell_coordinates=None, **args): self.plot = None self.canvas = canvas self.cell_coordinates = cell_coordinates # def init(self, **args ): # var= None # init_args = args.get( 'init', None ) # if init_args: # ( grid_file, data_file, interface, varnames, grd_coords, var_proc_op, ROI, subSpace ) = init_args # df = cdms2.open( data_file ) # var = df[ varnames[0] ] # else: # print>>sys.stderr, "Error, this method requires an init_args argument" # # if id(var) <> id(None): # self.plot = getPlotFromVar( var, **args ) # self.plot.init( **args ) def update(self, tmpl): if self.plot <> None: self.plot.updateModule() def applyAction(self, action): if self.plot <> None: self.plot.applyAction(action) def setAnimationStepper(self, stepper): self.plot.setAnimationStepper(stepper) def gminit(self, var1, var2, **args): grid_metadata = var1.getGrid() plot_type = args.get('plot_type', PlotType.getPointsLayout(grid_metadata)) args['cell_coordinates'] = self.cell_coordinates if plot_type == PlotType.Grid: if self.plot == None: self.plot = RectGridPlot(**args) self.plot.gminit(var1, var2, **args) self.plot.ParameterValueChanged.connect( self.canvas.processParameterChange) else: self.plot.updateModule() else: if self.plot == None: self.plot = CPCPlot(**args) self.plot.gminit(var1, var2, **args) self.plot.ParameterValueChanged.connect( self.canvas.processParameterChange) else: self.plot.updateModule() def getRenderWindow(self): return self.plot.renderWindow # def onKeyEvent( self, eventArgs ): # return self.plot.onKeyEvent( eventArgs ) def terminate(self): return self.plot.terminate() def start(self): iren = self.plot.renderWindow.GetInteractor() iren.Start()
def getPlotFromVar(var, **args): grid_metadata = var.getGrid() plot_type = args.get('plot_type', PlotType.getPointsLayout(grid_metadata)) plot = RectGridPlot(**args) if (plot_type == PlotType.Grid) else CPCPlot( **args) return plot