Changeset 1067 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Aug 30, 2016, 6:50:10 PM (8 years ago)
Author:
lfita
Message:

Working up to the model differences of statistics without 'lon' or 'lat'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.py

    r1064 r1067  
    690690                    except:
    691691                        print errmsg
    692                         print 'fvaradd('+idir+'/'+cf+','+rqv+','+ifilen+')'
     692                        print 'fvaradd('+idir+'/'+cf+','+rqv+', '+ifilen+')'
    693693                        for s1out in output: print s1out
    694694                        quit(-1)
     
    24862486                otrackf.write(pyins + "\n")
    24872487
     2488            # removing dimension variable-dimension 'lon'
     2489            varnCFs.remove('lon')
     2490
    24882491            varkeep.append('lonstats')
    24892492
     
    25132516                otrackf.write("# " + varn + " " + Fopers + "\n")
    25142517                otrackf.write(pyins + "\n")
     2518
     2519            # removing dimension variable-dimension 'lat'
     2520            varnCFs.remove('lat')
    25152521
    25162522            varkeep.append('latstats')
     
    25622568                    except:
    25632569                        print errmsg
    2564                         print 'fvaradd(', prevfile, ','+CFvn+','+fileon+')'
     2570                        print 'fvaradd(' + prevfile + ',' + CFvn +', ' + fileon + ')'
    25652571                        for s1out in output: print s1out
    25662572                        quit(-1)
     
    28832889                else:
    28842890                    Vvals = gen.variables_values(vn)
    2885                     pictvals = [Vvals[2], Vvals[3], Vvals[6], '%g', 'black']
     2891                    pictvals = [Vvals[2], Vvals[3], Vvals[6], '%g', 'fixsigc','black']
    28862892
    28872893                pictplot.append(pictvals)
     
    29562962
    29572963    odir = config['ofold'] + '/' + mod + '/' + exp
     2964
     2965    # NON re-projectable operations
     2966    opNOreproj = config['NOreprojops'].split(':')
    29582967
    29592968    # Need to pass to analyze all the data?
     
    30503059        values = allcompvar[vnop]
    30513060
     3061        # Only are reprojected that files which do contain 'lon' and 'lat',
     3062        #   otherways, it is only re-projected the original file
     3063        inNO, iopNO, iop = gen.list_coincidences(opNOreproj,op.split('+'))
     3064
    30523065        cdoop = gen.dictionary_key_list(CDOops,vn).split('_')[1]
    30533066        if cdoop is None:
     
    30813094            ifile = ifiles[iif]
    30823095            ofile = ofiles[iif]
    3083             if not os.path.isfile(ofile):
     3096
     3097            # Only projecting original file-variable if there are not 'lon' and 'lat'
     3098            doreproj = True
     3099            if iif == 1 and len(inNO) > 0:
     3100                doreproj = False
     3101                print warnmsg
     3102                print '  ' + fname + ": operation '" + op + "' can not be " +        \
     3103                  "reprojected due to the lack of 'lon' or 'lat' skipping it !!"
     3104                print "    NOTE: difference can only be computed as 'variable' " +   \
     3105                  "difference"
     3106                print "      As operating along the differences from the original" + \
     3107                  " values from each model"
     3108
     3109            if not os.path.isfile(ofile) and doreproj:
    30843110                if debug and ofile == ofiles[0]:
    30853111                    print "      reprojecting '" + vn + "' '" + op + "' into '" +    \
     
    31093135                # Keeping track of re-prjection
    31103136                trckobjf.write('\n')
    3111                 trckobjf.write('# ' + vn + ' ' + op + '\n')
     3137                if iif == 0:
     3138                    trckobjf.write('# ' + vn + '\n')
     3139                else:
     3140                    trckobjf.write('# ' + vn + ' ' + op + '\n')
     3141
    31123142                trckobjf.write(ins + '\n')
    31133143
     
    31453175  figmoddiffscratch, addfiles, addfigures, adddiffs, adddifffigures, addmoddiffs,    \
    31463176  addmoddifffigures, dbg = scratches(cnf)
     3177
     3178if dbg:
     3179    print 'Experiment configuration scratches _______'
     3180    print '  scratch:', scratch, 'filescratch:', filescratch,'figscratch:', figscratch
     3181    print '  diffscratch:', diffscratch, 'figdiffscratch:', figdiffscratch
     3182    print '  moddiffscratch:', moddiffscratch, 'figmoddiffscratch:', figmoddiffscratch
     3183    print 'Experiment configuration adding _______'
     3184    print '  addfiles:', addfiles, 'addfigures:', addfigures
     3185    print '  adddiffs:', adddiffs, 'adddifffigures:', adddifffigures
     3186    print '  addmoddiffs:', addmoddiffs, 'addmoddifffigures:', addmoddifffigures
    31473187
    31483188# Getting models
     
    34103450
    34113451        if dbg:
    3412             print 'Plots to draw _______'
     3452            print '    Plots to draw _______'
    34133453            gen.printing_dictionary(listplots)
    34143454
    34153455        draw_diff_plots(cnf, listplots, owdir, alldiffop, 'diffop', figdiffscratch,  \
    34163456          dbg)
     3457
     3458        # Plotting variable differences
     3459        ##
     3460        print "  " + main + ": Plotting variable differences' figures ..."
     3461        dirfigf = owdir + '/diffvarplotsdraw.inf'
     3462        if figscratch:
     3463            sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     3464
     3465            objf = open(owdir+'/all_diffvarfigures.inf','w')
     3466            objf.write("## Drawing of all variables difference figures \n")
     3467            objf.close()
     3468
     3469        if adddifffigures:
     3470            sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     3471
     3472        if not os.path.isfile(dirfigf):
     3473            listplots, Nplt = plots_listconstruct(cnf, 'PLOTDIFFVAR', dirfigf, owdir,\
     3474              dbg)
     3475        else:
     3476            print warnmsg
     3477            print '  ' + main + ": getting plots to draw already from file !!"
     3478            listplots, Nplt = read_plot_file(dirfigf)
     3479
     3480        # End of avoiding to repeat all the plots search
     3481
     3482        print "  For experiment 'variables' differences '" + Sexps + "' is " +       \
     3483          "required to plot:" , Nplt, "plots"
     3484
     3485        if dbg:
     3486            print '    Plots to draw _______'
     3487            gen.printing_dictionary(listplots)
     3488
    34173489        draw_diff_plots(cnf, listplots, owdir, alldiffvar, 'diffvar', figdiffscratch,\
    34183490          dbg)
     
    35343606                Sexps = exp2 + '-' + exp1
    35353607                print '    ' + Sexps + '...'
    3536                 owdir = cnf['ofold'] + '/' + Smods + '/' + exp2 + '-' + exp1
     3608                owdir = cnf['ofold'] + '/' + Smods + '/' + Sexps
    35373609                sout = sub.call('mkdir -p ' + owdir, shell=True)
    35383610
     
    35753647                # op and var differences
    35763648                diffvarcompf = owdir + '/' + difffiles[0]
    3577                 if not os.path.isfile(diffvarcompf):
     3649                if not os.path.isfile(owdir+'/'+difffiles[0]) or                     \
     3650                  not os.path.isfile(owdir+'/'+difffiles[1]):
    35783651                    alldiffop, alldiffvar, Nopdiffs, Nvardiffs =                     \
    35793652                      diffvarop_listconstruct(cnf, difmods, difexps, difreproj,owdir,\
     
    35993672##
    36003673                print "    Computing operation differences ..."
    3601                 compute_op_diffs(cnf, alldiffop, owdir, diffscratch, dbg)
     3674                compute_op_diffs(cnf, alldiffop, owdir, moddiffscratch, dbg)
    36023675                print "    Computing variable differences ..."
    3603                 compute_var_diffs(cnf, alldiffvar, owdir, diffscratch, dbg)
     3676                compute_var_diffs(cnf, alldiffvar, owdir, moddiffscratch, dbg)
    36043677
    36053678# Plotting operation differences
     
    36073680                print "  " + main + ": Plotting operation differences' figures ..."
    36083681                dirfigf = owdir + '/diffopplotsdraw.inf'
    3609                 if figscratch:
     3682                if figmoddiffscratch:
    36103683                    sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
    36113684
     
    36143687                objf.close()
    36153688
    3616                 if adddifffigures:
     3689                if addmoddifffigures:
    36173690                    sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
    36183691
     
    36353708
    36363709                draw_diff_plots(cnf, listplots, owdir, alldiffop, 'diffop',          \
    3637                   figdiffscratch, dbg)
     3710                  figmoddiffscratch, dbg)
     3711
     3712                # Plotting variable differences
     3713                ##
     3714                print "  " + main + ": Plotting variable differences' figures ..."
     3715                dirfigf = owdir + '/diffvarplotsdraw.inf'
     3716                if figscratch:
     3717                    sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     3718
     3719                    objf = open(owdir+'/all_diffvarfigures.inf','w')
     3720                    objf.write("## Drawing of all variables difference figures \n")
     3721                    objf.close()
     3722       
     3723                if adddifffigures:
     3724                    sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True)
     3725
     3726                if not os.path.isfile(dirfigf):
     3727                    listplots, Nplt = plots_listconstruct(cnf,'PLOTDIFFVAR',dirfigf, \
     3728                      owdir, dbg)
     3729                else:
     3730                    print warnmsg
     3731                    print '  ' + main + ": getting plots to draw already from file !!"
     3732                    listplots, Nplt = read_plot_file(dirfigf)
     3733
     3734                # End of avoiding to repeat all the plots search
     3735
     3736                print "  For experiment 'variables' differences '" + Sexps+ "' is "+ \
     3737                  "required to plot:" , Nplt, "plots"
     3738
     3739                if dbg:
     3740                    print '    Plots to draw _______'
     3741                    gen.printing_dictionary(listplots)
     3742
    36383743                draw_diff_plots(cnf, listplots, owdir, alldiffvar, 'diffvar',        \
    36393744                  figdiffscratch, dbg)
Note: See TracChangeset for help on using the changeset viewer.