Changeset 2081 in lmdz_wrf
- Timestamp:
- Aug 11, 2018, 5:33:45 AM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r2080 r2081 65 65 ## e.g. # drawing.py -o draw_multiWindRose -f '/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/sounding_uava_10868.nc@pres|-1;time|1@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_38lev.nc@bottom_top|-1;time|0@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_50lev.nc@bottom_top|-1;time|0@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_50lev_assigned.nc@bottom_top|-1;time|0@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_80lev.nc@bottom_top|-1;time|0@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_120lev.nc@bottom_top|-1;time|0@ua,va#/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/select/out/simout_vars_sndpt_10868_NOaerosol.nc@bottom_top|-1;time|0@ua,va' -S 'linepoint;multicol;pres;-;auto;spectral;auto:obs,38lev,50lev,50leva,80lev,120lev:WindRose!obs!sim!comparison!on!2012/10/23!00!UTC:png:auto:True' 66 66 ## e.g. # drawing.py -o draw_stations_map -f stations.inf -S 'snd|x|#FFAAAA|2|8@sfc|x|#AAFFAA|2|8:cyl,l:1.,20.,35.,49.:FPS!Alps!stations:pdf:true' 67 ## e.g. # drawing.py -o draw_WRFeta_levels -f 120lev/simin_vars.nc,80lev/simin_vars.nc,50lev/simin_vars.nc,50lev_assigned/simin_vars.nc,38lev/simin_vars.nc -f '120lev,80lev,50lev,50leva,38lev:auto:auto:0|10:FPS!Alps!vert!levels:pdf:true' 68 67 69 68 70 ####### … … 10304 10306 values = [labs]:[colors]:[markers]:[legvals]:[imgtit]:[imgkind]:[close] 10305 10307 [labs]= ',' list of labels for the plot (LaTeX like) 10306 [colors]= ',' list of colors for the lines 10307 [markers]= '@' list of markers for the lines 10308 [colors]= ',' list of colors for the lines ('auto' for automatic) 10309 [markers]= '@' list of markers for the lines ('auto' for automatic) 10308 10310 [legvals]=[loclegend]|[fonstsize] values for the legend 10309 10311 [locleg]: location of the legend (0, automatic) … … 10327 10329 10328 10330 labs = values.split(':')[0].split(',') 10329 colors = gen.auto_val_list(values.split(':')[1], ',', colorsauto) 10330 markers = gen.auto_val_list(values.split(':')[2], '@', pointkindsauto) 10331 legvals = values.split(':')[3].split(',') 10331 colors = gen.auto_val_list(values.split(':')[1].split(','), len(labs), \ 10332 drw.colorsauto) 10333 markers = gen.auto_val_list(values.split(':')[2].split('@'), len(labs), \ 10334 drw.pointkindsauto) 10335 legvals = values.split(':')[3] 10332 10336 imgtit = values.split(':')[4].replace('!', ' ') 10333 10337 imgkind = values.split(':')[5] 10334 close = gen. str_Bool(values.split(':')[6])10338 close = gen.Str_Bool(values.split(':')[6]) 10335 10339 10336 10340 files = filenames.split(',') … … 10384 10388 locleg, legfontsize = drw.legend_values(legvals,'|') 10385 10389 10386 plt.plot_WRFeta_levels(allhgtsea, allxhgt, allhgtxhgt, alldhgtsea, alldhgtxhgt, \10390 drw.plot_WRFeta_levels(allhgtsea, allxhgt, allhgtxhgt, alldhgtsea, alldhgtxhgt, \ 10387 10391 alletaw, alletau, labs, colors, markers, [locleg, legfontsize], imgtit, \ 10388 10392 imgkind, close) 10389 10393 10390 10394 return 10395 #foldn='/media/lluis/ExtDiskC_ext3/DATA/estudios/FPS_Alps/additional/IOP/sims/' 10396 #fils=foldn + '120lev/simin_vars.nc,' + foldn + '80lev/simin_vars.nc,' + foldn + \ 10397 # '50lev/simin_vars.nc,' + foldn + '50lev_assigned/simin_vars.nc,' + foldn + \ 10398 # '38lev/simin_vars.nc' 10399 #vals='120lev,80lev,50lev,50leva,38lev:auto:auto:0|8:FPS!Alps!vertical!levels:pdf:true' 10400 #print fils 10401 #draw_WRFeta_levels(fils, vals) 10391 10402 10392 10403 #quit() -
trunk/tools/drawing_tools.py
r2080 r2081 12743 12743 return 12744 12744 12745 def plot_WRFeta_levels(ahgtsea, axhgt, ahgtxhgt, adhgtsea, adhgtxhgt, aetaw, 12746 imgtit,labels, cols, marks, legvs, figtitle, kfig, close):12745 def plot_WRFeta_levels(ahgtsea, axhgt, ahgtxhgt, adhgtsea, adhgtxhgt, aetaw, aetau, \ 12746 labels, cols, marks, legvs, figtitle, kfig, close): 12747 12747 """ Function to plot different sets of WRF eta-levels 12748 12748 ahgtsea: all hegights of a point above sea … … 12761 12761 close: whether figure should be closed 12762 12762 """ 12763 fname = 'plot_draw_WRFeta_levels' 12764 12763 fname = 'plot_WRFeta_levels' 12764 12765 titleloc = (0.5,1.015) 12765 12766 12766 12767 plt.rc('text', usetex=True) 12767 12768 12768 fig = plt.subplots(2)12769 12770 plt.subplot( 1,1,2)12769 fig, ax = plt.subplots(4) 12770 12771 plt.subplot(2,2,1) 12771 12772 # Absolute heights 12772 12773 Nlabs = len(labels) 12773 12774 for ilab in range(Nlabs): 12774 hgts ea = ahgtsea[ilab]12775 hgt xhgt = ahgtxhgt[ilab]12775 hgtssea = ahgtsea[ilab] 12776 hgtsxhgt = ahgtxhgt[ilab] 12776 12777 znw = aetaw[ilab] 12777 12778 … … 12781 12782 plt.plot(znw, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ 12782 12783 markersize=4, label='$hgt_{hgtmax}^{'+labels[ilab]+'}$', \ 12783 color=col ors[ilab])12784 color=cols[ilab]) 12784 12785 else: 12785 12786 plt.plot(znw, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ … … 12790 12791 plt.yscale('log') 12791 12792 12792 titleloc = (0.5,1.075) 12793 12794 plt.title('Absoulte Heights from sea \& highest grid point',position=titleloc) 12795 plt.legend(loc=0, prop={'size':10}) 12796 12797 plt.title(gen.latex_text(figtitle)) 12798 12799 plt.subplot(2,1,2) 12793 plt.title('Absolute Heights',position=titleloc) 12794 plt.legend(loc=legvs[0], prop={'size':legvs[1]}) 12795 12796 plt.subplot(2,2,2) 12797 # Absolute heights & relative 12798 Nlabs = len(labels) 12799 for ilab in range(Nlabs): 12800 hgtssea = ahgtsea[ilab] 12801 hgtsxhgt = ahgtxhgt[ilab] 12802 dhgtssea = adhgtsea[ilab] 12803 dhgtsxhgt = adhgtxhgt[ilab] 12804 dz = len(hgtssea) 12805 12806 plt.plot(hgtssea[1:dz], dhgtssea, '-', marker=marks[ilab], linewidth=1.5, \ 12807 markersize=4, label='$hgt_{sea}^{'+labels[ilab]+'}$', color=cols[ilab]) 12808 # if ilab == 0: 12809 # plt.plot(hgtsxhgt[1:dz], dhgtsxhgt, '-.', marker=marks[ilab], \ 12810 # linewidth=1.5, markersize=4, label='$hgt_{hgtmax}^{'+labels[ilab]+'}$',\ 12811 # color=cols[ilab]) 12812 # else: 12813 # plt.plot(hgtsxhgt[1:dz], dhgtsxhgt, '-.', marker=marks[ilab], \ 12814 # linewidth=1.5, markersize=4, label=None, color=cols[ilab]) 12815 12816 plt.xlabel('aboslute height ($m$)', color='k') 12817 plt.ylabel('$\delta height$ ($m$)', color='black') 12818 plt.xscale('log') 12819 plt.yscale('log') 12820 12821 plt.title('Absolute \& relative heights',position=titleloc) 12822 #plt.legend(loc=0, prop={'size':10}) 12823 12824 plt.subplot(2,2,3) 12800 12825 # Relative heights 12801 12826 Nlabs = len(labels) 12802 12827 for ilab in range(Nlabs): 12803 hgts ea = adhgtsea[ilab]12804 hgt xhgt = adhgtxhgt[ilab]12828 hgtssea = adhgtsea[ilab] 12829 hgtsxhgt = adhgtxhgt[ilab] 12805 12830 znw = aetau[ilab] 12806 12831 … … 12810 12835 plt.plot(znw, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ 12811 12836 markersize=4, label='$\delta hgt_{hgtmax}^{'+labels[ilab]+'}$', \ 12812 color=col ors[ilab])12837 color=cols[ilab]) 12813 12838 else: 12814 12839 plt.plot(znw, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ 12815 12840 markersize=4, label=None, color=cols[ilab]) 12816 12817 12841 plt.xlabel('$\eta$-level', color='k') 12818 12842 plt.ylabel('$\delta height$ ($m$)', color='black') 12819 12843 plt.yscale('log') 12820 12844 12821 titleloc = (0.5,1.075) 12822 12823 plt.title('Relative Heights from sea \& highest grid point',position=titleloc) 12824 plt.legend(loc=0, prop={'size':10}) 12825 12826 plt.title(gen.latex_text(figtitle)) 12827 12828 fig.suptitle(imgtit) 12829 12830 figname = 'stations_map' 12845 plt.title('Relative Heights',position=titleloc) 12846 #plt.legend(loc=0, prop={'size':10}) 12847 12848 plt.subplot(2,2,4) 12849 # Absoulte heights & grid-level 12850 Nlabs = len(labels) 12851 for ilab in range(Nlabs): 12852 hgtssea = ahgtsea[ilab] 12853 hgtsxhgt = ahgtxhgt[ilab] 12854 znw = aetau[ilab] 12855 dz = len(hgtssea) 12856 zi = np.arange(1.,dz+1.)*100./dz 12857 12858 plt.plot(zi, hgtssea, '-', marker=marks[ilab], linewidth=1.5, markersize=0, \ 12859 label='$\delta hgt_{sea}^{'+labels[ilab]+'}$', color=cols[ilab]) 12860 if ilab == 0: 12861 plt.plot(zi, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ 12862 markersize=0, label='$\delta hgt_{hgtmax}^{' + labels[ilab] + '}$', \ 12863 color=cols[ilab]) 12864 else: 12865 plt.plot(zi, hgtsxhgt, '-.', marker=marks[ilab], linewidth=1.5, \ 12866 markersize=0, label=None, color=cols[ilab]) 12867 plt.grid() 12868 plt.xlabel('\% z-grid point', color='k') 12869 plt.ylabel('height ($m$)', color='black') 12870 #plt.xscale('log') 12871 plt.yscale('log') 12872 12873 plt.title('grid point',position=titleloc) 12874 #plt.legend(loc=0, prop={'size':10}) 12875 12876 fig.suptitle(gen.latex_text(figtitle)) 12877 plt.subplots_adjust(wspace=0.3, hspace=0.4) 12878 12879 figname = 'WRFeta_levels' 12831 12880 output_kind(kfig, figname, close) 12832 12881
Note: See TracChangeset
for help on using the changeset viewer.