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

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

New interface works in view.html

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