Changeset 1039 in lmdz_wrf for trunk


Ignore:
Timestamp:
Aug 21, 2016, 10:06:35 PM (9 years ago)
Author:
lfita
Message:

Working version up to the drawing of both differences: op, var

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.py

    r1036 r1039  
    2020warnmsg = ncvar.warnmsg
    2121
     22def verify_configuration(ExpConf, debug):
     23    """ Function to verify mandatory keys from experiment configuration
     24      ExpConf= dictionary with the configuration
     25    """
     26    fname = 'verify_configuration'
     27 
     28    # List with the mandatory keys
     29    mandatorykeys = ['pyHOME', 'cdoHOME', 'scratch', 'filescratch', 'figscratch',    \
     30      'diffscratch', 'figdiffscratch', 'addfiles', 'addfigures', 'adddiffs',         \
     31      'debug', 'models', 'ifold', 'ofold', 'warnmsg', 'errmsg', 'titleoperations',   \
     32      'kindfig', 'CFreftime', 'CFunitstime', 'mapval', 'timekind', 'timefmt',        \
     33      'timelabel' ]
     34
     35    # List with the optional keys
     36    optionalkeys = ['specificvarplot', 'specificdiffopplot', 'specificdiffvarplot']
     37
     38    # Dictionary with the mandatory keys which are required as function of a given value from the dictionary
     39    ifkeys = {'WRFexps': ['models','WRF'], 'LMDZexps': ['models','LMDZ'],            \
     40      'WRF_LMDZexps': ['models','WRF_LMDZ'], 'WRFheaders': ['models','WRF'],         \
     41      'WRF_LMDZheaders': ['models','WRF_LMDZ'], 'LMDZheaders': ['models','LMDZ']}
     42
     43    for kdict in mandatorykeys:
     44        if not ExpConf.has_key(kdict):
     45            print errmsg
     46            print '  ' + fname + "' configuration without required '" + kdict + "' !!"
     47            quit(-1)
     48        if debug:
     49            print ExpConf[kdict]
     50
     51    for kdict in ifkeys.keys():
     52        vals = ifkeys[kdict]
     53        keyn = vals[0]
     54        keyv = vals[1]
     55        if type(ExpConf[keyn]) == type('A'):
     56            if not ExpConf.has_key(kdict) and ExpConf[keyn] == keyv:
     57                print errmsg
     58                print '  ' + fname + "' configuration without '" + kdict +           \
     59                  "' when it is required with configuration '" + keyn + '=' + keyv + \
     60                  "' !!"
     61                quit(-1)
     62        elif type(ExpConf[keyn]) == type(['A', 'B']):
     63            keyvals = ExpConf[keyn]
     64            if not ExpConf.has_key(kdict) and gen.searchInlist(keyvals, keyv):
     65                print errmsg
     66                print '  ' + fname + "' configuration without '" + kdict +           \
     67                  "' when it is required with configuration '" + keyn + '= [..., ' + \
     68                 keyv + ", ...]' !!"
     69                quit(-1)
     70        else:
     71            print errmsg
     72            print '  ' +fname+ 'dictionary type ', type(ExpConf[keyn]), ' not ready!!'
     73            quit(-1)
     74        if debug:
     75            print ExpConf[kdict]
     76
     77    print fname + ': configuration seems to be fine'
     78
     79    return
     80
    2281def scratches(config):
    2382    """ Function to set-up if it is needed to start from the scratch
     
    3493        figscr = True
    3594        difscr = True
     95        figdifscr = True
    3696        tim.sleep(10)
    3797    else:
     
    64124            difscr = False
    65125
     126        if config['figdiffscratch'] == 'true':
     127            figdifscr = True
     128            print warnmsg
     129            print "  " + main + ": figures differences starting from the SCRATCH !!"
     130            print "    5 seconds left!!"
     131            tim.sleep(5)
     132        else:
     133            figdifscr = False
     134
    66135    if config['addfiles'] == 'true':
    67136        addfils = True
     
    84153        debug = False
    85154
    86     return scr, filescr, figscr, difscr, addfils, addfigs, adddiffs, debug
     155    return scr, filescr, figscr, difscr, figdifscr, addfils, addfigs, adddiffs, debug
    87156
    88157def exp_headers(mod,config):
     
    144213                vmod, vdiag = ncvar.computevar_model(var, idir + '/' + filen)
    145214        except:
     215            print errmsg
    146216            print 'ncvar.computevar_model(' + var + ', ' + idir + '/' + filen + ')'
    147217            for sout in output: print sout
     
    516586                          shell=True)
    517587                except:
     588                    print errmsg
    518589                    print 'python ' + pyH + '/diagnostics.py ' + values
    519590                    for sout in output: print sout
     
    541612                            ncvar.fvaradd(idir+'/'+cf+','+rqv,ifilen)
    542613                    except:
     614                        print errmsg
    543615                        print 'fvaradd('+idir+'/'+cf+','+rqv+','+ifilen+')'
    544616                        for sout in output: print sout
     
    566638                  SgP+'_,-,.nc', 'all')
    567639        except:
     640            print errmsg
    568641            print 'netcdf_fold_concatenation_HMT(./time, '+CFvarn+'_'+headerf+SgP+   \
    569642              '_,-,.nc, all)'
     
    739812                        ncvar.DataSetSection(vals,prevfile)
    740813                except:
     814                    print errmsg
    741815                    print 'DataSetSection('+vals+',', prevfile, ')'
    742816                    for sout in output: print sout
     
    784858                        ncvar.pinterp(vals,prevfile,vninF)
    785859                except:
     860                    print errmsg
    786861                    print 'pinterp('+vals+',', prevfile, ','+vninF+')'
    787862                    for sout in output: print sout
     
    818893                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    819894                except:
     895                    print errmsg
    820896                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    821897                    for sout in output: print sout
     
    863939                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    864940                except:
     941                    print errmsg
    865942                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    866943                    for sout in output: print sout
     
    890967                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    891968                except:
     969                    print errmsg
    892970                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    893971                    for sout in output: print sout
     
    9401018                    varinfile = ncvar.ivars(fileon)
    9411019            except:
     1020                print errmsg
    9421021                print 'ivars('+fileon+')'
    9431022                for sout in output: print sout
     
    9521031                            ncvar.fvaradd(prevfile+','+CFvn, fileon)
    9531032                    except:
     1033                        print errmsg
    9541034                        print 'fvaradd(', prevfile, ','+CFvn+','+fileon+')'
    9551035                        for sout in output: print sout
     
    9641044                    oclean = ncvar.cleaning_varsfile(totalvarkeeps,fileon)
    9651045            except:
     1046                print errmsg
    9661047                print 'cleaning_varsfile('+totalvarkeeps+','+fileon+')'
    9671048                for sout in output: print sout
     
    11031184    return doplots, plotsvar, indivplotsvar, varplotp
    11041185
    1105 def plots_listconstruct(config, odir, debug):
     1186def plots_listconstruct(config, pkind, finf, odir, debug):
    11061187    """ Function to create the list of plots to draw
    11071188      config= Configuration of the experiment
     1189      pkind= kind of plots ('DIRPLT', 'DIFFPLT')
     1190      finf= file with the instructions of the plots
    11081191      odir= output experiment folder
    11091192    """
    11101193    fname='plots_listconstruct'
    11111194 
    1112     dirplot = gen.get_specdictionary_HMT(config, H='DIRPLT_')
     1195    dirplot = gen.get_specdictionary_HMT(config, H=pkind+'_')
    11131196
    11141197    if debug:
    1115         print '  direct plots to draw ________'
     1198        print "  '" + pkind + "' plots to draw ________"
    11161199        gen.printing_dictionary(dirplot)
    11171200
    11181201    # Getting plots by variable
    1119     plots, varplot, indivarplot, plotp = get_plots_var(dirplot,'DIRPLT_',debug)   
     1202    plots, varplot, indivarplot, plotp = get_plots_var(dirplot, pkind+'_', debug)
    11201203
    11211204    Svarplot = gen.dictKeysVals_stringList(plots,cV=':')
     
    11261209
    11271210    # Outwritting the varcompute to avoid next time (if it is not filescratch!)
    1128     objf = open(odir + '/directplotsdraw.inf', 'w')
     1211    objf = open(finf, 'w')
    11291212    objf.write('plots: ' + Svarplot + '\n')
    11301213    objf.write('itotp: ' + str(Nplots) + '\n')
     
    12721355                    sout0 = sub.call(plotins, shell=True)
    12731356            except:
     1357                print errmsg
    12741358                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    12751359                print sout0
     
    13301414                    sout0 = sub.call(plotins, shell=True)
    13311415            except:
     1416                print errmsg
    13321417                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    1333                 print sout0
    13341418                for sout in output: print sout
    13351419                quit(-1)
     
    13881472                    sout0 = sub.call(plotins, shell=True)
    13891473            except:
     1474                print errmsg
    13901475                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    1391                 print sout0
    13921476                for sout in output: print sout
    13931477                quit(-1)
     
    14611545
    14621546    # Dictionary of plot specificities
    1463     #   [minval]: minimum value
    1464     #   [maxval]: minimum value
    1465     #   [colorbar]: name of the colorbar (from matplotlib) to use
    1466     #   [cntformat]: format of the contour labels
    1467     #   [colorcnt]: color for the countor lines
     1547    specplotkeyn = 'specificvarplot'
    14681548    plotspecifics = {}
    1469     plotspecs = config['specificvarplot'].split(':')
    1470     for pltspc in plotspecs:
    1471         pltvls = pltspc.split('|')
    1472         vn = pltvls[0]
    1473         op = pltvls[1]
    1474         fn = pltvls[2]
    1475         plotspecifics[fn + '_' + vn + '_' + op] = pltvls[3:]
    1476     if debug:
    1477         print 'Specific values for plots _______'
    1478         gen.printing_dictionary(plotspecifics)
     1549    if config.has_key(specplotkeyn):
     1550        #   [minval]: minimum value
     1551        #   [maxval]: minimum value
     1552        #   [colorbar]: name of the colorbar (from matplotlib) to use
     1553        #   [cntformat]: format of the contour labels
     1554        #   [colorcnt]: color for the countor lines
     1555        plotspecs = config[specplotkeyn].split(':')
     1556        for pltspc in plotspecs:
     1557            pltvls = pltspc.split('|')
     1558            vn = pltvls[0]
     1559            op = pltvls[1]
     1560            fn = pltvls[2]
     1561            plotspecifics[fn + '_' + vn + '_' + op] = pltvls[3:]
     1562        if debug:
     1563            print 'Specific values for plots _______'
     1564            gen.printing_dictionary(plotspecifics)
    14791565
    14801566    # Kind of figures
     
    15561642                        dims = ncvar.idims(filen)
    15571643                except:
     1644                    print errmsg
    15581645                    print 'ncvar.idims('+filen+')'
    15591646                    for sout in output: print sout
     
    19342021    # CF dimension-variables name
    19352022    OpersS = '+'.join(Opers)
    1936     if OpersS.find('pinterp') != -1:
     2023    if OpersS.find('pinterp') != -1 or filen.find('pinterp') != -1:
    19372024        varnCFs = ['lon', 'lat', 'pres', 'time']
    19382025    else:
     
    20092096                        ncvar.DataSetSection(vals,prevfile)
    20102097                except:
     2098                    print errmsg
    20112099                    print 'DataSetSection('+vals+',', prevfile, ')'
    20122100                    for sout in output: print sout
     
    20572145                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    20582146                except:
     2147                    print errmsg
    20592148                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    20602149                    for sout in output: print sout
     
    21022191                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    21032192                except:
     2193                    print errmsg
    21042194                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    21052195                    for sout in output: print sout
     
    21292219                        ncvar.file_oper_alongdims(vals,prevfile,CFvarnp)
    21302220                except:
     2221                    print errmsg
    21312222                    print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')'
    21322223                    for sout in output: print sout
     
    21792270                    varinfile = ncvar.ivars(fileon)
    21802271            except:
     2272                print errmsg
    21812273                print 'ivars('+fileon+')'
    21822274                for sout in output: print sout
     
    21912283                            ncvar.fvaradd(prevfile+','+CFvn, fileon)
    21922284                    except:
     2285                        print errmsg
    21932286                        print 'fvaradd(', prevfile, ','+CFvn+','+fileon+')'
    21942287                        for sout in output: print sout
     
    22032296                    oclean = ncvar.cleaning_varsfile(totalvarkeeps,fileon)
    22042297            except:
     2298                print errmsg
    22052299                print 'cleaning_varsfile('+totalvarkeeps+','+fileon+')'
    22062300                for sout in output: print sout
     
    23322426    return
    23332427
     2428
     2429def draw_diff_plots(config, plots, odir, allvarcomp, kdiff, figscr, debug):
     2430    """ Function to draw all plots
     2431      config= Configuration of the experiment
     2432      plots= dictionary with the plots
     2433      odir= output experiment folder
     2434      allvarcomp= dictionary with all the variables to compute and their information
     2435      kdiff= kind of differences:
     2436        'diffop': plots from operation differences
     2437        'diffvar': plots from variable differences
     2438      figscr= whether figures should be done from the scratch or not
     2439
     2440    * Plot as
     2441      {[kplot]} = [varn1]|[op1]#[varn2]|[op2]#[...[varnN]|[opN]], ...
     2442        [kplot] ___
     2443          diffmap2Dsfc: 2D map of surface differences values of 1 variable
     2444          diffmap2Dz: 2D map of 3D differences values of 1 variable
     2445          map2Dsfc: 2D map of surface values of 1 variable
     2446          map3D: 2D map of 3D values of 1 variable
     2447          shadconthovmsfc: Hovmoeller diagrams of 2 variable at the surface in shadow and the other in contourn
     2448          shadcont2Dsfc: 2D map of shadow (1st variable) and countour (2nd variable) [stvar1]#[stvar2]
     2449          shadcont2Dzsec: 2D map of vertical section of 2 variables one in shadow and the other in contourn
     2450        [varn]
     2451          variable
     2452        [op]
     2453          '+' separated list of operations
     2454        in figures with more than 1 variable, use '#' to separate the [varn]|[op]
     2455    """
     2456    fname = 'draw_diff_plots'
     2457
     2458    os.chdir(odir)
     2459
     2460    # Dictionary with the operations with surnames for the operated variable
     2461    opersurnames = {}
     2462    opsur = gen.get_specdictionary_HMT(config, H='opsur_',M='',T='')
     2463    for opsr in opsur.keys():
     2464        opn = opsr.split('_')[1]
     2465        vls = opsur[opsr].split(':')
     2466        opersurnames[opn] = vls
     2467
     2468    # time values
     2469    # Units time for the plots
     2470    rd = config['CFreftime']
     2471    tunits = config['CFunitstime'] + '!since!' + rd[0:4] + '-' + rd[4:6] + '-' +  \
     2472      rd[6:8] + '!' + rd[8:10] + ':' + rd[10:12] + ':' + rd[12:14]
     2473    # time ticks kind
     2474    tkind = config['timekind']
     2475    # time ticks format
     2476    tfmt = config['timefmt']
     2477    # time axis label
     2478    tlab = config['timelabel']
     2479    timevals = [tunits, tkind, tfmt, tlab]
     2480
     2481    if kdiff == 'diffop':
     2482         specplotkeyn = 'specificdiffopplot'
     2483    elif kdiff == 'diffvar':
     2484         specplotkeyn = 'specificdiffvarplot'
     2485    else:
     2486         print errmsg
     2487         print '  ' + fname + ": differences kind '" + kdiff + "' not ready !!"
     2488         quit(-1)
     2489
     2490    # Dictionary of plot specificities
     2491    plotspecifics = {}
     2492    if config.has_key(specplotkeyn):
     2493        #   [minval]: minimum value
     2494        #   [maxval]: minimum value
     2495        #   [colorbar]: name of the colorbar (from matplotlib) to use
     2496        #   [cntformat]: format of the contour labels
     2497        #   [colorcnt]: color for the countor lines
     2498        plotspecs = config[specplotkeyn].split(':')
     2499        for pltspc in plotspecs:
     2500            pltvls = pltspc.split('|')
     2501            vn = pltvls[0]
     2502            op = pltvls[1]
     2503            fn = pltvls[2]
     2504            plotspecifics[fn + '_' + vn + '_' + op] = pltvls[3:]
     2505        if debug:
     2506            print 'Specific values for plots _______'
     2507            gen.printing_dictionary(plotspecifics)
     2508
     2509    # Kind of figures
     2510    kindfigure = config['kindfig']
     2511
     2512    # Map value
     2513    mapvalue = config['mapval']
     2514
     2515    # pythone scripts HOME
     2516    pyHOME = config['pyHOME']
     2517
     2518    # Title-text of operations
     2519    opexplained = {}
     2520    optits = config['titleoperations'].split(':')
     2521    for optit in optits:
     2522        opn = optit.split('|')[0]
     2523        opt = optit.split('|')[1]
     2524        opexplained[opn] = opt
     2525    if debug:
     2526        print 'Titles for operations  _______'
     2527        gen.printing_dictionary(opexplained)
     2528
     2529    for kplot in plots.keys():
     2530        varsplt = plots[kplot]
     2531        for varplt in varsplt:
     2532            if debug:
     2533                print "  printing '" + kplot + "' var ':" + varplt + "'..."
     2534            varops = varplt.split('#')
     2535
     2536            # CF variables in plot
     2537            CFvarsplot = []
     2538            # Files in plot
     2539            filesplot = []
     2540            # Variables in plot within the files
     2541            varsplot = []
     2542            # Dims in figure
     2543            dimsplot = []
     2544            # pictoric values in figure
     2545            pictplot = []
     2546            # Name of the figure
     2547            figname = ''
     2548            # Title of the figure
     2549            titfigure = ''
     2550
     2551            ivp = 0
     2552            for varop in varops:
     2553                vn = varop.split('|')[0]
     2554                op = varop.split('|')[1]
     2555
     2556                # CF variables in plot
     2557                CFvarsplot.append(vn)
     2558 
     2559                vnopS = vn + '_' + op
     2560                if not allvarcomp.has_key(vnopS):
     2561                    print errmsg
     2562                    print '  ' + fname + ": no file for variable-operation '" +     \
     2563                      vnopS + "' !!"
     2564                vopvals = allvarcomp[vnopS]
     2565                mod1 = vopvals[0]
     2566                mod2 = vopvals[1]
     2567                mod3 = vopvals[2]
     2568                mod4 = vopvals[3]
     2569                headf = vopvals[4]
     2570
     2571                modexpdiff = mod2 + '/' + exp2 + ' - ' + mod1 + '/' + exp1
     2572                modexpdiffS = mod2 + '-' + exp2 + '_' + mod1 + '-' + exp1
     2573
     2574                difffilen = odir + '/' + vn + '_' + kdiff + '_' + modexpdiffS +      \
     2575                  '_' + op.replace('+','_') + '.nc'
     2576
     2577                filesplot.append(difffilen)
     2578                # Do we have processed the given difference?
     2579                if not os.path.isfile(difffilen):
     2580                    print warnmsg
     2581                    print "  " + fname + ": there is no file for '" + kdiff +        \
     2582                      "' difference '" + varop + "' skiping it !!"
     2583                    break
     2584
     2585                # Name of the variable inside the file
     2586                vnsur = varnoper(vn, op, opersurnames)
     2587                varsplot.append(vnsur)
     2588
     2589                # Dimensions in file
     2590                try:
     2591                    with gen.Capturing() as output:
     2592                        dims = ncvar.idims(difffilen)
     2593                except:
     2594                    print errmsg
     2595                    print 'ncvar.idims('+difffilen+')'
     2596                    for sout in output: print sout
     2597                    quit(-1)
     2598
     2599                dimsplot.append(dims)
     2600
     2601                # pictoric values for the figure
     2602                Sfivaop = kplot + '_' + vn + '_' + op
     2603                if plotspecifics.has_key(Sfivaop):
     2604                    pictvals = plotspecifics[Sfivaop]
     2605                else:
     2606                    Vvals = gen.variables_values(vn)
     2607                    pictvals = [Vvals[2], Vvals[3], Vvals[6], '%g', 'black']
     2608
     2609                pictplot.append(pictvals)
     2610
     2611                # Header of the name of the figure
     2612                if ivp == 0:
     2613                    figname = kplot + '_' + vn + '_' + kdiff + '_' + modexpdiffS +   \
     2614                      '_' + op.replace('+','-')
     2615                else:
     2616                    figname = figname + '-' + vn + '_' + op.replace('+','-')
     2617
     2618                # Title of the figure:
     2619                if mod1 == mod2:
     2620                    modexptit = mod1 + '!' + exp2 + '-' + exp1
     2621                else:
     2622                    modexptit = modexpdiff
     2623
     2624                if ivp == 0:
     2625                    titfigure = modexptit + "!" + kdiff + "!'" + vn + "'"
     2626                    vnS = vn
     2627                else:
     2628                    titfigure = titfigure + "!&!'" + vn + "'"
     2629                    vnS = vnS + '!&!' + vn
     2630
     2631                opvals = op.split('+')
     2632                for op1 in opvals:
     2633                    if not opexplained.has_key(op1):
     2634                        print errormsg
     2635                        print '  '+fname+": no explanation for operation '"+op1+"' !!"
     2636                        print '    provided:', opexplained.keys()
     2637                        quit(-1)
     2638                    if op1 == opvals[0]:
     2639                        titfigure = titfigure + '$_{[' + opexplained[op1]
     2640                        if len(opvals) == 1: titfigure = titfigure + ']}$'
     2641                    elif op1 == opvals[len(opvals)-1]:
     2642                        titfigure = titfigure + '\!' + opexplained[op1] + ']}$'
     2643                    else:
     2644                        titfigure = titfigure + '\!' + opexplained[op1]
     2645
     2646                ivp = ivp + 1
     2647            # End of variable-operation
     2648            figname = figname + '.' + kindfigure
     2649
     2650            if len(titfigure) > 80:
     2651                print warnmsg
     2652                print ' ' + fname + ": figure title '" + titfigure.replace('!', ' ')+\
     2653                  "' larger than 80 characters (actually", len(titfigure), ') !!'
     2654                print "  simplifying it to '" + modexptit.replace('!',' ') + '!' +   \
     2655                  kdiff + '!' + vnS + "'"
     2656                titfigure = modexptit.replace(' ','!') + '!' + kdiff + '!' + vnS
     2657
     2658            draw_plot(kplot, CFvarsplot, filesplot, varsplot, dimsplot, pictplot,    \
     2659              figname, titfigure, kindfigure, mapvalue, timevals, odir, pyHOME,      \
     2660              figscr, debug)
     2661
     2662        # End of variables-operations
     2663
     2664    # End of kind of plots
     2665
     2666    return
     2667
    23342668# Files with information about the configuration of the script
    23352669inffiles = ['varcompute.inf', 'all_computevars.inf', 'all_statsvars.inf']
     
    23422676cnf = gen.get_configuration('model_graphics.dat', False)
    23432677
     2678verify_configuration(cnf, gen.Str_Bool(cnf['debug']))
     2679
    23442680# scratches
    2345 scratch, filescratch, figscratch, diffscratch, addfiles, addfigures, adddiffs, dbg = scratches(cnf)
     2681scratch, filescratch, figscratch, diffscratch, figdiffscratch, addfiles, addfigures, \
     2682  adddiffs, dbg = scratches(cnf)
    23462683
    23472684# Getting models
     
    24832820
    24842821        if not os.path.isfile(dirfigf):
    2485             listplots, Nplt = plots_listconstruct(cnf, owdir, dbg)
     2822            listplots, Nplt = plots_listconstruct(cnf, 'DIRPLT', dirfigf, owdir, dbg)
    24862823        else:
    24872824            print warnmsg
     
    25192856    for exp1 in exps[0:Nexps-1]:
    25202857        for exp2 in exps[1:Nexps]:
    2521             print '  ' + exp2 + '-' + exp1 + '...'
     2858            Sexps = exp2 + '-' + exp1
     2859            print '  ' + Sexps + '...'
    25222860            owdir = cnf['ofold'] + '/' + mod + '/' + exp2 + '-' + exp1
    25232861            sout = sub.call('mkdir -p ' + owdir, shell=True)
     
    25342872                    objf.close()
    25352873                    difff = owdir + '/all_vardiffstatistics.inf'
    2536                     sub.call('rm ' + +' >& /dev/null', shell=True)
     2874                    sub.call('rm ' + difff +' >& /dev/null', shell=True)
    25372875                    objf = open(owdir+'/all_' + fdiff,'w')
    25382876                    objf.write("## Computation of all differences statistics " +     \
     
    25722910        compute_var_diffs(cnf, alldiffvar, owdir, diffscratch, dbg)
    25732911
     2912# Plotting operation differences
     2913##
     2914        print "  " + main + ": Plotting operation differences' figures ..."
     2915        dirfigf = owdir + '/diffopplotsdraw.inf'
     2916        if figscratch:
     2917            sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     2918
     2919            objf = open(owdir+'/all_diffopfigures.inf','w')
     2920            objf.write("## Drawing of all operation difference figures \n")
     2921            objf.close()
     2922
     2923        if addfigures:
     2924            sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     2925
     2926        if not os.path.isfile(dirfigf):
     2927            listplots, Nplt = plots_listconstruct(cnf, 'PLOTDIFFOP', dirfigf, owdir, \
     2928              dbg)
     2929        else:
     2930            print warnmsg
     2931            print '  ' + main + ": getting plots to draw already from file !!"
     2932            listplots, Nplt = read_plot_file(dirfigf)
     2933
     2934        # End of avoiding to repeat all the plots search
     2935
     2936        print "  For experiment 'operation' differences '" + Sexps + "' is " +       \
     2937          "required to plot:" , Nplt, "plots"
     2938
     2939        if dbg:
     2940            print 'Plots to draw _______'
     2941            gen.printing_dictionary(listplots)
     2942
     2943        draw_diff_plots(cnf, listplots, owdir, alldiffop, 'diffop', figdiffscratch,  \
     2944          dbg)
     2945        draw_diff_plots(cnf, listplots, owdir, alldiffvar, 'diffvar', figdiffscratch,\
     2946          dbg)
     2947
    25742948    quit()
    25752949# end of mods loop
  • trunk/tools/model_graphics_template.dat

    r1032 r1039  
    3232diffscratch = false
    3333
     34# Scratch difference figures: should be any figures previous work removed and start from the scratch?
     35figdiffscratch = false
     36
    3437# Have new files been added and do they need to be processed?
    3538addfiles = false
     
    4245
    4346# Debug
    44 debug = true
     47debug = false
    4548
    4649# Folder with the files
     
    160163
    161164DIRPLT_shadcont2Dsfc = uas|last#vas|last:hfls|last#hfss|last
    162 DIRPLT_shadconthovmsfc = hfls|xmean#hfss|last
     165DIRPLT_shadconthovmsfc = hfls|xmean#hfss|xmean
    163166DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean
    164167
     
    167170#pltshadcont2Dzsec = ua|pinterp@last@xmean#va|pinterp@last@xmean:hur|pinterp@last@xmean#ta|pinterp@last@xmean:ws|pinterp@turb@xmean#hus|pinterp@turb@xmean
    168171
    169 pltdiffshadcont2Dsfc = tas|tmean#wss|tmean:wss|last#tas|last
    170 pltdiffshadconthovmsfc = wss|xmean#tas|xmean
    171 pltdiffshadcont2Dzsec = ua|pinterp@last@xmean#va|pinterp@last@xmean
     172PLOTDIFFOP_shadcont2Dsfc = hfls|last#hfss|last:hfss|tmean#hfls|tmean
     173PLOTDIFFOP_shadconthovmsfc = uas|xmean#vas|xmean
     174PLOTDIFFOP_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean
     175
     176PLOTDIFFVAR_shadcont2Dsfc = hfls|last#hfss|last:hfss|tmean#hfls|tmean
     177PLOTDIFFVAR_shadconthovmsfc = uas|xmean#vas|xmean
     178PLOTDIFFVAR_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean
    172179
    173180# Specific variable-statistisc graphic parameters (if no value is given, they will be retrieved from 'variables_values.dat')
     
    183190#        [colorcnt]: color for the countor lines
    184191specificvarplot = cll|last|shadcont2Dsfc|0.|1.|gist_gray|%g|black:clh|last|shadcont2Dsfc|0.|1.|gist_gray|%g|black:husturbmean|pinterp@turb@xmean|shadcont2Dzsec|0.|1.e-6|Blues|%g|black
    185 diffspecificvarplot = tas|tmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:wss|tmean|shadcont2Dsfc|-30.|30.|seismic|%g|black:tas|last|shadcont2Dsfc|-20.|20.|seismic|%g|black:wss|last|shadcont2Dsfc|-30.|30.|seismic|%g|black
     192specificdiffopplot = hfls|tmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:hfss|tmean|shadcont2Dsfc|-30.|30.|seismic|%g|black:hfls|last|shadcont2Dsfc|-800.|0.|seismic|%g|black:hfss|last|shadcont2Dsfc|-400.|10.|seismic|%g|black:uas|xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:vas|xmean|shadcont2Dsfc|-30.|30.|seismic|%g|black:ua|pinterp+tmean+xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:va|pinterp+tmean+xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black
     193specificdiffvarplot = hfls|tmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:hfss|tmean|shadcont2Dsfc|-30.|30.|seismic|%g|black:hfls|last|shadcont2Dsfc|-800.|0.|seismic|%g|black:hfss|last|shadcont2Dsfc|-400.|10.|seismic|%g|black:uas|xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:vas|xmean|shadcont2Dsfc|-30.|30.|seismic|%g|black:ua|pinterp+tmean+xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black:va|pinterp+tmean+xmean|shadcont2Dsfc|-20.|20.|seismic|%g|black
    186194
    187195# Figures output kind
Note: See TracChangeset for help on using the changeset viewer.