source: DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/config/ukcip02.py @ 3371

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/config/ukcip02.py@3371
Revision 3371, 647 bytes checked in by spascoe, 12 years ago (diff)

Basic GetMap? works. No GetCapabilities? yet.

Line 
1"""
2Load UKCIP02 data
3
4"""
5
6import os
7from glob import glob
8
9from pylons import config
10from ukcip_server.model.pywms.wms_cdms import SimpleCdmsLayer, CdmsBNGGrid
11
12import cdms
13
14def load_data():
15    data_dir = config['ukcip02.data_dir']
16
17    layers = {}
18    datasets = {}
19    for f in glob(os.path.join(data_dir, '*.nc')):
20        ds = cdms.open(f)
21        for varName in ds.listvariables():
22            #!TODO: Min/Max values
23            layers[varName] = SimpleCdmsLayer(ds[varName], 0, 100, GridClass=CdmsBNGGrid)
24        datasets[f] = ds
25       
26    config['pylons.g'].ukcip02_datasets = datasets
27    config['pylons.g'].ukcip02_layers = layers
Note: See TracBrowser for help on using the repository browser.