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

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@5692
Revision 5692, 1.4 KB checked in by pnorton, 11 years ago (diff)

Made some modifications to the data renderer backend. The display options are now attached to each of the slabs rather than being stored in the shared option parser and the controller.

I've also added some code to generate the display options JSON string.

Line 
1import time
2import logging
3
4from geoplot.layer_drawer_grid import LayerDrawerGrid
5
6from cows.service.imps.data_reader_geoplot_backend.rendering_option import RenderingOption
7from cows.service.imps.data_reader_geoplot_backend.geoplot_slabs.geoplot_slab_base import GeoplotSlabBase
8
9log = logging.getLogger(__name__)
10
11class GeoplotSlabGrid(GeoplotSlabBase):
12
13    style = 'grid'
14    title = 'Grid Boxes'
15                       
16    renderingOptions = [
17        RenderingOption('cmap', "Colour Scheme" ,str,'jet',["bone","jet", "copper", "gray", "winter"] ),
18        RenderingOption('cmap_min', "Legend Min" ,float,None),
19        RenderingOption('cmap_max', "Legend Max" ,float,None),
20        RenderingOption('show_grid_lines', "Draw Grid Boxes" ,bool,False),
21    ]                       
22       
23    def _setupLayerDrawer(self):
24       
25        cmapMin = self.parser.getOption('cmap_min')
26        if cmapMin == None:
27            cmapMin = self.variable.min()
28       
29        cmapMax = self.parser.getOption('cmap_max')
30        if cmapMax == None:
31            cmapMax = self.variable.max()
32       
33        ld = LayerDrawerGrid(self.variable, 
34                             cmap=self.parser.getOption('cmap'), 
35                             showGridLines=self.parser.getOption('show_grid_lines'), 
36                             cmapRange=(cmapMin, cmapMax),
37                             transparent=self.transparent)
38       
39        return ld
40 
Note: See TracBrowser for help on using the repository browser.