コード例 #1
0
ファイル: Application.py プロジェクト: UV-CDAT/UVIS_DV3D
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                 
コード例 #2
0
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
コード例 #3
0
 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() 
コード例 #4
0
ファイル: Application.py プロジェクト: arulalant/uvcdat
 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() 
コード例 #5
0
 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  ) 
コード例 #6
0
    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()
コード例 #7
0
    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
コード例 #8
0
ファイル: Application.py プロジェクト: arulalant/uvcdat
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()        
コード例 #9
0
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()        
コード例 #10
0
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()
コード例 #11
0
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