source: qesdi/geoplot/trunk/lib/geoplot/contour_plot.py @ 5612

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/geoplot/trunk/lib/geoplot/contour_plot.py@5612
Revision 5612, 1.0 KB checked in by pnorton, 12 years ago (diff)

Have added some code that allows the grid drawer to decide if it should use imshow or pcolormesh to render the grid. This was done to get arround the problem of the grid cells having outlines when pcolormesh is used.

Also implemented a map function that chooses which basemap resolution to use if one isn't set.

Line 
1from geoplot.plot_base import PlotBase
2from geoplot.contour_drawer import ContourDrawer
3
4import logging
5
6log = logging.getLogger(__name__)
7
8class ContourPlot(PlotBase):
9    '''
10    Creates a contour plot form the data stored in a netCDF file
11    '''
12    _accessableObjects = ['_contourDrawer']
13    _accessableObjects.extend(PlotBase._accessableObjects)
14   
15    def __init__(self, **kwargs):
16        '''
17        Creates the contour plot
18        '''
19       
20        self._contourDrawer = ContourDrawer(**self._getArgs(kwargs, ContourDrawer.__name__))
21               
22        PlotBase.__init__(self, **kwargs)
23       
24    def _drawDiagram(self, map, grid, axes):
25       
26        log.debug("grid.values.min() = %s, grid.values.max() = %s" % (grid.values.min() , grid.values.max(),))
27        norm = self._colourBar.getNormalize(dataMin=grid.values.min(), dataMax=grid.values.max())
28        cmap = self._colourBar.getColourMap()
29       
30        self._contourDrawer.draw(axes, grid, map.basemap, norm, cmap, self.fontSize)
31   
Note: See TracBrowser for help on using the repository browser.