source: DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/model/ukcip02.py @ 3486

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

Capabilities almost done

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
14import logging
15log = logging.getLogger(__name__)
16
17data_dir = config['ukcip02.data_dir']
18log.debug('Data dir set to %s' % data_dir)
19
20layers = {}
21datasets = {}
22
23for f in glob(os.path.join(data_dir, '*.nc')):
24    log.debug('Looking for layers in %s' % f)
25    ds = cdms.open(f)
26    for varName in ds.listvariables():
27        log.debug('Found layer %s' % varName)
28        #!TODO: Min/Max values
29        layers[varName] = SimpleCdmsLayer(ds[varName], 0, 100, GridClass=CdmsBNGGrid)
30    datasets[f] = ds
31
32# We need to hard-code the bbox for now
33bbox = (-200000, -200000, 695000, 1245000)
Note: See TracBrowser for help on using the repository browser.