Changeset 351 for trunk/MESOSCALE/LMD_MM_MARS/SRC
- Timestamp:
- Nov 7, 2011, 12:53:40 AM (13 years ago)
- Location:
- trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/api_wrapper.py
r261 r351 14 14 extrapolate = 0, \ 15 15 unstagger_grid = False, \ 16 interp_level = [-9999.], \ 16 17 onelevel = 0.020, \ 17 18 nocall = False ): … … 26 27 if interp_method == 4: output_name = input_name+'_zabg' 27 28 29 if interp_level[0] == -9999.: 30 interp_level = np.arange(299) 31 else: 32 zelen = len(interp_level) 33 zetemp = np.zeros(299) 34 zetemp[0:zelen] = interp_level[0:zelen] 35 zetemp[zelen] = -99999. 36 interp_level = zetemp 37 onelevel = -99999. 38 28 39 #print input_name, output_name 29 40 30 41 if nocall: pass 31 42 else: api.api_main ( path_to_input, input_name, path_to_output, output_name, \ 32 process, fields, debug, bit64, oldvar, np.arange(299), \43 process, fields, debug, bit64, oldvar, interp_level, \ 33 44 interp_method, extrapolate, unstagger_grid, onelevel ) 34 45 -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/gcm.py
r350 r351 20 20 parser = OptionParser() 21 21 parser.add_option('-f', '--file', action='append',dest='namefile', type="string", default=None, help='[NEEDED] name of WRF file (append). Plot files separated by comas in the same figure') 22 parser.add_option('-l', '--level', action='store',dest='nvert', type=" float", default=0, help='level(def=0)(-i 2: p,mbar)(-i 3,4: z,km)')22 parser.add_option('-l', '--level', action='store',dest='nvert', type="string", default="0", help='level or start,stop,step (def=0)(-i 2: p,mbar)(-i 3,4: z,km)') 23 23 parser.add_option('-p', '--proj', action='store',dest='proj', type="string", default=None, help='projection') 24 24 parser.add_option('-b', '--back', action='store',dest='back', type="string", default=None, help='background image (def: None)') … … 109 109 zefile = zenamefiles[0] 110 110 111 zelevel = opt.nvert111 #zelevel = opt.nvert 112 112 stralt = None 113 113 [lschar,zehour,zehourin] = getlschar ( zefile ) ## getlschar from wrfout (or simply return "" if another file) 114 114 115 inputnvert = separatenames(opt.nvert) 116 if np.array(inputnvert).size == 1: 117 zelevel = float(inputnvert[0]) 118 ze_interp_levels = [-9999.] 119 else: 120 zelevel = -99. 121 ze_interp_levels = np.linspace(float(inputnvert[0]),float(inputnvert[1]),float(inputnvert[2])) 122 print 'level: ', zelevel 123 print 'interp_levels: ',ze_interp_levels 124 115 125 ##################################################### 116 ### Call Fortran routines for vertical interpolations 126 ### Call Fortran routines for vertical interpolations --> zrecast for GCM ? 117 127 if opt.interp is not None: 118 if opt.nvert is 0 and opt.interp is4: zelevel = 0.010128 if zelevel == 0. and opt.interp == 4: zelevel = 0.010 119 129 ### winds or no winds 120 130 if opt.winds : zefields = 'uvmet' … … 130 140 fields = zefields, \ 131 141 interp_method = opt.interp, \ 142 interp_level = ze_interp_levels, \ 132 143 onelevel = zelevel, \ 133 144 nocall = opt.nocall ) … … 138 149 ############# 139 150 ### Main call 140 name = planetoplot (zenamefiles, nvert=int(zelevel),vertmode=opt.interp,\151 name = planetoplot (zenamefiles,level=int(zelevel),vertmode=opt.interp,\ 141 152 proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=zevar,\ 142 153 numplot=opt.numplot,colorb=opt.colorb,winds=opt.winds,\ -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/meso.py
r350 r351 20 20 parser = OptionParser() 21 21 parser.add_option('-f', '--file', action='append',dest='namefile', type="string", default=None, help='[NEEDED] name of WRF file (append)') 22 parser.add_option('-l', '--level', action='store',dest='nvert', type=" float", default=0, help='level(def=0)(-i 2: p,mbar)(-i 3,4: z,km)')22 parser.add_option('-l', '--level', action='store',dest='nvert', type="string", default="0", help='level or start,stop,step (def=0)(-i 2: p,mbar)(-i 3,4: z,km)') 23 23 parser.add_option('-p', '--proj', action='store',dest='proj', type="string", default=None, help='projection') 24 24 parser.add_option('-b', '--back', action='store',dest='back', type="string", default=None, help='background image (def: None)') … … 92 92 zefile = opt.namefile[i] 93 93 print zefile 94 zelevel = opt.nvert94 #zelevel = opt.nvert 95 95 stralt = None 96 96 [lschar,zehour,zehourin] = getlschar ( zefile ) ## getlschar from wrfout (or simply return "" if another file) 97 97 98 inputnvert = separatenames(opt.nvert) 99 if np.array(inputnvert).size == 1: 100 zelevel = float(inputnvert[0]) 101 ze_interp_levels = [-9999.] 102 else: 103 zelevel = -99. 104 ze_interp_levels = np.linspace(float(inputnvert[0]),float(inputnvert[1]),float(inputnvert[2])) 105 print 'level: ', zelevel 106 print 'interp_levels: ',ze_interp_levels 107 98 108 ##################################################### 99 ### Call Fortran routines for vertical interpolations 109 ### Call Fortran routines for vertical interpolations 100 110 if opt.interp is not None: 101 if opt.nvert is 0 and opt.interp is4: zelevel = 0.010111 if zelevel == 0. and opt.interp == 4: zelevel = 0.010 102 112 ### winds or no winds 103 113 if opt.winds : zefields = 'uvmet' … … 113 123 fields = zefields, \ 114 124 interp_method = opt.interp, \ 125 interp_level = ze_interp_levels, \ 115 126 onelevel = zelevel, \ 116 127 nocall = opt.nocall ) … … 133 144 ############# 134 145 ### Main call 135 name = planetoplot (zefile, nvert=int(zelevel),vertmode=opt.interp,\146 name = planetoplot (zefile,level=int(zelevel),vertmode=opt.interp,\ 136 147 proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=argvar,\ 137 148 numplot=opt.numplot,colorb=opt.colorb,winds=opt.winds,\ -
trunk/MESOSCALE/LMD_MM_MARS/SRC/PYTHON/planetoplot.py
r350 r351 7 7 8 8 def planetoplot (namefiles,\ 9 nvert=0,\9 level=0,\ 10 10 vertmode=0,\ 11 11 proj=None,\ … … 75 75 ### Load NETCDF object 76 76 nc = Dataset(namefile) 77 77 78 78 ################################## 79 79 ### Initial checks and definitions … … 104 104 elif typefile in ['meso','mesoapi']: 105 105 if mapmode == 0: 106 if var in ['PHTOT','W']: vertdim='BOTTOM-TOP_PATCH_END_STAG'107 else: vertdim='BOTTOM-TOP_PATCH_END_UNSTAG'106 if var in ['PHTOT','W']: vertdim='BOTTOM-TOP_PATCH_END_STAG' 107 else: vertdim='BOTTOM-TOP_PATCH_END_UNSTAG' 108 108 if var in ['V']: latdim='SOUTH-NORTH_PATCH_END_STAG' 109 109 else: latdim='SOUTH-NORTH_PATCH_END_UNSTAG' … … 112 112 lon = np.arange(0,getattr(nc,londim),1) 113 113 lat = np.arange(0,getattr(nc,latdim),1) 114 vert = np.arange(0,getattr(nc,vertdim),1) 114 if vertmode == 0: vert = np.arange(0,getattr(nc,vertdim),1) 115 else: vert = nc.variables["vert"][:] 115 116 time = np.arange(0,len(nc.variables["Times"]),1) 116 117 #if firstfile: … … 135 136 ### Name for title and graphics save file 136 137 basename = getname(var=var,winds=winds,anomaly=anomaly) 137 basename = basename + getstralt(nc, nvert) ## can be moved elsewhere for a more generic routine138 basename = basename + getstralt(nc,level) ## can be moved elsewhere for a more generic routine 138 139 139 140 print "var, var2: ", var, var2 … … 196 197 indexlon = None 197 198 indexlat = None 198 indexvert = nvert## ou svert ???199 indexvert = level ## ou svert ??? 199 200 nlon = 1 200 201 nlat = 1
Note: See TracChangeset
for help on using the changeset viewer.