- Timestamp:
- Sep 1, 2016, 6:48:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/model_graphics.py
r1072 r1078 791 791 tvar: temporal variance values (Taylor's turbulence) 792 792 xmean: x-axis mean values 793 xvar: x-axis variance values 793 794 ymean: y-axis mean values 794 795 zsum: vertical aggregated values … … 1152 1153 varkeep.append('lonstats') 1153 1154 1155 elif op == 'xvar': 1156 # x-axis variance values 1157 vals='lon|-1,lon,var,' + ':'.join(varnCFs) + ':' + vdnz 1158 dims = gen.dictvar_listS(varnCFs,CFdimvardict,',','@') + dnz+'@'+vdnz 1159 if dofile: 1160 try: 1161 with gen.Capturing() as output: 1162 ncvar.file_oper_alongdims(vals,prevfile,CFvarnp) 1163 except: 1164 print errmsg 1165 print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')' 1166 for s1out in output: print s1out 1167 quit(-1) 1168 1169 if db: 1170 for s1out in output: print s1out 1171 1172 sout = sub.call('mv file_oper_alongdims_var.nc '+fileon, shell=True) 1173 1174 # Keeping the operations 1175 pyins=pyH + "/nc_var.py -o file_oper_alongdims -S '" + vals + \ 1176 "' -f " + prevfile + " -v " + CFvarnp 1177 otrackf.write("\n") 1178 otrackf.write("# " + CFvarn + " " + Fopers + "\n") 1179 otrackf.write(pyins + "\n") 1180 1181 # removing dimension variable-dimension 'lon' 1182 varnCFs.remove('lon') 1183 1184 varkeep.append('lonstats') 1185 1154 1186 elif op == 'ymean': 1155 1187 # y-axis mean values … … 1570 1602 if gen.searchInlist(dplot,'lon'): 1571 1603 spacedim ='lon' 1572 figmid = 'longitudinal|evolution|of' 1573 figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' + \ 1574 '|'.join(tfig.split('!')[2:]) 1575 reverse= 'None' 1576 dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;'+spacedim+';time' 1604 axisvals = 'y' 1605 figmid = 'longitudinal' 1606 elif gen.searchInlist(dplot,'lat'): 1607 spacedim = 'lat' 1608 axisvals = 'x' 1609 figmid = 'meridional' 1610 elif gen.searchInlist(dplot,'pres'): 1611 spacedim = 'pres' 1612 axisvals = 'x' 1613 figmid = 'vertical' 1577 1614 else: 1578 spacedim='lat' 1579 figmid = 'meridional|evolution|of' 1580 figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' + \ 1581 '|'.join(tfig.split('!')[2:]) 1582 reverse='None' 1583 dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;time;'+spacedim 1584 1585 graphvals = ','.join(CFvplot) 1586 graphvals = graphvals + ';'+ dims +';'+ cbar + \ 1587 ';' + ckind + ',' + cline + ';' + cfmt + ';' + srange + ';' + crange + \ 1588 ',9;' + figtit + ';' + kfig + ';' + reverse + ';' + 'time|' + tunits + \ 1589 '|'+ timekind + '|' + timefmt + '|' + timelabel 1615 print errmsg 1616 print ' ' + fname + ": in '2lines' only ready for: 'lon', 'lat'," + \ 1617 " 'pres' as common dimension !!" 1618 print ' dimensions in plot:', dplot 1619 quit(-1) 1620 1621 figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' + \ 1622 '|'.join(tfig.split('!')[2:]) 1623 1624 graphvals = spacedim + ':' + Arange + ':' + Brange + ':Extrs:' + \ 1625 axisvals + ':' + ','.join(CFvplot) + ':' + Aline + ',' + Bline + \ 1626 ':2.,2.:' + Akind + ',' + Bkind + ':,:' + figtit + ':' + spacedim + \ 1627 ':0:' + finame + ':' + kfig 1590 1628 1591 1629 fvarS = ','.join(vplot) 1592 1630 1593 drwins = 'draw_2 D_shad_cont_time'1631 drwins = 'draw_2lines' 1594 1632 plotins = 'python ' + pyH + '/drawing.py -f ' + figfs +' -o ' + drwins + \ 1595 1633 " -S '" + graphvals + "' -v " + fvarS 1596 1597 1598 values= [dimvname]:[valuesaxis]:[dimtit]:[leglabels]:[vtit]:[title]:[locleg]:[colns]:[lines]1599 [points]:[lwdths]:[psizes]:[freqv]:[figname][graphk]1600 [dimvname]: ',' list of names of the variable with he values of the common dimension1601 [valuesaxis]: which axis will be used for the values ('x', or 'y')1602 [dimtit]: title for the common dimension1603 [leglabels]: ',' separated list of names for the legend1604 [vartit]: name of the variable in the graph1605 [title]: title of the plot ('|' for spaces)1606 [locleg]: location of the legend (0, autmoatic)1607 1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',1608 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',1609 9: 'upper center', 10: 'center'1610 [colns]= ',' list of color names ('None' for automatic, single value for all the same)1611 [lines]= ',' list of style of lines ('None' for automatic, single value for all the same)1612 [points]= ',' list of style of points ('None' for automatic, single value for all the same)1613 [lwdths]= ',' list of withs of lines ('None' for automatic, single value for all the same)1614 [psizes]= ',' list of size of points ('None' for automatic, single value for all the same)1615 [freqv]= frequency of values ('all' for all values)1616 [figname]= name of the figure1617 [graphk]: kind of the graphic1618 varname= variable to plot1619 1620 1634 1621 1635 try: … … 1629 1643 quit(-1) 1630 1644 1631 sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True)1632 1633 1645 # keeping all figures 1634 1646 trkobjf.write('\n') 1635 1647 trkobjf.write("#" + tfig.replace('!',' ') + '\n') 1636 1648 trkobjf.write(plotins + '\n') 1649 1650 elif kplot == '2linesTime': 1651 figtit = tfig.replace('!','|') 1652 1653 lineAstdn = CFvplot[0] 1654 lineBstdn = CFvplot[1] 1655 figfs = ','.join(fplot) 1656 1657 lineA = pplot[0] 1658 Arange = str(lineA[0]) + ',' + str(lineA[1]) 1659 # Values are changed from specific values in `model_graphics.dat' 1660 if lineA[3].find('%') == -1: 1661 Aline = lineA[2] 1662 Akind = lineA[3] 1663 Amark = lineA[4] 1664 Asize = lineA[5] 1665 else: 1666 Aline = 'red' 1667 Akind = '-' 1668 Amark = ',' 1669 Asize = 2. 1670 1671 lineB = pplot[1] 1672 Brange = str(lineB[0]) + ',' + str(lineB[1]) 1673 # Values are changed from specific values in `model_graphics.dat' 1674 if lineB[3].find('%') == -1: 1675 Bline = lineB[2] 1676 Bkind = lineB[3] 1677 Bmark = lineB[4] 1678 Bsize = lineB[5] 1679 else: 1680 Bline = 'red' 1681 Bkind = '-' 1682 Bmark = ',' 1683 Bsize = 2. 1684 1685 timeaxis = 'x' 1686 figmid = 'evolution' 1687 1688 figtit = '!'.join(tfig.split('!')[0:2]) + '!' + figmid + '!' + \ 1689 '!'.join(tfig.split('!')[2:]) 1690 1691 graphvals = 'time:' + Arange + ':' + Brange + ':' + timekind + ';' + \ 1692 timefmt + ':' + timeaxis + ':' + ','.join(CFvplot) + ':' + Aline + ',' \ 1693 + Bline + ':2.,2.:' + Akind + ',' + Bkind + ':2.,2.:,:' + figtit + ':' \ 1694 + timelabel + ':0:' + finame + ':' + kfig 1695 1696 fvarS = ','.join(vplot) 1697 1698 drwins = 'draw_2lines_time' 1699 plotins = 'python ' + pyH + '/drawing.py -f ' + figfs +' -o ' + drwins + \ 1700 " -S '" + graphvals + "' -v " + fvarS 1701 1702 try: 1703 with gen.Capturing() as output: 1704 sout = sub.call(plotins, shell=True) 1705 except: 1706 print errmsg 1707 print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')' 1708 print sout 1709 for s1out in output: print s1out 1710 quit(-1) 1711 1712 # keeping all figures 1713 trkobjf.write('\n') 1714 trkobjf.write("#" + tfig.replace('!',' ') + '\n') 1715 trkobjf.write(plotins + '\n') 1716 1637 1717 elif kplot == 'shadcont2Dsfc': 1638 1718 figtit = tfig.replace('!','|') … … 1985 2065 for op1 in opvals: 1986 2066 if not opexplained.has_key(op1): 1987 print err ormsg2067 print errmsg 1988 2068 print ' '+fname+": no explanation for operation '"+op1+"' !!" 1989 2069 print ' provided:', opexplained.keys() … … 2344 2424 tvar: temporal variance values (Taylor's turbulence) 2345 2425 xmean: x-axis mean values 2426 xvar: x-axis variance values 2346 2427 ymean: y-axis mean values 2347 2428 zsum: vertical aggregated values … … 2610 2691 varkeep.append('lonstats') 2611 2692 2693 elif op == 'xvar': 2694 # x-axis variance values 2695 vals='lon|-1,lon,var,' + ':'.join(varnCFs) + ':' + vdnz 2696 dims = gen.dictvar_listS(varnCFs,CFdimvardict,',','@') + dnz+'@'+vdnz 2697 if dofile: 2698 try: 2699 with gen.Capturing() as output: 2700 ncvar.file_oper_alongdims(vals,prevfile,CFvarnp) 2701 except: 2702 print errmsg 2703 print 'file_oper_alongdims('+vals+',', prevfile, ','+CFvarnp+')' 2704 for s1out in output: print s1out 2705 quit(-1) 2706 2707 if db: 2708 for s1out in output: print s1out 2709 2710 sout = sub.call('mv file_oper_alongdims_var.nc '+fileon, shell=True) 2711 2712 # Keeping the operations 2713 pyins=pyH + "/nc_var.py -o file_oper_alongdims -S '" + vals + \ 2714 "' -f " + prevfile + " -v " + CFvarnp 2715 otrackf.write("\n") 2716 otrackf.write("# " + CFvarn + " " + Fopers + "\n") 2717 otrackf.write(pyins + "\n") 2718 2719 # removing dimension variable-dimension 'lon' 2720 varnCFs.remove('lon') 2721 2722 varkeep.append('lonstats') 2723 2612 2724 elif op == 'ymean': 2613 2725 # y-axis mean values
Note: See TracChangeset
for help on using the changeset viewer.