Changeset 1072 in lmdz_wrf


Ignore:
Timestamp:
Aug 31, 2016, 6:12:53 PM (9 years ago)
Author:
lfita
Message:

Starting to add plot `2lines'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.py

    r1069 r1072  
    118118        scr = True
    119119        print warnmsg
    120         print "  " + main + ": starting from the SCRATCH !!"
     120        print "  " + fname + ": starting from the SCRATCH !!"
    121121        print "    10 seconds left!!"
    122122        filescr = True
     
    183183            figmoddifscr = False
    184184
    185     if config['addfiles'] == 'true':
     185    if config['addall'] == 'true':
     186        print warnmsg
     187        print "  " + fname + ": adding new values everywhere !!"
    186188        addfils = True
    187     else:
    188         addfils = False
    189 
    190     if config['addfigures'] == 'true':
    191189        addfigs = True
    192     else:
    193         addfigs = False
    194 
    195     if config['adddiffs'] == 'true':
    196190        adddiffs = True
    197     else:
    198         adddiffs = False
    199 
    200     if config['adddifffigures'] == 'true':
    201191        adddifffigs = True
    202     else:
    203         adddifffigs = False
    204 
    205     if config['addmoddiffs'] == 'true':
    206192        addmoddiffs = True
    207     else:
    208         addmoddiffs = False
    209 
    210     if config['addmoddifffigures'] == 'true':
    211193        addmoddifffigs = True
    212194    else:
    213         addmoddifffigs = False
     195        if config['addfiles'] == 'true':
     196            addfils = True
     197        else:
     198            addfils = False
     199
     200        if config['addfigures'] == 'true':
     201            addfigs = True
     202        else:
     203            addfigs = False
     204
     205        if config['adddiffs'] == 'true':
     206            adddiffs = True
     207        else:
     208            adddiffs = False
     209
     210        if config['adddifffigures'] == 'true':
     211            adddifffigs = True
     212        else:
     213            adddifffigs = False
     214
     215        if config['addmoddiffs'] == 'true':
     216            addmoddiffs = True
     217        else:
     218            addmoddiffs = False
     219
     220        if config['addmoddifffigures'] == 'true':
     221            addmoddifffigs = True
     222        else:
     223            addmoddifffigs = False
    214224
    215225    if config['debug'] == 'true':
     
    15391549            print "  " + fname + ": kind of plot '" + kplot + "' not ready !!"
    15401550            quit(-1)
    1541         elif kplot == 'shadcont2Dsfc':
     1551        elif kplot == '2lines':
    15421552            figtit = tfig.replace('!','|')
    1543             shdstdn = CFvplot[0]
    1544             cntstdn = CFvplot[1]
     1553
     1554            lineAstdn = CFvplot[0]
     1555            lineBstdn = CFvplot[1]
    15451556            figfs = ','.join(fplot)
    15461557
    1547             shad = pplot[0]
    1548             srange = str(shad[0]) + ',' + str(shad[1])
    1549             cbar = shad[2]
    1550             cnt = pplot[1]
    1551             crange = str(cnt[0]) + ',' + str(cnt[1])
    1552             cfmt = cnt[3]
    1553             ckind = cnt[4]
    1554             cline = cnt[5]
    1555 
    1556             graphvals = ','.join(CFvplot)
    1557             graphvals = graphvals + ':lon|-1,lat|-1:lon|-1,lat|-1:lon:lat:' + cbar + \
    1558               ':' + ckind + ',' + cline + ':' + cfmt + ':' + srange + ':' + crange + \
    1559               ',9:' + figtit + ':' + kfig + ':None:' + mapval
    1560 
    1561             fvarS = ','.join(vplot)
    1562 
    1563             drwins = 'draw_2D_shad_cont'
    1564             plotins = "python " + pyH + "/drawing.py -f " + figfs + " -o " + drwins +\
    1565               " -S '" + graphvals + "' -v " + fvarS
    1566             try:
    1567                 with gen.Capturing() as output:
    1568                     sout0 = sub.call(plotins, shell=True)
    1569             except:
    1570                 print errmsg
    1571                 print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
    1572                 print sout0
    1573                 for s1out in output: print s1out
    1574                 quit(-1)
    1575 
    1576             sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True)
    1577 
    1578             # keeping all figures
    1579             trkobjf.write('\n')
    1580             trkobjf.write("#" + tfig.replace('!',' ') + '\n')
    1581             trkobjf.write(plotins + '\n')
    1582 
    1583         elif kplot == 'shadconthovmsfc':
    1584             figtit = tfig.replace('!','|')
    1585             shdstdn = CFvplot[0]
    1586             cntstdn = CFvplot[1]
    1587             figfs = ','.join(fplot)
    1588 
    1589             shad = pplot[0]
    1590             srange = str(shad[0]) + ',' + str(shad[1])
    1591             cbar = shad[2]
    1592             cnt = pplot[1]
    1593             crange = str(cnt[0]) + ',' + str(cnt[1])
    1594             cfmt = cnt[3]
    1595             ckind = cnt[4]
    1596             cline = cnt[5]
     1558            lineA = pplot[0]
     1559            Arange = str(lineA[0]) + ',' + str(lineA[1])
     1560            Akind = lineA[4]
     1561            Aline = lineA[5]
     1562
     1563            lineB = pplot[0]
     1564            Brange = str(lineB[0]) + ',' + str(lineB[1])
     1565            Bkind = lineB[4]
     1566            Bline = lineB[5]
     1567
    15971568            # It is assumed that if the space variable is 'lon': is desired a
    1598             #   (lon, time) plot it it is 'lat': then (time, lat) plot
     1569            #   (lon, vals) plot if it is 'lat': then (vals, lat) plot
    15991570            if gen.searchInlist(dplot,'lon'):
    16001571                spacedim ='lon'
     
    16241595              " -S '" + graphvals + "' -v " + fvarS
    16251596
     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 dimension
     1601        [valuesaxis]: which axis will be used for the values ('x', or 'y')
     1602        [dimtit]: title for the common dimension
     1603        [leglabels]: ',' separated list of names for the legend
     1604        [vartit]: name of the variable in the graph
     1605        [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 figure
     1617        [graphk]: kind of the graphic
     1618      varname= variable to plot
     1619 
     1620
    16261621            try:
    16271622                with gen.Capturing() as output:
    1628                     sout0 = sub.call(plotins, shell=True)
     1623                    sout = sub.call(plotins, shell=True)
    16291624            except:
    16301625                print errmsg
    16311626                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
     1627                print sout
     1628                for s1out in output: print s1out
     1629                quit(-1)
     1630
     1631            sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True)
     1632
     1633            # keeping all figures
     1634            trkobjf.write('\n')
     1635            trkobjf.write("#" + tfig.replace('!',' ') + '\n')
     1636            trkobjf.write(plotins + '\n')
     1637        elif kplot == 'shadcont2Dsfc':
     1638            figtit = tfig.replace('!','|')
     1639            shdstdn = CFvplot[0]
     1640            cntstdn = CFvplot[1]
     1641            figfs = ','.join(fplot)
     1642
     1643            shad = pplot[0]
     1644            srange = str(shad[0]) + ',' + str(shad[1])
     1645            cbar = shad[2]
     1646            cnt = pplot[1]
     1647            crange = str(cnt[0]) + ',' + str(cnt[1])
     1648            cfmt = cnt[3]
     1649            ckind = cnt[4]
     1650            cline = cnt[5]
     1651
     1652            graphvals = ','.join(CFvplot)
     1653            graphvals = graphvals + ':lon|-1,lat|-1:lon|-1,lat|-1:lon:lat:' + cbar + \
     1654              ':' + ckind + ',' + cline + ':' + cfmt + ':' + srange + ':' + crange + \
     1655              ',9:' + figtit + ':' + kfig + ':None:' + mapval
     1656
     1657            fvarS = ','.join(vplot)
     1658
     1659            drwins = 'draw_2D_shad_cont'
     1660            plotins = "python " + pyH + "/drawing.py -f " + figfs + " -o " + drwins +\
     1661              " -S '" + graphvals + "' -v " + fvarS
     1662            try:
     1663                with gen.Capturing() as output:
     1664                    sout = sub.call(plotins, shell=True)
     1665            except:
     1666                print errmsg
     1667                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
     1668                print sout
     1669                for s1out in output: print s1out
     1670                quit(-1)
     1671
     1672            sout = sub.call('mv 2Dfields_shadow-contour.'+kfig+' '+finame, shell=True)
     1673
     1674            # keeping all figures
     1675            trkobjf.write('\n')
     1676            trkobjf.write("#" + tfig.replace('!',' ') + '\n')
     1677            trkobjf.write(plotins + '\n')
     1678
     1679        elif kplot == 'shadconthovmsfc':
     1680            figtit = tfig.replace('!','|')
     1681            shdstdn = CFvplot[0]
     1682            cntstdn = CFvplot[1]
     1683            figfs = ','.join(fplot)
     1684
     1685            shad = pplot[0]
     1686            srange = str(shad[0]) + ',' + str(shad[1])
     1687            cbar = shad[2]
     1688            cnt = pplot[1]
     1689            crange = str(cnt[0]) + ',' + str(cnt[1])
     1690            cfmt = cnt[3]
     1691            ckind = cnt[4]
     1692            cline = cnt[5]
     1693            # It is assumed that if the space variable is 'lon': is desired a
     1694            #   (lon, time) plot if it is 'lat': then (time, lat) plot
     1695            if gen.searchInlist(dplot,'lon'):
     1696                spacedim ='lon'
     1697                figmid = 'longitudinal|evolution|of'
     1698                figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' +       \
     1699                  '|'.join(tfig.split('!')[2:])
     1700                reverse= 'None'
     1701                dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;'+spacedim+';time'
     1702            else:
     1703                spacedim='lat'
     1704                figmid = 'meridional|evolution|of'
     1705                figtit = '|'.join(tfig.split('!')[0:2]) + '|' + figmid + '|' +       \
     1706                  '|'.join(tfig.split('!')[2:])
     1707                reverse='None'
     1708                dims= spacedim+'|-1,time|-1;'+spacedim+'|-1,time|-1;time;'+spacedim
     1709
     1710            graphvals = ','.join(CFvplot)
     1711            graphvals = graphvals + ';'+ dims +';'+ cbar +  \
     1712              ';' + ckind + ',' + cline + ';' + cfmt + ';' + srange + ';' + crange + \
     1713              ',9;' + figtit + ';' + kfig + ';' + reverse + ';' + 'time|' + tunits + \
     1714              '|'+ timekind + '|' + timefmt + '|' + timelabel
     1715
     1716            fvarS = ','.join(vplot)
     1717
     1718            drwins = 'draw_2D_shad_cont_time'
     1719            plotins = 'python ' + pyH + '/drawing.py -f ' + figfs +' -o ' + drwins + \
     1720              " -S '" + graphvals + "' -v " + fvarS
     1721
     1722            try:
     1723                with gen.Capturing() as output:
     1724                    sout = sub.call(plotins, shell=True)
     1725            except:
     1726                print errmsg
     1727                print drwins + '(' + graphvals + ',' + figfs + ',' + fvarS + ')'
     1728                print sout
    16321729                for s1out in output: print s1out
    16331730                quit(-1)
     
    35493646            cdovars = CDOremapvar[cdoop]
    35503647            for cdovar in cdovars:
    3551                 cdofs = gen.files_folder_HMT(folder=cdofdir, head=cdovar, tail='.nc')
     3648                cdofs= gen.files_folder_HMT(folder=cdofdir,head=cdovar+'_',tail='.nc')
    35523649                for cdof in cdofs:
    35533650                    # Getting direct files as [var]_[fhead].nc
Note: See TracChangeset for help on using the changeset viewer.