Ignore:
Timestamp:
Dec 9, 2011, 5:10:15 PM (13 years ago)
Author:
acolaitis
Message:

Added localtime.e and streamfunction.e to the gcm wrapper.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/gcm_transformations.py

    r465 r466  
    33### A. Colaitis -- LMD -- 08/11/2011 <-- Added ZRECAST for altitude mode, and MCS and TES modes for Pressure
    44### A. Colaitis -- LMD -- 08/11/2011 <-- Added HRECAST for MCS and TES predefined grids
    5 ###
    6 
    7 ### TODO
    8 ### add wrapper to streamfunction.e
    9 ### add wrapper to localtime.e
     5###                                      Added wrapper to streamfunction.e
     6###                                      Added wrapper to localtime.e
    107
    118def call_zrecast (  interp_mode   = '4', \
     
    119116    return output_name
    120117
     118def call_localtime (  input_name = None, \
     119                    fields  = 'all', \
     120                    times = None):
     121
     122    import numpy as np
     123    from myplot import separatenames
     124    from os import system
     125    system("rm -f localtime.auto.def")
     126    system("touch localtime.auto.def")
     127    indicefile=0
     128    outputfilename=""
     129    append="_LT"
     130    f = open('localtime.auto.def', 'w')
     131    for zfile in input_name:
     132        f.write(zfile+"\n")
     133        for zvar in fields:
     134             f.write(zvar+"\n")
     135        f.write("\n")
     136    f.write(str(len(times))+"\n")
     137    for t in times:
     138        f.write(str(t)+"\n")
     139    f.close()
     140    system("localtime.e < localtime.auto.def")
     141
     142    if indicefile is 0:
     143          outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
     144    else:
     145          outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
     146    indicefile = indicefile +1
     147
     148    for i in range(len(outputfilename)):
     149        output_name = separatenames(outputfilename)
     150
     151    return output_name
     152
     153def call_streamfunction (  input_name = None):
     154    import numpy as np
     155    from myplot import separatenames
     156    from os import system
     157    system("rm -f streamfunction.auto.def")
     158    system("touch streamfunction.auto.def")
     159    indicefile=0
     160    outputfilename=""
     161    append="_stream"
     162    f = open('streamfunction.auto.def', 'w')
     163    for zfile in input_name:
     164        f.write(zfile+"\n")
     165    f.close()
     166    system("streamfunction.e < streamfunction.auto.def")
     167
     168    if indicefile is 0:
     169          outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
     170    else:
     171          outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc"
     172    indicefile = indicefile +1
     173
     174    for i in range(len(outputfilename)):
     175        output_name = separatenames(outputfilename)
     176
     177    return output_name
     178
Note: See TracChangeset for help on using the changeset viewer.