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

Last change on this file since 400 was 396, checked in by acolaitis, 14 years ago

PYTHON. Corrected bugs relative to multi-field plotting and to column integration

File size: 1.6 KB
RevLine 
[361]1
2### A. Colaitis -- LMD -- 08/11/2011
3
[364]4def call_zrecast (  interp_mode   = '4', \
[361]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")
[396]18        for zvar in fields:
[361]19            system("echo "+zvar+" >> zrecast.auto.def")
20        system("echo >> zrecast.auto.def")
21        if interp_mode == 4:
[363]22             append="_S"
[361]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:
[363]27             append="_P"
[361]28             system("echo 1 >> zrecast.auto.def")
29             system("echo yes >> zrecast.auto.def")
[385]30             system("echo 370 0.1 >> zrecast.auto.def")  #I put that randomly! (a.c.)
31             system("echo 20 >> zrecast.auto.def")
[361]32        else:
33             print "zrecast interp option unsupported for now. Exiting."
34             exit()
35        system("zrecast.e < zrecast.auto.def")
[363]36
[361]37        if indicefile is 0:
[363]38              outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
[361]39        else:
[363]40              outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
[361]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.