source: trunk/UTIL/PYTHON/zrecast_wrapper.py @ 385

Last change on this file since 385 was 385, checked in by acolaitis, 13 years ago

PYTHON. Minor commit to avoid loosing stuff when gnome is down tomorrow.

File size: 1.6 KB
Line 
1
2### A. Colaitis -- LMD -- 08/11/2011
3
4def call_zrecast (  interp_mode   = '4', \
5                    input_name      = None, \
6                    fields  = 'all'):
7
8    import numpy as np
9    from myplot import separatenames
10    from os import system
11
12    system("rm -f zrecast.auto.def")
13    system("touch zrecast.auto.def")
14    indicefile=0
15    outputfilename=""
16    for zfile in input_name:
17        system("echo "+zfile+" >> zrecast.auto.def")
18        for zvar in [fields]:
19            system("echo "+zvar+" >> zrecast.auto.def")
20        system("echo >> zrecast.auto.def")
21        if interp_mode == 4:
22             append="_S"
23             system("echo 3 >> zrecast.auto.def")
24             system("echo yes >> zrecast.auto.def")
25             system("echo 0 150000 >> zrecast.auto.def")
26        elif interp_mode == 2:
27             append="_P"
28             system("echo 1 >> zrecast.auto.def")
29             system("echo yes >> zrecast.auto.def")
30             system("echo 370 0.1 >> zrecast.auto.def")  #I put that randomly! (a.c.)
31             system("echo 20 >> zrecast.auto.def")
32        else:
33             print "zrecast interp option unsupported for now. Exiting."
34             exit()
35        system("zrecast.e < zrecast.auto.def")
36
37        if indicefile is 0:
38              outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
39        else:
40              outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
41        indicefile = indicefile +1
42
43        for i in range(len(outputfilename)):
44            output_name = separatenames(outputfilename)
45
46    return output_name
47
Note: See TracBrowser for help on using the repository browser.