Changeset 361
- Timestamp:
- Nov 8, 2011, 5:01:15 PM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/gcm.py
r359 r361 1 1 #!/usr/bin/env python 2 2 3 ### T. Navarro + A. Spiga 3 ### T. Navarro + A. Spiga + A. Colaitis 4 4 5 5 ########################################################################################### … … 10 10 from optparse import OptionParser ### to be replaced by argparse 11 11 from api_wrapper import api_onelevel 12 from zrecast_wrapper import call_zrecast 12 13 from netCDF4 import Dataset 13 14 from myplot import getlschar, separatenames, readslices, adjust_length 14 15 from os import system 15 16 from planetoplot import planetoplot 17 16 18 import numpy as np 17 19 … … 71 73 print "Options:", opt 72 74 73 #listvar = '' 74 #if opt.var is None:75 #zerange = [-999999]76 #else:77 #zelen = len(opt.var)78 #zerange = range(zelen)79 ##if zelen == 1: listvar = opt.var[0] + ','80 # #else : 81 #for jjj in zerange: listvar += opt.var[jjj] + ','82 #listvar = listvar[0:len(listvar)-1]83 # vmintab = adjust_length (opt.vmin, zelen) 84 #vmaxtab = adjust_length (opt.vmax, zelen)75 # listvar = '' 76 # if opt.var is None: 77 # zerange = [-999999] 78 # else: 79 # zelen = len(opt.var) 80 # zerange = range(zelen) 81 # #if zelen == 1: listvar = opt.var[0] + ',' 82 # #else : 83 # for jjj in zerange: listvar += opt.var[jjj] + ',' 84 # listvar = listvar[0:len(listvar)-1] 85 # vmintab = adjust_length (opt.vmin, zelen) 86 # vmaxtab = adjust_length (opt.vmax, zelen) 85 87 86 88 … … 97 99 exit() 98 100 101 if opt.fref is not None: 102 if opt.operation is not None: 103 if opt.interp is not None: 104 interpref=True 105 99 106 ################################ 100 107 … … 125 132 126 133 zevar = separatenames(opt.var[j]) 134 zevars = zevar[j] 127 135 zevar = zevar[0] 128 136 print "var, zevar", opt.var, zevar … … 149 157 ##################################################### 150 158 ### Call Fortran routines for vertical interpolations --> zrecast for GCM ? 159 # if opt.interp is not None: 160 # if zelevel == 0. and opt.interp == 4: zelevel = 0.010 161 # ### winds or no winds 162 # if opt.winds : zefields = 'uvmet' 163 # else : zefields = '' 164 # ### var or no var 165 # #if opt.var is None : pass 166 # if zefields == '' : zefields = listvar 167 # else : zefields = zefields + "," + listvar 168 # if opt.var2 is not None : zefields = zefields + "," + opt.var2 169 # print zefields 170 # zefile = api_onelevel ( path_to_input = '', \ 171 # input_name = zefile, \ 172 # fields = zefields, \ 173 # interp_method = opt.interp, \ 174 # interp_level = ze_interp_levels, \ 175 # onelevel = zelevel, \ 176 # nocall = opt.nocall ) 177 # print zefile 178 # zelevel = 0 ## so that zelevel could play again the role of nvert 179 180 # A.C. ##################################################### 181 ### Call Fortran routines for vertical interpolations --> zrecast 182 151 183 if opt.interp is not None: 152 if zelevel == 0. and opt.interp == 4: zelevel = 0.010 153 ### winds or no winds 154 if opt.winds : zefields = 'uvmet' 155 else : zefields = '' 156 ### var or no var 157 #if opt.var is None : pass 158 if zefields == '' : zefields = listvar 159 else : zefields = zefields + "," + listvar 160 if opt.var2 is not None : zefields = zefields + "," + opt.var2 161 print zefields 162 zefile = api_onelevel ( path_to_input = '', \ 163 input_name = zefile, \ 164 fields = zefields, \ 165 interp_method = opt.interp, \ 166 interp_level = ze_interp_levels, \ 167 onelevel = zelevel, \ 168 nocall = opt.nocall ) 169 print zefile 170 zelevel = 0 ## so that zelevel could play again the role of nvert 171 184 interpolated_files="" 185 interpolated_files=call_zrecast(interp_mode=opt.interp,\ 186 input_name=zenamefiles,\ 187 fields=zevars) 188 189 zenamefiles=interpolated_files 190 if interpref: 191 interpolated_ref="" 192 interpolated_ref=call_zrecast(interp_mode=opt.interp,\ 193 input_name=[opt.fref],\ 194 fields=zevars) 195 196 reffile=interpolated_ref[0] 197 else: 198 reffile=opt.fref 172 199 173 200 ############# … … 183 210 slon=zeslon,slat=zeslat,svert=zesvert,stime=zestime,\ 184 211 outputname=opt.output,resolution=opt.res,\ 185 ope=opt.operation,fileref= opt.fref,minop=opt.vminope,maxop=opt.vmaxope,titleref=opt.titref)212 ope=opt.operation,fileref=reffile,minop=opt.vminope,maxop=opt.vmaxope,titleref=opt.titref) 186 213 print 'Done: '+name 187 214 system("rm -f to_be_erased") -
trunk/UTIL/PYTHON/planetoplot.py
r359 r361 5 5 ### A. Spiga -- LMD -- 06~09/2011 -- General building and mapping capabilities 6 6 ### T. Navarro -- LMD -- 10~11/2011 -- Improved use for GCM and added sections + 1Dplot capabilities 7 ### A. Colaitis -- LMD -- -- Mostly minor improvements and inter-plot operation capabilities 7 ### A. Colaitis -- LMD -- -- Mostly minor improvements and inter-plot operation capabilities + zrecast interpolation for gcm 8 8 9 9 def planetoplot (namefiles,\ … … 83 83 firstfile = True 84 84 for namefile in namefiles: 85 85 print namefile 86 86 ###################### 87 87 ### Load NETCDF object
Note: See TracChangeset
for help on using the changeset viewer.