Changeset 670 for trunk/UTIL/PYTHON/gcm_transformations.py
- Timestamp:
- May 25, 2012, 10:37:34 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/gcm_transformations.py
r489 r670 10 10 fields = 'all', \ 11 11 limites = None, \ 12 predefined = None): 12 predefined = None, \ 13 verbose = True): 13 14 14 15 import numpy as np … … 21 22 indicefile=0 22 23 outputfilename="" 23 f = open('zrecast.auto.def', 'w') 24 25 for zfile in input_name:24 25 for zfile in input_name: 26 f = open('zrecast.auto.def', 'w') 26 27 f.write(zfile+"\n") 27 28 for zvar in fields: … … 62 63 exit() 63 64 f.close() 64 system("zrecast.e < zrecast.auto.def") 65 if verbose: 66 system("zrecast.e < zrecast.auto.def") 67 else: 68 system("zrecast.e < zrecast.auto.def > /dev/null") 65 69 66 70 if indicefile is 0: … … 77 81 def call_hrecast ( input_name = None, \ 78 82 fields = 'all', \ 79 predefined = None): 83 predefined = None,\ 84 verbose = True): 80 85 81 86 import numpy as np … … 107 112 f.write(str(lat)+"\n") 108 113 f.close() 109 system("hrecast.e < hrecast.auto.def") 110 114 if verbose: 115 system("hrecast.e < hrecast.auto.def") 116 else: 117 system("hrecast.e < hrecast.auto.def > /dev/null") 118 111 119 if indicefile is 0: 112 120 outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc" … … 120 128 return output_name 121 129 122 def call_localtime ( input_name = None, \ 123 fields = 'all', \ 124 times = None): 130 def call_localtime (input_name = None, \ 131 fields = 'all', \ 132 times = None, \ 133 verbose = True): 125 134 126 135 import numpy as np … … 129 138 system("rm -f localtime.auto.def") 130 139 system("touch localtime.auto.def") 131 indicefile=0132 140 outputfilename="" 133 141 append="_LT" 134 f = open('localtime.auto.def', 'w') 135 for zfile in input_name: 142 output_name = [] 143 #print input_name 144 for zfile in input_name: 145 print 'LOCALTIME FOR FILE: '+zfile 146 f = open('localtime.auto.def', 'w') 147 #print zfile 136 148 f.write(zfile+"\n") 137 149 for zvar in fields: 138 150 f.write(zvar+"\n") 139 151 f.write("\n") 140 f.write(str(len(times))+"\n") 141 for t in times: 142 f.write(str(t)+"\n") 143 f.close() 144 system("localtime.e < localtime.auto.def") 145 146 if indicefile is 0: 147 outputfilename=input_name[indicefile][0:len(input_name[0])-3]+append+".nc" 148 else: 149 outputfilename=outputfilename+","+input_name[indicefile][0:len(input_name[0])-3]+append+".nc" 150 indicefile = indicefile +1 151 152 for i in range(len(outputfilename)): 153 output_name = separatenames(outputfilename) 154 155 return output_name 152 f.write(str(len(times))+"\n") 153 for t in times: 154 f.write(str(t)+"\n") 155 f.close() 156 if verbose: 157 system("localtime.e < localtime.auto.def") 158 else: 159 system("localtime.e < localtime.auto.def > /dev/null ") 160 #print input_name 161 zeoutput_name = zfile.replace('.nc','_LT'+str(times[0])+'.nc') 162 163 system("mv -f "+zfile.replace('.nc','_LT.nc')+" "+zeoutput_name) 164 165 output_name = np.append(output_name,zeoutput_name) 166 167 return output_name 168 156 169 157 170 def call_streamfunction ( input_name = None): … … 181 194 return output_name 182 195 196 197 def call_concat ( input_name = None, \ 198 fields = 'all', \ 199 begin = 0, \ 200 verbose = True): 201 202 import numpy as np 203 from os import system 204 system("rm -f concatnc.auto.def") 205 system("touch concatnc.auto.def") 206 207 f = open('concatnc.auto.def', 'w') 208 for zfile in input_name: 209 f.write(zfile+"\n") 210 211 f.write("\n") 212 f.write(str(begin)+"\n") 213 f.write("sol"+"\n") 214 215 for zvar in fields: 216 f.write(zvar+"\n") 217 f.write("\n") 218 219 f.close() 220 if verbose: 221 system("concatnc.e < concatnc.auto.def") 222 else: 223 system("concatnc.e < concatnc.auto.def > /dev/null") 224 225 226 #output_name = 'concat' + input_name[0].replace('diagfi','').replace('.nc','') \ 227 # + '_' + input_name[len(input_name)-1].replace('diagfi','').replace('.nc','') + '.nc' 228 229 #system('mv -f concat.nc '+output_name) 230 231 output_name = 'concat.nc' 232 233 return [output_name] 234 235 236 237 def call_lslin ( input_name = None, \ 238 begin = 0,\ 239 timestep = None,\ 240 isconcat = True, \ 241 verbose = True): 242 243 import numpy as np 244 from os import system 245 system("rm -f lslin.auto.def") 246 system("touch lslin.auto.def") 247 248 f = open('lslin.auto.def', 'w') 249 250 f.write(input_name[0]+"\n") 251 if isconcat: 252 f.write("y"+"\n") 253 else: 254 f.write("n"+"\n") 255 256 f.write(str(begin)+"\n") 257 if timestep is None: 258 f.write("y"+"\n") 259 else: 260 f.write("n"+"\n") 261 f.write(str(timestep)+"\n") 262 263 264 f.close() 265 if verbose: 266 system("lslin.e < lslin.auto.def") 267 else: 268 system("lslin.e < lslin.auto.def > /dev/null") 269 270 output_name = input_name[0].replace('.nc','_Ls.nc') 271 272 return [output_name] 273 274 275 276
Note: See TracChangeset
for help on using the changeset viewer.