Changeset 3568 for DPPP


Ignore:
Timestamp:
07/03/08 16:48:33 (11 years ago)
Author:
spascoe
Message:

Some changes to work behind a proxy and other misc. stuff.

Location:
DPPP/ukcip02_server/trunk/ukcip_server
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DPPP/ukcip02_server/trunk/ukcip_server/development.ini

    r3565 r3568  
    1515[server:main] 
    1616use = egg:Paste#http 
    17 host = 0.0.0.0 
     17host = westerly.badc.rl.ac.uk 
    1818port = 8421 
    1919 
     
    2525beaker.session.secret = somesecret 
    2626ukcip02.data = %(here)s/../data/ukcip02.cdml 
     27# Proxy configuration 
     28filter-with = proxy_prefix 
     29 
     30[filter:proxy_prefix] 
     31use = egg:PasteDeploy#prefix 
     32prefix=/ktportals 
    2733 
    2834# If you'd like to fine-tune the individual locations of the cache data dirs 
     
    3541# Debug mode will enable the interactive debugging tool, allowing ANYONE to 
    3642# execute malicious code after an exception is raised. 
    37 #set debug = false 
     43set debug = false 
    3844 
    3945 
  • DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/model/pywms/impl.py

    r3565 r3568  
    1919 
    2020    """ 
    21     def __init__(self, cdmsVar, GridClass=CdmsGrid): 
     21    def __init__(self, cdmsVar, GridClass=CdmsGrid, minValue=None, maxValue=None): 
    2222        try: 
    2323            self.title = cdmsVar.long_name 
    2424        except AttributeError: 
    2525            self.title = cdmsVar.id 
    26              
    27         self._layer = SimpleCdmsLayer(cdmsVar, title, GridClass=GridClass) 
     26 
     27        self._layer = SimpleCdmsLayer(cdmsVar, minValue=minValue, maxValue=maxValue, GridClass=GridClass) 
    2828        self.abstract = None 
    2929        self.crss = [GridClass.crs] 
     
    5353 
    5454    def getCacheKey(self, crs, dimValues=None, renderOpts={}): 
    55         return '%s:%s:%s' % (crs, dimValues, renderOpts) 
     55        # Don't support caching 
     56        return None 
    5657 
    5758class CdmsLayerSlab(ILayerSlab): 
     
    6970        cmap = get_cmap(self.renderOpts.get('cmap', 'jet')) 
    7071 
    71         return self._renderer.renderGrid(grid, bbox, width, height, cmap) 
     72        img = self._renderer.renderGrid(grid, bbox, width, height, cmap) 
     73        img.save('dump.png') 
     74 
     75        return img 
    7276 
    7377    def getCacheKey(self): 
  • DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/model/pywms/render_imp.py

    r3495 r3568  
    4848        # Get a pixel = grid-box image for the grid 
    4949        img = self._grid2Img(grid, cmap) 
    50         img.save('raw.png') 
    5150 
    5251        # Calculate the pixel-size of a grid box 
     
    10099        a = self._norm(grid.value) 
    101100        img_buf = (cmap(a) * 255).astype('b') 
    102         if a.mask is not False: 
    103             logger.debug('Masking grid') 
    104             alpha_buf = (-a.mask*255 + 255).astype('b') 
    105         else: 
    106             alpha_buf = None 
    107101 
    108102        # This code assumes the axis ordering is either (y, x, time) or (x, y, time) 
     
    116110     
    117111        img = Image.frombuffer("RGBA", img_buf.shape[1::-1], img_buf.tostring(), "raw", "RGBA", 0, 1) 
    118         if alpha_buf is not None: 
    119             alpha = Image.frombuffer("L", img_buf.shape[1::-1], alpha_buf.tostring(), "raw", "L", 0, 1) 
    120             img.putalpha(alpha) 
    121  
    122         img.save('raw2.png') 
     112        img.save('raw1.png') 
    123113 
    124114        # Rotate if axis order is x, y 
  • DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/model/ukcip02.py

    r3565 r3568  
    1818 
    1919 
     20# Hard-coded min/max values 
     21ranges = { 
     22    'rainfall': (0.0, 1100.0), 
     23    'rain_days': (0.0, 31.0), 
     24    'mean_temp': (-8.0, 22.0) 
     25    } 
     26 
    2027class UKCIP02LayerMapper(ILayerMapper): 
    2128    def __init__(self): 
     
    3138            log.debug('Found layer %s' % varName) 
    3239            #!TODO: Min/Max values 
    33             layers[varName] = CdmsLayer(ds[varName], GridClass=CdmsBNGGrid) 
     40            layers[varName] = CdmsLayer(ds[varName], GridClass=CdmsBNGGrid, 
     41                                        minValue=ranges[varName][0], 
     42                                        maxValue=ranges[varName][1]) 
    3443 
    3544        return layers 
Note: See TracChangeset for help on using the changeset viewer.