source: cows/trunk/cows/service/imps/data_reader_geoplot_backend/geoplot_slabs/geoplot_slab_grid.py @ 5945

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/service/imps/data_reader_geoplot_backend/geoplot_slabs/geoplot_slab_grid.py@5945
Revision 5945, 1.8 KB checked in by pnorton, 11 years ago (diff)

Improved the csml_data_reader so that it no longer assumes the feature id is the variable name.

Improved the data reader layer so that it now gets the dataset name from the csml file.

Added some code to the geoplot slabs that is used for selecting a log scale.

Line 
1import time
2import logging
3
4from geoplot.layer_drawer_grid import LayerDrawerGrid
5from geoplot.layer_drawer_grid_fast import LayerDrawerGridFast
6
7from cows.service.imps.data_reader_geoplot_backend.rendering_option import RenderingOption
8from cows.service.imps.data_reader_geoplot_backend.geoplot_slabs.geoplot_slab_base import GeoplotSlabBase
9
10log = logging.getLogger(__name__)
11
12class GeoplotSlabGrid(GeoplotSlabBase):
13
14    style = 'grid'
15    title = 'Grid Boxes'
16                       
17    renderingOptions = GeoplotSlabBase.renderingOptions +[     
18        RenderingOption('disable_subset', "Disable Subsetting" ,bool,False),
19        RenderingOption('show_grid_lines', "Draw Grid Boxes" ,bool,False),
20    ]
21       
22    def _setupLayerDrawer(self):
23       
24        cmapMin = self.parser.getOption('cmap_min')
25        cmapMax = self.parser.getOption('cmap_max')
26           
27        intervalNames = self.parser.getOption('intervalNames')
28        if intervalNames != None:
29            intervalNames = intervalNames.split(',')
30       
31        log.debug("self.transparent = %s" % (self.transparent,))
32        log.debug("self.bgcolour = %s" % (self.bgcolour,))
33   
34        if self.parser.getOption('disable_subset'):
35            ldClass = LayerDrawerGrid
36        else:
37            ldClass = LayerDrawerGridFast
38   
39   
40        ld = ldClass(self.variable, 
41                     cmap=self.parser.getOption('cmap'), 
42                     showGridLines=self.parser.getOption('show_grid_lines'), 
43                     colourBarMin=cmapMin,
44                     colourBarMax=cmapMax,
45                     colourBarScale = self.parser.getOption('cmap_scale'),
46                     bgcolour = self.bgcolour,
47                     intervals = self.parser.getOption('intervals'),   
48                     transparent=self.transparent)
49       
50        return ld
51 
Note: See TracBrowser for help on using the repository browser.