Changeset 1031 in lmdz_wrf
- Timestamp:
- Aug 18, 2016, 3:31:59 PM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.py
r1029 r1031 33 33 filescr = True 34 34 figscr = True 35 difscr = True 35 36 tim.sleep(10) 36 37 else: … … 54 55 figscr = False 55 56 57 if config['diffscratch'] == 'true': 58 difscr = True 59 print warnmsg 60 print " " + main + ": differences starting from the SCRATCH !!" 61 print " 5 seconds left!!" 62 tim.sleep(5) 63 else: 64 difscr = False 65 56 66 if config['addfiles'] == 'true': 57 67 addfils = True … … 64 74 addfigs = False 65 75 76 if config['adddiffs'] == 'true': 77 adddiffs = True 78 else: 79 adddiffs = False 80 66 81 if config['debug'] == 'true': 67 82 debug = True … … 69 84 debug = False 70 85 71 return scr, filescr, figscr, addfils, addfigs, debug86 return scr, filescr, figscr, difscr, addfils, addfigs, adddiffs, debug 72 87 73 88 def exp_headers(mod,config): … … 455 470 print ' ' + fname + ": creation of variable file '" + CFvarn + \ 456 471 "' in file '" + ifilen + "' ..." 457 458 if modvar is not None and diagvar is None: 472 print 'model variable:', modvar 473 print 'diagostic variable:', diagvar 474 475 if diagvar is None: 459 476 # model variable 460 values = modvar[0] + ',0,-1,-1' 461 vs = modvar[0] + ',' + vdnx + ',' + vdny + ',' + vdnz + ',' + vdnt 462 with gen.Capturing() as output: 463 ncvar.DataSetSection_multivars(values, cf, vs) 464 477 if db: print ' '+fname+ ": variable direct from model '" +modvar+ "'" 478 values = modvar + ',0,-1,-1' 479 vs = modvar + ',' + vdnx + ',' + vdny + ',' + vdnz + ',' + vdnt 480 481 try: 482 with gen.Capturing() as output: 483 ncvar.DataSetSection_multivars(values, cf, vs) 484 except: 485 print errmsg 486 print 'ncvar.DataSetSection_multivars('+values+', '+cf+', '+vs+')' 487 for sout in output: print sout 488 quit(-1) 489 465 490 newfile, loc = gen.search_sec_list(output,'succesfull') 466 491 ofile = newfile[0].split(' ')[7] … … 471 496 vs + " -S '" + values + "'" 472 497 otrackf.write('\n') 473 otrackf.write('# ' + CFvarn + " " + modvar [0]+ '\n')498 otrackf.write('# ' + CFvarn + " " + modvar + '\n') 474 499 otrackf.write(pyins + '\n') 475 500 476 501 # CF renaming of variable 477 ncvar.chvarname(CFvarn,ifilen,modvar [0])502 ncvar.chvarname(CFvarn,ifilen,modvar) 478 503 else: 479 504 # diagnostic variable 505 if db: print ' '+fname+ ": variable as diagnostic '" +diagvar[0]+ "'" 480 506 dims = dnt+'@'+vdnt+','+dnz+'@'+vdnz+','+dny+'@'+vdny+','+dnx+'@'+vdnx 481 507 diagn = diagvar[0] … … 549 575 sout = sub.call('mv netcdf_fold_concatenated_HMT.nc ' + fileon, shell=True) 550 576 if os.path.isfile(fileon): 551 sout = sub.call('rm ' + CFvarn + '_' + headerf + '_*-*.nc', shell=True) 577 sout = sub.call('rm ' + CFvarn +'_'+ headerf+SgP + '_*-*.nc >& /dev/null', 578 shell=True) 552 579 553 580 return … … 968 995 fname = 'compute_vars' 969 996 970 for vopn in allvarcomp :997 for vopn in allvarcomp.keys(): 971 998 # variable & operation 972 999 vn = vopn.split('_')[0] … … 1057 1084 else: 1058 1085 plots = indivplotsvar[VOv] 1059 indivplots.append(pln)1086 plots.append(pln) 1060 1087 indivplotsvar[VOv] = plots 1061 1088 … … 1504 1531 vnopS = vn + '_' + op 1505 1532 if not allvarcomp.has_key(vnopS): 1506 print err ormsg1507 print ' ' + fname + ": no entryfor variable-operation '" + \1533 print errmsg 1534 print ' ' + fname + ": no file for variable-operation '" + \ 1508 1535 vnopS + "' !!" 1509 1536 vopvals = allvarcomp[vnopS] … … 1597 1624 1598 1625 # scratches 1599 scratch, filescratch, figscratch, addfiles, addfigures, dbg = scratches(cnf)1626 scratch, filescratch, figscratch, diffscratch, addfiles, addfigures, adddiffs, dbg = scratches(cnf) 1600 1627 1601 1628 # Getting models … … 1607 1634 print mod 1608 1635 if scratch: 1609 sout = sub.call('rm -rf '+cnf['ofold']+'/'+mod+' > /dev/null', shell=True) 1636 if cnf['ofold'] != cnf['ifold']: 1637 sout = sub.call('rm -rf '+cnf['ofold']+'/'+mod+' > /dev/null', shell=True) 1638 else: 1639 print warnmsg 1640 print ' ' + main + ": input '" + cnf['ifold'] + "' and output '" + \ 1641 cnf['ofold'] + "' are the same folder !!" 1642 print " Keeping output folder although it has 'scratch' start" 1610 1643 1611 1644 # Get experiments and headers of model … … 1747 1780 draw_plots(cnf, listplots, mod, exp, owdir, allcompvar, figscratch, dbg) 1748 1781 1749 quit()1750 1782 # end of experiments loop 1751 1783 1784 ### ## # 1785 # Experiment differences 1786 ## # ## # 1787 1788 # Experiments loop 1789 ## 1790 Nexps = len(exps) 1791 for exp1 in exps[0:Nexps-1]: 1792 for exp2 in exps[1:Nexps]: 1793 print ' ' + exp2 + '-' + exp1 + '...' 1794 owdir = cnf['ofold'] + '/' + mod + '/' + exp2 + '-' + exp1 1795 sout = sub.call('mkdir -p ' + owdir, shell=True) 1796 1797 diffvarcompf = owdir + '/diffvarcompute.inf' 1798 if diffscratch: 1799 sub.call('rm -rf' + owdir +' >& /dev/null', shell=True) 1800 sub.call('rm ' + diffvarcompf +' >& /dev/null', shell=True) 1801 objf = open(owdir+'/all_diffcomputevars.inf','w') 1802 objf.write("## Computation and drawing of differences between '" + \ 1803 exp2 + "'-'" + exp1 + "'\n") 1804 objf.close() 1805 1806 if adddiffs: 1807 sub.call('rm ' + diffvarcompf +' >& /dev/null', shell=True) 1808 1809 if not os.path.isfile(diffvarcompf): 1810 alldiffcompvar, Ndiffs = diffcompvars_listconstruct(cnf, Modinf, \ 1811 allcompvar, owdir, dbg) 1812 else: 1813 print warnmsg 1814 print ' ' + main + ": getting differences to compute already from file !!" 1815 alldiffcompvar, Ndiffs = read_diffvarcomp_file(diffvarcompf) 1816 1817 # End of avoiding to repeat all the experiment search 1818 1819 print " For experiments '"+exp2+"'-'"+exp1+"' is required to compute:", \ 1820 Nvar, "differences" 1821 1822 if dbg: 1823 print 'Differences to compute _______' 1824 gen.printing_dictionary(alldiffcompvar) 1825 1826 quit() 1752 1827 # end of mods loop 1753 1828 -
trunk/tools/model_graphics_template.dat
r1029 r1031 27 27 28 28 # Scratch figures: should be any figures previous work removed and start from the scratch? 29 figscratch = true 29 figscratch = false 30 31 # Scratch differences: should be any differences previous work removed and start from the scratch? 32 diffscratch = false 30 33 31 34 # Have new files been added and do they need to be processed? … … 34 37 # Have new figures been added and do they need to be drawn? 35 38 addfigures = false 39 40 # Have new differences been added and do they need to be processed and drawn? 41 adddiffs = false 36 42 37 43 # Debug … … 90 96 # VAR_[calc1]+[calc2] = tas:wss 91 97 # will compute first [calc1] and then [calc2] for 'tas' and 'wss' 92 VAR_last = tas:uas:vas:hfss:hfls:wss93 VAR_tmean = tas:uas:vas:hfss:hfls:wss94 VAR_xmean = tas:uas:vas:hfss:hfls:wss95 #VAR_last+pinterp+xmean = ta:ua:va:hur:hus:turb96 VAR_pinterp+tmean+xmean = ta:ua:va:hur:hus98 VAR_last = uas:vas:hfss:hfls 99 VAR_tmean = uas:vas:hfss:hfls 100 VAR_xmean = uas:vas:hfss:hfls 101 #VAR_last+pinterp+xmean = ua:va:hur:hus:turb 102 VAR_pinterp+tmean+xmean = ua:va 97 103 98 104 #varlast = tas:uas:vas:ps:pr:pracc:rsds:prw:evspsbl:hfss:hfls:hurs:huss:zmla:hufs:wakes:lwakeh:stherm:zmaxth:clt:cll:clm:clh:prc:prls:bils:wss … … 137 143 # DIRPLT_: Figures which can be made directly without another model/experiment output 138 144 139 DIRPLT_shadcont2Dsfc = uas|last#vas|last:hfls|last#hfss|last :wss|last#tas|last140 DIRPLT_shadconthovmsfc = wss|xmean#tas|xmean141 DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean :hus|pinterp+tmean+xmean#ta|pinterp+tmean+xmean145 DIRPLT_shadcont2Dsfc = uas|last#vas|last:hfls|last#hfss|last 146 DIRPLT_shadconthovmsfc = hfls|xmean#hfss|last 147 DIRPLT_shadcont2Dzsec = ua|pinterp+tmean+xmean#va|pinterp+tmean+xmean 142 148 143 149 #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.