- Timestamp:
- Aug 17, 2016, 9:22:22 AM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.py
r1025 r1026 1140 1140 1141 1141 def draw_plot(kplot, CFvplot, fplot, vplot, dplot, pplot, finame, tfig, kfig, mapval,\ 1142 t units, od, pyH, fscr, db):1142 tvals, od, pyH, fscr, db): 1143 1143 """ Function to draw a plot 1144 1144 kplot= kind of plot … … 1152 1152 kfig= kind of the figure 1153 1153 mapval= value of the map 1154 tunits= units of time 1154 tvals= list with time values 1155 tunits: units of time ('!' for spaces) 1156 timekind: kind of time ticks in the plot 1157 timefmt: format of time ticks in the plot 1158 timelabel: label of time-axis in the plot 1155 1159 od= output directory 1156 1160 pyH= python HOME … … 1169 1173 # Tracking file with all the figures 1170 1174 trkobjf = open('all_figures.inf', 'a') 1175 1176 # Time-characteristics 1177 tunits = tvals[0] 1178 timekind = tvals[1] 1179 timefmt = tvals[2] 1180 timelabel = tvals[3] 1171 1181 1172 1182 if not os.path.isfile(finame): … … 1201 1211 cntstdn = CFvplot[1] 1202 1212 figfs = ','.join(fplot) 1213 1203 1214 shad = pplot[0] 1204 1215 srange = str(shad[0]) + ',' + str(shad[1]) … … 1206 1217 cnt = pplot[1] 1207 1218 crange = str(cnt[0]) + ',' + str(cnt[1]) 1208 cfmt = cnt[ 2]1209 cline = cnt[ 3]1219 cfmt = cnt[3] 1220 cline = cnt[4] 1210 1221 1211 1222 graphvals = ','.join(CFvplot) … … 1220 1231 try: 1221 1232 with gen.Capturing() as output: 1222 sout = sub.call(plotins, shell=True)1233 sout0 = sub.call(plotins, shell=True) 1223 1234 except: 1224 1235 print 'drawing.draw_2D_shad_cont(' + graphvals + ',' + figfs + ',' + \ 1225 1236 fvarS + ')' 1237 print sout0 1226 1238 for sout in output: print sout 1227 1239 quit(-1) … … 1233 1245 trkobjf.write("#" + tfig.replace('!',' ') + '\n') 1234 1246 trkobjf.write(plotins + '\n') 1247 1248 elif kplot == 'shadconthovmsfc': 1249 figtit = tfig.replace('!','|') 1250 shdstdn = CFvplot[0] 1251 cntstdn = CFvplot[1] 1252 figfs = ','.join(fplot) 1253 1254 shad = pplot[0] 1255 srange = str(shad[0]) + ',' + str(shad[1]) 1256 cbar = shad[2] 1257 cnt = pplot[1] 1258 crange = str(cnt[0]) + ',' + str(cnt[1]) 1259 cfmt = cnt[3] 1260 cline = cnt[4] 1261 # It is assumed that if the space variable is 'lon': is desired a 1262 # (lon, time) plot it it is 'lat': then (time, lat) plot 1263 if gen.searchInlist(dplot,'lon'): 1264 spacedim ='lon' 1265 figmid = 'longitudinal|evolution|of' 1266 figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' + \ 1267 '|'.join(tfig.split('!')[2:]) 1268 reverse= 'None' 1269 dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;'+spacedim+';time' 1270 else: 1271 spacedim='lat' 1272 figmid = 'meridional|evolution|of' 1273 figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' + \ 1274 '|'.join(tfig.split('!')[2:]) 1275 reverse='None' 1276 dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;time;'+spacedim 1277 1278 graphvals = ','.join(CFvplot) 1279 graphvals = graphvals + ';'+ dims +';'+ cbar + \ 1280 ';fixsigc,' + cline + ';' + cfmt + ';' + srange + ';' + crange +',9;'+ \ 1281 figtit + ';' + kfig + ';' + reverse + ';' + 'time|' + tunits + '|'+ \ 1282 timekind + '|' + timefmt + '|' + timelabel 1283 1284 fvarS = ','.join(vplot) 1285 1286 drwins = 'draw_2D_shad_cont_time' 1287 plotins = 'python ' + pyH + '/drawing.py -f ' + figfs +' -o ' + drwins + \ 1288 " -S '" + graphvals + "' -v " + fvarS 1289 1290 try: 1291 with gen.Capturing() as output: 1292 sout0 = sub.call(plotins, shell=True) 1293 except: 1294 print 'draw_2D_shad_cont_time(' + graphvals + ',' + figfs + ',' + \ 1295 fvarS + ')' 1296 print sout0 1297 for sout in output: print sout 1298 quit(-1) 1299 1300 sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True) 1301 1302 # keeping all figures 1303 trkobjf.write('\n') 1304 trkobjf.write("#" + tfig.replace('!',' ') + '\n') 1305 trkobjf.write(plotins + '\n') 1306 1235 1307 else: 1236 1308 print errmsg … … 1280 1352 opersurnames[opn] = vls 1281 1353 1354 # time values 1282 1355 # Units time for the plots 1283 1356 rd = config['CFreftime'] 1284 t imeunits = config['CFunitstime'] + '!since!' + rd[0:4] + '-' + rd[4:6] + '-' + \1357 tunits = config['CFunitstime'] + '!since!' + rd[0:4] + '-' + rd[4:6] + '-' + \ 1285 1358 rd[6:8] + '!' + rd[8:10] + ':' + rd[10:12] + ':' + rd[12:14] 1286 1287 # Dictinoary of plot specificities 1359 # time ticks kind 1360 tkind = config['timekind'] 1361 # time ticks format 1362 tfmt = config['timefmt'] 1363 # time axis label 1364 tlab = config['timelabel'] 1365 timevals = [tunits, tkind, tfmt, tlab] 1366 1367 # Dictionary of plot specificities 1288 1368 # [minval]: minimum value 1289 1369 # [maxval]: minimum value … … 1405 1485 # Title of the figure: 1406 1486 if ivp == 0: 1407 titfigure = mod + '!' + exp + '!' + vn1487 titfigure = mod + '!' + exp + "!'" + vn + "'" 1408 1488 else: 1409 titfigure = titfigure + '!&!' + vn 1410 for op1 in op.split('+'): 1489 titfigure = titfigure + "!&!'" + vn + "'" 1490 opvals = op.split('+') 1491 for op1 in opvals: 1411 1492 if not opexplained.has_key(op1): 1412 1493 print errormsg … … 1414 1495 print ' provided:', opexplained.keys() 1415 1496 quit(-1) 1416 titfigure = titfigure + '!' + opexplained[op1] 1497 if op1 == opvals[0]: 1498 titfigure = titfigure + '$_{[' + opexplained[op1] 1499 if len(opvals) == 1: titfigure = titfigure + ']}$' 1500 elif op1 == opvals[len(opvals)-1]: 1501 titfigure = titfigure + '\!' + opexplained[op1] + ']}$' 1502 else: 1503 titfigure = titfigure + '\!' + opexplained[op1] 1417 1504 1418 1505 ivp = ivp + 1 1419 1506 # End of variable-operation 1507 figname = figname + '.' + kindfigure 1420 1508 1421 1509 draw_plot(kplot, CFvarsplot, filesplot, varsplot, dimsplot, pictplot, \ 1422 figname, titfigure, kindfigure, mapvalue, time units, odir, pyHOME,\1510 figname, titfigure, kindfigure, mapvalue, timevals, odir, pyHOME, \ 1423 1511 figscr, debug) 1424 1512 -
trunk/tools/model_graphics_template.dat
r1025 r1026 33 33 34 34 # Have new figures been added and do they need to be drawn? 35 addfigures = true35 addfigures = false 36 36 37 37 # Debug 38 debug = true38 debug = false 39 39 40 40 # Folder with the files … … 112 112 # Text as title for each operation 113 113 # as ':' separated list of [op]|[explanation '!' as spaces] 114 titleoperations = acc|t emporal!accumulated:diff|difference:direct|!:last|last!temporal!value:Lmean|latitudinal!mean:Lsec|latitudinal!section:lmean|longitudinal!mean:lsec|longitudinal!section:pinterp|pressure!interpolation:tmean|temporal!mean:turb|Taylor's!turbulence:xmean|x-axis!mean:ymean|y-axis!mean:zsum|vertical!aggregated114 titleoperations = acc|tacc:diff|diff:direct|!:last|last:Lmean|latmean:Lsec|latsec:lmean|lonmean:lsec|lonsec:pinterp|pressure!interpolation:tmean|temporal!mean:turb|turbulence:xmean|xmean:ymean|ymean:zsum|zsum 115 115 116 116 # Pressure levels … … 138 138 139 139 DIRPLT_shadcont2Dsfc = uas|last#vas|last:hfls|last#hfss|last:wss|last#tas|last 140 #DIRPLT_shadconthovmsfc = wss|xmean#tas|xmean140 DIRPLT_shadconthovmsfc = wss|xmean#tas|xmean 141 141 #DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean:hus|pinterp+tmean+xmean#ta|pinterp+tmean+xmean 142 142 … … 177 177 # [timefmt]; desired format for the time ticks (combination of LaTeX and 'linux date formats') 178 178 # [timelabel]; label at the graph ('!' for spaces) 179 180 179 timekind = exct,6,h 181 180 timefmt = $%d^{%H}$
Note: See TracChangeset
for help on using the changeset viewer.