Changeset 1029 in lmdz_wrf


Ignore:
Timestamp:
Aug 17, 2016, 1:10:00 PM (9 years ago)
Author:
lfita
Message:

Working for plot vertical cross section plot. Issue on axis labels

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/tools/model_graphics.py

    r1026 r1029  
    125125    for headerf in ftests.keys():
    126126        filen=ftests[headerf]
    127         vmod, vdiag = ncvar.computevar_model(var, idir + '/' + filen)
     127        try:
     128            with gen.Capturing() as output:
     129                vmod, vdiag = ncvar.computevar_model(var, idir + '/' + filen)
     130        except:
     131            print 'ncvar.computevar_model(' + var + ', ' + idir + '/' + filen + ')'
     132            for sout in output: print sout
     133            quit(-1)
    128134
    129135        if vmod is None and vdiag is None:
     
    298304            globalP = pinterp_var(op)
    299305            if vcomp.model is not None:
    300                 Smodel = ':'.join(vcomp.model)
     306                if type(vcomp.model) == type(list([1, 2])):
     307                    Smodel = ':'.join(vcomp.model)
     308                elif type(vcomp.model) == type('A'):
     309                    Smodel = vcomp.model
    301310            else:
    302311                Smodel = 'None'
    303312            if vcomp.diag is not None:
    304                 Sdiag = ':'.join(vcomp.diag)
     313                if type(vcomp.diag) == type(list([1, 2])):
     314                    Sdiag = ':'.join(vcomp.diag)
     315                elif type(vcomp.diag) == type('A'):
     316                    Sdiag = vcomp.diag
    305317            else:
    306318                Sdiag = 'None'
     
    12271239            fvarS = ','.join(vplot)
    12281240
    1229             plotins = "python "+pyH+"/drawing.py -f "+figfs+" -o draw_2D_shad_cont "+\
    1230               "-S '" + graphvals + "' -v " + fvarS
     1241            drwins = 'draw_2D_shad_cont'
     1242            plotins = "python " + pyH + "/drawing.py -f " + figfs + " -o " + drwins +\
     1243              " -S '" + graphvals + "' -v " + fvarS
    12311244            try:
    12321245                with gen.Capturing() as output:
    12331246                    sout0 = sub.call(plotins, shell=True)
    12341247            except:
    1235                 print 'drawing.draw_2D_shad_cont(' + graphvals + ',' + figfs + ',' + \
    1236                   fvarS + ')'
     1248                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    12371249                print sout0
    12381250                for sout in output: print sout
     
    12921304                    sout0 = sub.call(plotins, shell=True)
    12931305            except:
    1294                 print 'draw_2D_shad_cont_time(' + graphvals + ',' + figfs + ',' +    \
    1295                   fvarS + ')'
     1306                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
     1307                print sout0
     1308                for sout in output: print sout
     1309                quit(-1)
     1310
     1311            sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True)
     1312
     1313            # keeping all figures
     1314            trkobjf.write('\n')
     1315            trkobjf.write("#" + tfig.replace('!',' ') + '\n')
     1316            trkobjf.write(plotins + '\n')
     1317
     1318        elif 'shadcont2Dzsec':
     1319            figtit = tfig.replace('!','|')
     1320            shdstdn = CFvplot[0]
     1321            cntstdn = CFvplot[1]
     1322            figfs = ','.join(fplot)
     1323
     1324            shad = pplot[0]
     1325            srange = str(shad[0]) + ',' + str(shad[1])
     1326            cbar = shad[2]
     1327            cnt = pplot[1]
     1328            crange = str(cnt[0]) + ',' + str(cnt[1])
     1329            cfmt = cnt[3]
     1330            cline = cnt[4]
     1331
     1332            # It is assumed that if the space variable is 'lon': is desired a
     1333            #   (lon, pres) plot it it is 'lat': then (pres, lat) plot
     1334            if gen.searchInlist(dplot, 'lon'):
     1335                spacedim='lon'
     1336                figmid = 'long.|vert.|cross|sec.|of'
     1337                figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' +       \
     1338                  '|'.join(tfig.split('!')[2:])         
     1339                dims= spacedim+'|-1,pres|-1:'+spacedim+'|-1,pres|-1:'+spacedim+':pres'
     1340            else:
     1341                spacedim='lat'
     1342                figmid = 'mer.|vert.|cross|sec.|of'
     1343                figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' +       \
     1344                  '|'.join(tfig.split('!')[2:])
     1345# NOT WORKING?   dims= spacedim+'|-1,pres|-1:'+spacedim+'|-1,pres|-1:'+'pres:'+spacedim
     1346                dims= spacedim+'|-1,pres|-1:'+spacedim+'|-1,pres|-1:'+spacedim+':pres'
     1347
     1348            reverse = 'flip@y'
     1349
     1350            graphvals = ','.join(CFvplot)
     1351            graphvals = graphvals + ':' + dims + ':' + cbar + ':fixc,' + cline +     \
     1352              ':' + cfmt + ':' + srange + ':' + crange + ',9:' + figtit + ':' +      \
     1353              kfig + ':' + reverse + ':None'
     1354 
     1355            fvarS = ','.join(vplot)
     1356
     1357            drwins = 'draw_2D_shad_cont'
     1358            plotins = 'python ' + pyH + '/drawing.py -f ' + figfs + ' -o ' + drwins + \
     1359              " -S '" + graphvals + "' -v " + fvarS
     1360            try:
     1361                with gen.Capturing() as output:
     1362                    sout0 = sub.call(plotins, shell=True)
     1363            except:
     1364                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    12961365                print sout0
    12971366                for sout in output: print sout
     
    14431512                gP = pinterpS(globalP)
    14441513
    1445                 filen = vn + '_' + headf + gP + '_' + op + '.nc'
     1514                filen = vn + '_' + headf + gP + '_' + op.replace('+','_') + '.nc'
    14461515                filesplot.append(filen)
    14471516                # Do we have processed the given variable?
  • TabularUnified trunk/tools/model_graphics_template.dat

    r1026 r1029  
    112112# Text as title for each operation
    113113#   as ':' separated list of [op]|[explanation '!' as spaces]
    114 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
     114titleoperations = acc|tacc:diff|diff:direct|!:last|last:Lmean|latmean:Lsec|latsec:lmean|lonmean:lsec|lonsec:pinterp|pinterp:tmean|tmean:turb|turbulence:xmean|xmean:ymean|ymean:zsum|zsum
    115115
    116116# Pressure levels
     
    139139DIRPLT_shadcont2Dsfc = uas|last#vas|last:hfls|last#hfss|last:wss|last#tas|last
    140140DIRPLT_shadconthovmsfc = wss|xmean#tas|xmean
    141 #DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean:hus|pinterp+tmean+xmean#ta|pinterp+tmean+xmean
     141DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean:hus|pinterp+tmean+xmean#ta|pinterp+tmean+xmean
    142142
    143143#pltshadcont2Dsfc = huss|tmean#tas|tmean:vas|tmean#uas|tmean:ps|tmean#wss|tmean:pr|tmean#rsds|tmean:prw|tmean#clt|tmean:hfls|tmean#hfss|tmean:evspsbl|tmean#bils|tmean:zmaxth|tmean#stherm|tmean:wakeh|tmean#wakes|tmean:zmaxth|tmean#stherm|tmean:prls|tmean#prc|tmean:clt|tmean#cll|tmean:clm|tmean#clh|tmean:hurs|tmean#zmla|tmean:huss|last#tas|last:vas|last#uas|last:ps|last#wss|tmean:pr|last#rsds|last:prw|last#clt|last:hfls|last#hfss|last:evspsbl|last#bils|last:zmaxth|last#stherm|last:wakeh|last#wakes|last:zmaxth|last#stherm|last:prls|last#prc|last:clt|last#cll|last:clm|last#clh|last:hurs|last#zmla|last
Note: See TracChangeset for help on using the changeset viewer.