Ignore:
Timestamp:
26/07/07 14:50:27 (12 years ago)
Author:
spascoe
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/lib/ddp_render.py

    r2742 r2744  
    1111 
    1212import logging 
    13  
    14 def plot(ax, var): 
    15     lat = var.getLatitude().getValue() 
    16     lon = var.getLongitude().getValue() 
    17     var0 = var[0][0] 
    18     pylab.pcolormesh(lon, lat, var0) 
    19  
    2013 
    2114def grid_corners_to_mesh(grid_corner_lat, grid_corner_lon, 
     
    151144    bbox = (-16.5, 47.0, 4.5, 61.5) 
    152145 
     146    # Initialise logging 
     147    logging.basicConfig(level=logging.INFO) 
     148    logger = logging.getLogger('mpl_render') 
     149 
    153150    # Create the map projection 
     151    logger.info('Initialising Basemap') 
    154152    bm = Basemap(projection='merc', 
    155153                 resolution='l', 
     
    165163    xlim, ylim = bm(bbox[::2], bbox[1::2]) 
    166164     
    167     # Initialise logging 
    168     logging.basicConfig(level=logging.INFO) 
    169     logger = logging.getLogger('mpl_render') 
    170  
    171165    f = cdms.open(filename) 
    172166    g = cdms.open(grid_filename) 
     
    176170 
    177171    for variable in f.listvariables(): 
     172 
     173        #!DEBUG: Shortcut for debugging 
     174        if variable != 'temp': 
     175            continue 
     176         
    178177 
    179178        # Only do variables with a grid (i.e. miss axes) 
     
    203202        minValue = min(var.flat) 
    204203        maxValue = max(var.flat) 
     204 
     205        # Initialise the matplotlib figure 
     206        fig = pylab.gcf() 
     207        # Make sure the aspect ratio of the figure is correct 
     208        fig_width = 8.0 
     209        fig_height = (ylim[1]-ylim[0])/(xlim[1]-xlim[0]) * fig_width 
     210        logging.info('Setting figure size to %s, %s' % (fig_width, fig_height)) 
     211        fig.set_size_inches(fig_width, fig_height) 
    205212 
    206213        # Initialise the matplotlib axes 
Note: See TracChangeset for help on using the changeset viewer.