source: TI04-geosplat/trunk/gsc/scripts/animationTester.py @ 798

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI04-geosplat/trunk/gsc/scripts/animationTester.py@798
Revision 798, 3.1 KB checked in by astephen, 14 years ago (diff)

Latest working version with install method.
Can accept more than one file but doesn't combine variables yet.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3keys=["filename", "var", "plotclass", "plottype", "format", "projection", "imagesize", "cont", 
4      "axisYForAnimation","axisXForAnimation", "axisLoopForAnimation"]
5tests=[["/dxd/3dlevsmall.nc", "t", "Animation", "isofill", "gif", "standard", "300x200", "on", "latitude","longitude","level"],
6       ["/dxd/3dlevsmall.nc", "t", "Animation", "boxfill", "gif", "standard", "600x400", "off", "latitude","level","longitude"],
7       ["/dxd/3dlevsmall.nc", "t", "Animation", "isoline", "gif", "standard", "600x400", "on", "latitude","longitude","level"]]
8
9
10tests.reverse() 
11
12   
13import sys
14sys.path.append("..")
15sys.path.append(".")
16sys.path.append("testSuite")
17import readline
18from ZSI.client import Binding
19from clientConfig import SOAP_SERVER_PORT
20from common import *
21import os,shutil
22from clientConfig import OUTPUT_DIR_LOCAL_PATH, OUTPUT_DIR_URL_PATH
23
24for test in [tests[1]]:
25    print "Setting internal parameters for this test: ",test[3]
26    for i in range(len(keys)):
27        exec('%s="%s"' % (keys[i], test[i]))
28
29    # start session
30    print "Start session..."
31    server = Binding(url="", host="localhost", port=SOAP_SERVER_PORT)
32
33    (sessionID, secureToken)=server.startSession("jane", "jane1")
34    print (sessionID, secureToken)
35
36    print "\nProvide file URIs..."
37    (optionCategories, options, \
38               optionStrings, secureToken)=server.provideFileURIs(sessionID, secureToken, [filename])
39               
40    print (optionCategories, options, optionStrings, secureToken)
41               
42
43    print "\nSelecting variables from files..."       
44    output=server.selectOptions(sessionID, [["secureToken", secureToken], ["fileVariable_1.1", var]])
45    output=deUnicodeObject(output)
46    print output
47
48    print "\nSelecting graphical outputs from options..."
49    output=server.selectOptions(sessionID, [["secureToken", secureToken], ["graphicalOutputType", "%s_1.1" % plotclass]])
50    output=deUnicodeObject(output)
51    print output
52
53    print "\nSelecting animation axes..."
54    output=server.selectOptions(sessionID, [["secureToken", secureToken], ["axisXForAnimation", axisXForAnimation],["axisYForAnimation", axisYForAnimation], ["axisLoopForAnimation", axisLoopForAnimation]])
55    output=deUnicodeObject(output)
56    print output
57
58    print "\nSelecting plot options..."
59    output=server.selectOptions(sessionID, [["secureToken",secureToken], ["plotType", plottype], ["fileFormat",format], \
60                                        ["projection", projection], ["imageSize", imagesize], ["continentsSwitch",cont]])
61    output=deUnicodeObject(output)
62    print output
63
64    print "\nCreating output..."
65    output=server.createOutput(sessionID, secureToken)
66    output=deUnicodeObject(output)
67    print output
68
69
70    path=str(output[0]).replace(OUTPUT_DIR_URL_PATH, OUTPUT_DIR_LOCAL_PATH)
71
72    if not os.path.exists(path):
73        raise "No such file: "+path
74    else:
75        newpath=filename+"_"+plottype+"."+path.split(".")[-1]
76        shutil.copy(path, newpath)
77       
78    print "LOOK at my file:", newpath
79    if path.split(".")[-1]=="ps":
80        os.system("gv %s &" % newpath) 
81    else:
82        os.system("konqueror %s &" % newpath)
Note: See TracBrowser for help on using the repository browser.