source: TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/service/imps/test_csmllayer.py @ 3620

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/service/imps/test_csmllayer.py@3620
Revision 3620, 2.4 KB checked in by domlowe, 12 years ago (diff)

csml wms working with correct bbox behaviour

Line 
1import wms_csmllayer
2import csml
3
4def test_layerMapper():
5    lm=wms_csmllayer.CSMLLayerMapper()
6    print 'building layermap'
7    file='hadgem1'
8    layers=lm.map(fileoruri=file)
9   
10    #for key, layer in layers.items():
11        #print '*********************'
12        #print 'name: %s'%key  #name is currently gml:id..
13        #print 'title: %s'%layer.title
14        #print 'abstract: %s'%layer.abstract
15        #print 'dimensions: %s'%layer.dimensions
16        #for dim in layer.dimensions:
17            #print layer.dimensions[dim].units
18            #print layer.dimensions[dim].extent
19        #print 'units: %s'%layer.units
20        #print 'crss: %s'%layer.crss
21        #print '*********************'
22       
23    #should be 35 features in this file
24    layerid='UkndO02d'
25    assert len(layers) == 35
26    assert layers[layerid].title == 'm1s3i223'
27    assert layers[layerid].abstract=='SURF & BL TOTL MOISTURE FLUX KG/M2/S'
28    assert layers[layerid].units == ['degrees_east', 'degrees_north', 'none', 'days_since_1970-01-01_00:00:0']
29    assert layers[layerid].crss == ['EPSG:4326']
30    assert layers[layerid].dimensions.keys() == ['latitude', 'z0_surface', 'longitude', 'time']
31    #layerid='EAY38o0Z'   #total precip
32    layerid='DiXD05pN' #solar_1
33    print 'getting slab...'
34    slab= layers[layerid].getSlab('EPSG:4324', dimValues={'time':'1999-12-06T12:00:00.0', 'z0_surface':'0'})
35    img=slab.getImage((-80, -160, 80, 160) ,320, 320)
36    img.save("testimage.jpeg", "JPEG")
37    print 'getting slab2...'
38    slab2= layers[layerid].getSlab('EPSG:4324', dimValues={'time':'1998-12-06T12:00:00.0', 'z0_surface':'0'})
39    img2=slab2.getImage((-80, -160, 80, 160) ,320, 320)
40    img2.save("testimage2.jpeg", "JPEG")
41   
42    #Temperature:
43    print 'getting slab3...'
44    layerid = 'RJ1QcBwz'
45    slab3= layers[layerid].getSlab('EPSG:4324', dimValues={'time':'1995-12-06T12:00:00.0', 'height':'0'})
46    img3=slab3.getImage((-80, -160, 80, 160) ,320, 320)
47    img3.save("testimage3.jpeg", "JPEG")
48   
49    print 'getting lots of images'
50    miny=-90
51    minx=-180
52    maxy=90
53    maxx=180
54    for i in range(8):
55        miny=miny+10
56        minx=minx+10
57        maxy=maxy -10
58        maxx=maxx-10
59        img=slab3.getImage((miny, minx, maxy, maxy) ,320, 320)
60        img.save("sequence%s.jpeg"%str(i), "JPEG")
61   
62   
63   
64   
65   
66def main():
67    test_layerMapper()
68   
69if __name__=="__main__":
70    main()
Note: See TracBrowser for help on using the repository browser.