Changeset 934 in lmdz_wrf for trunk/tools/drawing.py
- Timestamp:
- Jun 23, 2016, 7:42:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r833 r934 623 623 draw_2D_shad_cont(ncfile, values, varn) 624 624 ncfile= [ncfilevars],[ncfilevarc] files to use (one value, same file) 625 values=[vnamefs] :[dimvals]:[dimvalc]:[dimxvn]:[dimyvn]:[colorbar]:[ckind]:[clabfmt]:[sminv],[smaxv]:[sminc],[smaxv],[Nlev]:[figt]:[kindfig]:[reverse]:[timevals]:[mapv]625 values=[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[colorbar];[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];[figt];[kindfig];[reverse];[timevals] 626 626 [vnamefs],[vnamefc]: Name in the figure of the shaded and the contour variables 627 627 [dimvals/c]: list of [dimname]|[value] telling at which dimension of the … … 653 653 [tfmt]; desired format 654 654 [label]; label at the graph ('!' for spaces) 655 [mapv]: map characteristics: [proj],[res] 656 see full documentation: http://matplotlib.org/basemap/ 657 [proj]: projection 658 * 'cyl', cilindric 659 * 'lcc', lamvbert conformal 660 [res]: resolution: 661 * 'c', crude 662 * 'l', low 663 * 'i', intermediate 664 * 'h', high 665 * 'f', full 666 valules= 'rh,ta:z|-1,x|-1:z|-1,x|-1:lat:pressure:BuPu:fixsigc,black:%d:0.,100.:195.,305.,7:Meridonal|average|of|rh|&|ta:pdf:flip@y:time!hours!since!1949/12/01|exct,5d|%d|date!([DD]):None' 655 valules= 'rh,ta;z|-1,x|-1;z|-1,x|-1;lat;pressure;BuPu;fixsigc,black;%d;0.,100.;195.,305.,7;Meridonal|average|of|rh|&|ta;pdf;flip@y;time!hours!since!1949/12/01|exct,5d|%d|date!([DD])' 667 656 varn= [varsn],[varcn] name of the variable to plot with shading variable with contour 668 657 """ … … 674 663 quit() 675 664 676 expectargs = '[vnamefs] :[dimvals]:[dimvalc]:[dimxvn]:[dimyvn]:[colorbar]:' + \677 '[ckind] :[clabfmt]:[sminv],[smaxv]:[sminc],[smaxv],[Nlev]:[figt]:[kindfig]:' + \678 '[reverse] :[timevals]:[mapv]'665 expectargs = '[vnamefs];[dimvals];[dimvalc];[dimxvn];[dimyvn];[colorbar];' + \ 666 '[ckind];[clabfmt];[sminv],[smaxv];[sminc],[smaxv],[Nlev];[figt];[kindfig];' + \ 667 '[reverse];[timevals]' 679 668 680 drw.check_arguments(fname,values,expectargs,':') 681 682 vnamesfig = values.split(':')[0].split(',') 683 dimvals= values.split(':')[1].replace('|',':') 684 dimvalc= values.split(':')[2].replace('|',':') 685 vdimxn = values.split(':')[3] 686 vdimyn = values.split(':')[4] 687 colbarn = values.split(':')[5] 688 countkind = values.split(':')[6] 689 countlabelfmt = values.split(':')[7] 690 shadminmax = values.split(':')[8] 691 contlevels = values.split(':')[9] 692 figtitle = values.split(':')[10].replace('|',' ') 693 figkind = values.split(':')[11] 694 revals = values.split(':')[12] 695 timevals = values.split(':')[13] 696 mapvalue = values.split(':')[14] 669 drw.check_arguments(fname,values,expectargs,';') 670 671 vnamesfig = values.split(';')[0].split(',') 672 dimvals= values.split(';')[1].replace('|',':') 673 dimvalc= values.split(';')[2].replace('|',':') 674 vdimxn = values.split(';')[3] 675 vdimyn = values.split(';')[4] 676 colbarn = values.split(';')[5] 677 countkind = values.split(';')[6] 678 countlabelfmt = values.split(';')[7] 679 shadminmax = values.split(';')[8] 680 contlevels = values.split(';')[9] 681 figtitle = values.split(';')[10].replace('|',' ') 682 figkind = values.split(';')[11] 683 revals = values.split(';')[12] 684 timevals = values.split(';')[13] 697 685 698 686 if2filenames = ncfile.find(',') … … 755 743 valcont, dimscont = drw.slice_variable(objvarc, dimvalc.replace(',','|')) 756 744 757 # Dimensions names758 ## print fname + ' obj dimnames: ', objvars.dimensions, dimvals, len(dimvals.split(','))759 ## dimnamesv = []760 ## for idd in range(len(objvars.dimensions)):761 ## cutdim = False762 ## for idc in range(len(dimvals.split(','))):763 ## dimcutn = dimvals.split(',')[idc].split(':')[0]764 ## print objvars.dimensions[idd], dimcutn765 ## if objvars.dimensions[idd] == dimcutn:766 ## cutdim = True767 ## break768 ## if not cutdim: dimnamesv.append(objvars.dimensions[idd])769 745 dimnamesv = [vdimyn, vdimxn] 770 746 … … 813 789 814 790 cutslice = [] 815 for idimn in dim sshad:791 for idimn in dimnvx: 816 792 found = False 817 for dimsn in dim nvx:793 for dimsn in dimsshad: 818 794 if idimn == dimsn: 819 795 cutslice.append(slice(0,len(objsf.dimensions[idimn]))) 820 796 found = True 821 if not found: cutslice.append( 0)797 if not found: cutslice.append(slice(0,len(objsf.dimensions[idimn]))) 822 798 823 799 ovalaxisv = ovalaxis[tuple(cutslice)] 824 825 ## if len(ovalaxis.shape) <= 2:826 ## ovalaxisv = ovalaxis[:]827 828 ## elif len(ovalaxis.shape) == 3:829 ## ovalaxisv = ovalaxis[0,:]830 ## else:831 ## print errormsg832 ## print ' ' + fname + ': shape of dimension variable:', ovalaxis.shape, \833 ## ' not ready!!'834 ## quit(-1)835 800 836 801 if countlabelfmt == 'None': … … 857 822 print ' generating default ones: ',levels_cont 858 823 859 if mapvalue == 'None': mapvalue= None824 if revals == 'None': revals = None 860 825 861 826 drw.plot_2D_shadow_contour_time(valshad, valcont, vnamesfig, ovalaxisv, \ 862 827 timevals, timepos, timelabels, ovalu, timelabel, dimt, dimnamesv, colbarn, \ 863 828 countkind, countlfmt, shading_nx, levels_cont, varunits, figtitle, figkind, \ 864 revals , mapvalue)829 revals) 865 830 866 831 return
Note: See TracChangeset
for help on using the changeset viewer.