source: qesdi/geoplot/trunk/lib/geoplot/layer_drawer_coastline.py @ 5636

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/geoplot/trunk/lib/geoplot/layer_drawer_coastline.py@5636
Revision 5636, 1.9 KB checked in by pnorton, 11 years ago (diff)

Fixed a problem with imshow drawing a grid when there was no data to draw. Also fixed some of the tests.

Line 
1"""
2An object to draw just the layer (map + grid) from the plot,
3can draw to a file, a string or create an Image object.
4"""
5
6
7import logging
8import Image
9import StringIO
10import thread
11
12import numpy as N
13
14from matplotlib.patches import Rectangle
15from matplotlib.figure import Figure
16from matplotlib.backends.backend_agg import FigureCanvasAgg
17from matplotlib.lines import Line2D
18
19from geoplot.grid_builder_lat_lon import GridBuilderLatLon
20from geoplot.grid_builder_national import GridBuilderNational
21from geoplot.grid_builder_rotated import GridBuilderRotated
22
23
24from geoplot.layer_drawer import LayerDrawerBase
25
26log = logging.getLogger(__name__)
27
28class LayerDrawerCoastlines(LayerDrawerBase):
29    """
30    Creates a layer image of the coastline for a given projection and resolution.
31    """
32   
33    def __init__(self, projection='latlon', resolution='i', transparent=False, drawRivers=False):
34       
35        LayerDrawerBase.__init__(self, transparent=transparent,
36                                 projection=projection,
37                                 resolution=resolution)
38       
39        # must be done after the base constructor or the _mapFactory won't be
40        # created
41        self._mapFactory.drawRivers = drawRivers
42
43    def _drawToAxes(self, axes, xLimits, yLimits):
44        """
45        Draws the coastline form the map onto the axes.
46        """
47       
48        map = self._getMap(xLimits, yLimits)
49       
50        #draw the map onto the axes
51        map.drawMap(axes)
52       
53        #map.basemap.fillcontinents(color='coral',lake_color='aqua', ax=axes)
54        #map.basemap.bluemarble(ax=axes)
55
56    def __set_drawRivers(self, value):
57        self._mapFactory.drawRivers = value
58       
59    def __get_drawRivers(self):
60        return self._mapFactory.drawRivers
61   
62    drawRivers = property(__get_drawRivers, __set_drawRivers)   
63     
64               
65
66   
67       
Note: See TracBrowser for help on using the repository browser.