source: cows/trunk/cows/service/imps/data_reader_geoplot_backend/geoplot_slabs/geoplot_slab_contour.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_contour.py@5945
Revision 5945, 1.9 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 logging
2import time
3
4from geoplot.layer_drawer_contour import LayerDrawerContour
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
11
12
13class GeoplotSlabContour(GeoplotSlabBase):
14
15    style = 'contour'
16    title = 'Contour Lines'
17                     
18    renderingOptions = GeoplotSlabBase.renderingOptions + [       
19        RenderingOption('num_contour_lines', "Number of Contour Lines" ,int,10),
20        RenderingOption('contour_font_size', "Contour Label Size" ,str,'medium',["small","medium", "large",]),
21        RenderingOption('contour_label_interval', "Interval Between Labels" ,int,1),
22    ]
23
24    def _setupLayerDrawer(self):
25       
26        cmapMin = self.parser.getOption('cmap_min')
27        if cmapMin == None:
28            cmapMin = self.variable.min()
29       
30        cmapMax = self.parser.getOption('cmap_max')
31        if cmapMax == None:
32            cmapMax = self.variable.max()
33       
34        ld = LayerDrawerContour(self.variable, 
35                                 cmap=self.parser.getOption('cmap'), 
36                                 colourBarMin=cmapMin,
37                                 colourBarMax=cmapMax,
38                                 bgcolour = self.bgcolour,
39                                 colourBarScale = self.parser.getOption('cmap_scale'),
40                                 labelInterval= self.parser.getOption('contour_label_interval'),
41                                 numLines = self.parser.getOption('num_contour_lines'),
42                                 fontSize = self.parser.getOption('contour_font_size'),
43                                 intervals = self.parser.getOption('intervals'),
44                                 transparent=self.transparent)
45       
46        return ld
47
48
49               
50   
51
Note: See TracBrowser for help on using the repository browser.