Changeset 2081 in lmdz_wrf


Ignore:
Timestamp:
Aug 11, 2018, 5:33:45 AM (6 years ago)
Author:
lfita
Message:

Final version of `draw_WRFeta_levels'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r2080 r2081  
    6565## 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'
    6666## 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
    6769
    6870#######
     
    1030410306      values = [labs]:[colors]:[markers]:[legvals]:[imgtit]:[imgkind]:[close]
    1030510307        [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)
    1030810310        [legvals]=[loclegend]|[fonstsize] values for the legend
    1030910311          [locleg]: location of the legend (0, automatic)
     
    1032710329
    1032810330    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]
    1033210336    imgtit = values.split(':')[4].replace('!', ' ')
    1033310337    imgkind = values.split(':')[5]
    10334     close = gen.str_Bool(values.split(':')[6])
     10338    close = gen.Str_Bool(values.split(':')[6])
    1033510339   
    1033610340    files = filenames.split(',')
     
    1038410388    locleg, legfontsize = drw.legend_values(legvals,'|')
    1038510389
    10386     plt.plot_WRFeta_levels(allhgtsea, allxhgt, allhgtxhgt, alldhgtsea, alldhgtxhgt,  \
     10390    drw.plot_WRFeta_levels(allhgtsea, allxhgt, allhgtxhgt, alldhgtsea, alldhgtxhgt,  \
    1038710391      alletaw, alletau, labs, colors, markers, [locleg, legfontsize], imgtit,        \
    1038810392      imgkind, close)
    1038910393
    1039010394    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)
    1039110402
    1039210403#quit()
  • trunk/tools/drawing_tools.py

    r2080 r2081  
    1274312743    return
    1274412744
    12745 def plot_WRFeta_levels(ahgtsea, axhgt, ahgtxhgt, adhgtsea, adhgtxhgt, aetaw,    \
    12746      imgtit, labels, cols, marks, legvs, figtitle, kfig, close):
     12745def plot_WRFeta_levels(ahgtsea, axhgt, ahgtxhgt, adhgtsea, adhgtxhgt, aetaw, aetau,  \
     12746     labels, cols, marks, legvs, figtitle, kfig, close):
    1274712747    """ Function to plot different sets of WRF eta-levels
    1274812748      ahgtsea: all hegights of a point above sea
     
    1276112761      close: whether figure should be closed
    1276212762    """
    12763     fname = 'plot_draw_WRFeta_levels'
    12764 
     12763    fname = 'plot_WRFeta_levels'
     12764
     12765    titleloc = (0.5,1.015)
    1276512766
    1276612767    plt.rc('text', usetex=True)
    1276712768
    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)
    1277112772    # Absolute heights
    1277212773    Nlabs = len(labels)
    1277312774    for ilab in range(Nlabs):
    12774         hgtsea = ahgtsea[ilab]
    12775         hgtxhgt = ahgtxhgt[ilab]
     12775        hgtssea = ahgtsea[ilab]
     12776        hgtsxhgt = ahgtxhgt[ilab]
    1277612777        znw = aetaw[ilab]
    1277712778
     
    1278112782            plt.plot(znw, hgtsxhgt,  '-.', marker=marks[ilab], linewidth=1.5,        \
    1278212783              markersize=4, label='$hgt_{hgtmax}^{'+labels[ilab]+'}$',               \
    12783               color=colors[ilab])
     12784              color=cols[ilab])
    1278412785        else:
    1278512786            plt.plot(znw, hgtsxhgt,  '-.', marker=marks[ilab], linewidth=1.5,        \
     
    1279012791    plt.yscale('log')
    1279112792
    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)
    1280012825    # Relative heights
    1280112826    Nlabs = len(labels)
    1280212827    for ilab in range(Nlabs):
    12803         hgtsea = adhgtsea[ilab]
    12804         hgtxhgt = adhgtxhgt[ilab]
     12828        hgtssea = adhgtsea[ilab]
     12829        hgtsxhgt = adhgtxhgt[ilab]
    1280512830        znw = aetau[ilab]
    1280612831
     
    1281012835            plt.plot(znw, hgtsxhgt,  '-.', marker=marks[ilab], linewidth=1.5,        \
    1281112836              markersize=4, label='$\delta hgt_{hgtmax}^{'+labels[ilab]+'}$',        \
    12812               color=colors[ilab])
     12837              color=cols[ilab])
    1281312838        else:
    1281412839            plt.plot(znw, hgtsxhgt,  '-.', marker=marks[ilab], linewidth=1.5,        \
    1281512840              markersize=4, label=None, color=cols[ilab])
    12816 
    1281712841    plt.xlabel('$\eta$-level', color='k')
    1281812842    plt.ylabel('$\delta height$ ($m$)', color='black')
    1281912843    plt.yscale('log')
    1282012844
    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'
    1283112880    output_kind(kfig, figname, close)
    1283212881
Note: See TracChangeset for help on using the changeset viewer.