Changeset 1067 in lmdz_wrf for trunk/tools
- Timestamp:
- Aug 30, 2016, 6:50:10 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.py
r1064 r1067 690 690 except: 691 691 print errmsg 692 print 'fvaradd('+idir+'/'+cf+','+rqv+', '+ifilen+')'692 print 'fvaradd('+idir+'/'+cf+','+rqv+', '+ifilen+')' 693 693 for s1out in output: print s1out 694 694 quit(-1) … … 2486 2486 otrackf.write(pyins + "\n") 2487 2487 2488 # removing dimension variable-dimension 'lon' 2489 varnCFs.remove('lon') 2490 2488 2491 varkeep.append('lonstats') 2489 2492 … … 2513 2516 otrackf.write("# " + varn + " " + Fopers + "\n") 2514 2517 otrackf.write(pyins + "\n") 2518 2519 # removing dimension variable-dimension 'lat' 2520 varnCFs.remove('lat') 2515 2521 2516 2522 varkeep.append('latstats') … … 2562 2568 except: 2563 2569 print errmsg 2564 print 'fvaradd(' , prevfile, ','+CFvn+','+fileon+')'2570 print 'fvaradd(' + prevfile + ',' + CFvn +', ' + fileon + ')' 2565 2571 for s1out in output: print s1out 2566 2572 quit(-1) … … 2883 2889 else: 2884 2890 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'] 2886 2892 2887 2893 pictplot.append(pictvals) … … 2956 2962 2957 2963 odir = config['ofold'] + '/' + mod + '/' + exp 2964 2965 # NON re-projectable operations 2966 opNOreproj = config['NOreprojops'].split(':') 2958 2967 2959 2968 # Need to pass to analyze all the data? … … 3050 3059 values = allcompvar[vnop] 3051 3060 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 3052 3065 cdoop = gen.dictionary_key_list(CDOops,vn).split('_')[1] 3053 3066 if cdoop is None: … … 3081 3094 ifile = ifiles[iif] 3082 3095 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: 3084 3110 if debug and ofile == ofiles[0]: 3085 3111 print " reprojecting '" + vn + "' '" + op + "' into '" + \ … … 3109 3135 # Keeping track of re-prjection 3110 3136 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 3112 3142 trckobjf.write(ins + '\n') 3113 3143 … … 3145 3175 figmoddiffscratch, addfiles, addfigures, adddiffs, adddifffigures, addmoddiffs, \ 3146 3176 addmoddifffigures, dbg = scratches(cnf) 3177 3178 if 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 3147 3187 3148 3188 # Getting models … … 3410 3450 3411 3451 if dbg: 3412 print ' Plots to draw _______'3452 print ' Plots to draw _______' 3413 3453 gen.printing_dictionary(listplots) 3414 3454 3415 3455 draw_diff_plots(cnf, listplots, owdir, alldiffop, 'diffop', figdiffscratch, \ 3416 3456 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 3417 3489 draw_diff_plots(cnf, listplots, owdir, alldiffvar, 'diffvar', figdiffscratch,\ 3418 3490 dbg) … … 3534 3606 Sexps = exp2 + '-' + exp1 3535 3607 print ' ' + Sexps + '...' 3536 owdir = cnf['ofold'] + '/' + Smods + '/' + exp2 + '-' + exp13608 owdir = cnf['ofold'] + '/' + Smods + '/' + Sexps 3537 3609 sout = sub.call('mkdir -p ' + owdir, shell=True) 3538 3610 … … 3575 3647 # op and var differences 3576 3648 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]): 3578 3651 alldiffop, alldiffvar, Nopdiffs, Nvardiffs = \ 3579 3652 diffvarop_listconstruct(cnf, difmods, difexps, difreproj,owdir,\ … … 3599 3672 ## 3600 3673 print " Computing operation differences ..." 3601 compute_op_diffs(cnf, alldiffop, owdir, diffscratch, dbg)3674 compute_op_diffs(cnf, alldiffop, owdir, moddiffscratch, dbg) 3602 3675 print " Computing variable differences ..." 3603 compute_var_diffs(cnf, alldiffvar, owdir, diffscratch, dbg)3676 compute_var_diffs(cnf, alldiffvar, owdir, moddiffscratch, dbg) 3604 3677 3605 3678 # Plotting operation differences … … 3607 3680 print " " + main + ": Plotting operation differences' figures ..." 3608 3681 dirfigf = owdir + '/diffopplotsdraw.inf' 3609 if fig scratch:3682 if figmoddiffscratch: 3610 3683 sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True) 3611 3684 … … 3614 3687 objf.close() 3615 3688 3616 if add difffigures:3689 if addmoddifffigures: 3617 3690 sout = sub.call('rm ' + dirfigf + ' >& /dev/null', shell=True) 3618 3691 … … 3635 3708 3636 3709 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 3638 3743 draw_diff_plots(cnf, listplots, owdir, alldiffvar, 'diffvar', \ 3639 3744 figdiffscratch, dbg)
Note: See TracChangeset
for help on using the changeset viewer.