Changeset 937 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 23, 2016, 8:10:57 PM (8 years ago)
Author:
lfita
Message:

Working verion with the 'shadconthovmsfc'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/model_graphics.bash

    r927 r937  
    218218}
    219219
     220function join_lists() {
     221# Function to join lists without repeating values
     222#   list1: first list to join
     223#   list2: second list to join
     224#  $ join_lists 1:2:3:4:5:6:7:8 a:b:3:c:5:6:7:9
     225#  1:2:3:4:5:6:7:8:a:b:c:9
     226
     227  fname='join_lists'
     228  list1=$1
     229  list2=$2
     230
     231  ls1s=`echo ${list1} | tr ':' ' '`
     232  ls2s=`echo ${list2} | tr ':' ' '`
     233
     234  newlist=${list1}
     235  for ls2 in ${ls2s}; do
     236    if ! $(isInlist ${list1} ${ls2}); then
     237      newlist=${newlist}':'${ls2}
     238    fi
     239  done
     240
     241  echo ${newlist}
     242}
    220243
    221244# Specific
     
    772795#     diffmap2Dsfc: 2D map of surface differences values of 1 variable
    773796#     diffmap2Dz: 2D map of 3D differences values of 1 variable
    774 #     hovmsfc: Hovmoeller diagrams of 1 variable at the surface
     797#     shadconthovmsfc: Hovmoeller diagrams of 2 variable at the surface in shadow and the other in contourn
    775798#     map2Dsfc: 2D map of surface values of 1 variable
    776799#     map3D: 2D map of 3D values of 1 variable
    777 #     shadcount2D: 2D map of shadow (1st variable) and countour (2nd variable) [stvar1]#[stvar2]
     800#     shadcont2Dsfc: 2D map of shadow (1st variable) and countour (2nd variable) [stvar1]#[stvar2]
    778801#
    779802#     ':' separated list of statitsics variable values are given as: [var]|[kind(including combo values)]
     
    783806  fname='draw_plot'
    784807
     808  set -x
     809
    785810  plot=$1
    786811  odir=$2
     
    795820  # Assuming that multiple variables will be separated by '#'
    796821  nvars=`echo ${plotvals} | tr '#' ' ' | wc -w | awk '{print $1}'`
     822
     823  # Model and experiment
     824  mod=`echo ${odir} | tr '/' '\n' | tail -n 2 | head -n 1`
     825  exp=`echo ${odir} | tr '/' '\n' | tail -n 1`
    797826
    798827  figfiles=''
     
    801830  figvarparam=''
    802831  varkinds=''
     832  vardims=''
    803833  if test ${nvars} -ge 1; then
    804834    figname=${kplot}_${headf}
     
    821851      fi
    822852      filen=`stats_filename ${varn} ${kind} ${headf}`
     853      dims=`python ${pyHOME}/nc_var.py -o idims -f ${filen} | grep alldims |         \
     854        awk '{print $3}'`
     855
    823856      if test ${iv} -eq 1; then
    824857        varkinds=${varkind}
     
    826859        varinfilen=${vn}
    827860        figfiles=${filen}
     861        vardims=${dims}
     862        if $(isInlist ${dims} 'time'); then
     863          tunits=`python ${pyHOME}/nc_var.py -o ivattrs -f ${filen} -v time |        \
     864            grep units | grep -v '#' | awk '{print $3}'`
     865        fi
    828866      else
    829867        varkinds=${varkinds}':'${varkind}
     
    831869        varinfilen=${varinfilen}':'${vn}
    832870        figfiles=${figfiles}':'${filen}
     871        vardims=${vardims}':'${dims}
    833872      fi
    834873
     
    891930        exit
    892931      ;;
    893       'hovmsfc')
    894         echo "  "${fname}": kind of plot '"${kplot}"' not ready !!"
    895         exit
    896       ;;
    897932      'map2Dsfc')
    898933        echo "  "${fname}": kind of plot '"${kplot}"' not ready !!"
     
    903938        exit
    904939      ;;
    905       'shadcount2Dsfc')
    906         figtit=`echo ${varkinds} | tr ':' '|'`
     940      'shadcont2Dsfc')
     941        figtit=${mod}'|'${exp}'|'$(echo ${varkinds} | tr ':' '|')
    907942        shdstdn=`echo ${CFvars} | tr ':' ' ' | awk '{print $1}'`
    908943        cntstdn=`echo ${CFvars} | tr ':' ' ' | awk '{print $2}'`
     
    924959        graphvals=${graphvals}${figtit}':'${kindfig}':False:'${mapval}
    925960 
    926         plotins="python "${pyHOME}"/drawing.py -f "${figfs}" -o draw_2D_shad_cont "
    927         plotins=${plotins}"-S '"${graphvals}"' -v "$(echo ${varinfileb} | tr ':' ',')
    928         echo " " >> ${odir}/all_figures.inf
    929         echo "#"$(echo $f{igtit} | tr '|' ' ') >> ${odir}/all_figures.inf
    930         echo ${plotins} >> ${odir}/all_figures.inf
    931961        pyout=`python ${pyHOME}/drawing.py -f ${figfs} -o draw_2D_shad_cont          \
    932962          -S ${graphvals} -v $(echo ${varinfilen} | tr ':' ',')`
     
    935965        ferrmsg ${pyn} ${fname} "python!'draw_2D_shad_cont'!failed#"${Spyout}
    936966        mv 2Dfields_shadow-contour.${kindfig} ${figname}
     967
     968        # keeping all figures
     969        plotins="python "${pyHOME}"/drawing.py -f "${figfs}" -o draw_2D_shad_cont "
     970        plotins=${plotins}"-S '"${graphvals}"' -v "$(echo ${varinfileb} | tr ':' ',')
     971        echo " " >> ${odir}/all_figures.inf
     972        echo "#"$(echo $f{igtit} | tr '|' ' ') >> ${odir}/all_figures.inf
     973        echo ${plotins} >> ${odir}/all_figures.inf
     974
     975#        exit
     976      ;;
     977      'shadconthovmsfc')
     978        shdstdn=`echo ${CFvars} | tr ':' ' ' | awk '{print $1}'`
     979        cntstdn=`echo ${CFvars} | tr ':' ' ' | awk '{print $2}'`
     980
     981        # It is assumed that if the space variable is 'lon': is desired a (lon, time) plot
     982        #   it it is 'lat': then (time, lat) plot
     983        dimspace='xxx'
     984        if $( isInlist ${vardims} 'lon'); then
     985          spacedim='lon'
     986          figtit=${mod}'|'${exp}'|mean|longitudinal|evolution|of|'${shdstdn}'|&|'
     987          figtit=${figtit}${cntstdn}
     988          reverse='None'
     989          dims=${spacedim}'|-1,time|-1;'${spacedim}'|-1,time|-1;'${spacedim}';time'
     990        else
     991          spacedim='lat'
     992          figtit=${mod}'|'${exp}'|mean|meridional|evolution|of|'${shdstdn}'|&|'
     993          figtit=${figtit}${cntstdn}
     994          reverse='None'
     995          dims=${spacedim}'|-1,time|-1;'${spacedim}'|-1,time|-1;time;'${spacedim}
     996        fi
     997
     998        figfs=`echo ${figfiles} | tr ':' ','`
     999        srange=`echo ${figvarparam} | tr ':' ' ' | awk '{print $1}' | tr '|' ' ' |   \
     1000          awk '{print $1","$2}'`
     1001        cbar=`echo ${figvarparam} | tr ':' ' ' | awk '{print $1}' | tr '|' ' ' |     \
     1002          awk '{print $3}'`
     1003        crange=`echo ${figvarparam} | tr ':' ' ' | awk '{print $2}' | tr '|' ' ' |   \
     1004          awk '{print $1","$2}'`
     1005        cline=`echo ${figvarparam} | tr ':' ' ' | awk '{print $2}' | tr '|' ' ' |    \
     1006          awk '{print $5}'`
     1007        cfmt=`echo ${figvarparam} | tr ':' ' ' | awk '{print $2}' | tr '|' ' ' |     \
     1008          awk '{print $4}'`
     1009
     1010#        if test ${spacedim} = 'lon'; then
     1011#          dims='lon|-1,time|-1:lon|-1,time|-1:time:lon'
     1012#        else
     1013#          dims='lat|-1,time|-1:lat|-1,time|-1:time:lat'
     1014#        fi
     1015
     1016        graphvals=$(echo ${CFvars} | tr ':' ',')
     1017        graphvals=${shdstdn}','${cntstdn}';'${dims}';'
     1018        graphvals=${graphvals}${cbar}';fixsigc,'${cline}';'${cfmt}';'${srange}';'
     1019        graphvals=${graphvals}${crange}',9;'${figtit}';'${kindfig}';'${reverse}';'
     1020        graphvals=${graphvals}'time|'${tunits}'|'${timekind}'|'${timefmt}'|'
     1021        graphvals=${graphvals}${timelabel}
     1022
     1023        python ${pyHOME}/drawing.py -f ${figfs} -o draw_2D_shad_cont_time            \
     1024         -S ${graphvals} -v $(echo ${varinfilen} | tr ':' ',')
     1025        mv 2Dfields_shadow-contour.${kindfig} ${figname}
     1026
     1027        # keeping all figures
     1028        plotins="python "${pyHOME}"/drawing.py -f "${figfs}" -o draw_2D_shad_cont_time"
     1029        plotins=${plotins}" -S ${graphvals} -v "$(echo ${varinfilen} | tr ':' ',')
     1030        echo " " >> ${odir}/all_figures.inf
     1031        echo "#"$(echo $f{igtit} | tr '|' ' ') >> ${odir}/all_figures.inf
     1032        echo ${plotins} >> ${odir}/all_figures.inf
     1033
    9371034#        exit
    9381035      ;;
     
    9871084fi
    9881085
     1086if test ${addfiles} = 'true'; then
     1087  addfiles=true
     1088else
     1089  addfiles=false
     1090fi
     1091
     1092if test ${addfigures} = 'true'; then
     1093  addfigures=true
     1094else
     1095  addfigures=false
     1096fi
     1097
    9891098if test ${debug} = 'true'; then
    9901099  dbg=true
     
    10751184      echo "## Computation of variables " > ${owdir}/all_computevars.inf
    10761185      echo "## Computation of statistics " > ${owdir}/all_statsvars.inf
    1077 
    10781186    fi
    10791187
     
    13201428        if $(isInlist ${directplots} ${drw}); then
    13211429          case ${drw} in
    1322             'hovmsfc')
    1323               plts=${plothovmsfc}
    1324             ;;
    13251430            'map2Dsfc')
    13261431              plts=${pltmap2Dsfc}
     
    13291434              plts=${pltmap3D}
    13301435            ;;
    1331             'shadcount2Dsfc')
    1332               plts=${pltshadcount2Dsfc}
     1436            'shadcont2Dsfc')
     1437              plts=${pltshadcont2Dsfc}
     1438            ;;
     1439            'shadconthovmsfc')
     1440              plts=${pltshadconthovmsfc}
    13331441            ;;
    13341442            *)
     
    13531461      done
    13541462      cat << EOF > directplotsdraw.inf
     1463Nkinds= ${ikp}
    13551464plots= ${plots}
    13561465EOF
     
    13581467      echo ${warnmsg}
    13591468      echo "  "${main}": retrieving direct plots from existing file 'directplotsdraw.inf' !!"
     1469      Nkinds=`cat directplotsdraw.inf | grep Nkinds | awk '{print $2}'`
    13601470      plots=`cat directplotsdraw.inf | grep plots | awk '{print $2}'`
    13611471    fi
  • trunk/tools/model_graphics_template.dat

    r927 r937  
    1818HOMEpy = ${HOME}/etudes/WRF_LMDZ/svn/LMDZ_WRF/tools
    1919
    20 # Srcatch
    21 scratch=false
     20# Srcatch: should be any previous work removed and start from the scratch?
     21scratch = false
    2222
    23 # Scratch files
    24 filescratch=false
     23# Scratch files: should be any files previous work removed and start from the scratch?
     24filescratch = false
    2525
    26 # Scratch figures
    27 figscratch=false
     26# Scratch figures: should be any figures previous work removed and start from the scratch?
     27figscratch = false
     28
     29# Have new files been added and do they need to be processed?
     30addfiles = false
     31
     32# Have new figures been added and do they need to be drawn?
     33addfiles = false
    2834
    2935# Debug
     
    7783varlast = tas:uas:vas:ps:pr:pracc:rsds:prw:evspsbl:hfss:hfls:hurs:huss:zmla:hufs:wakes:lwakeh:stherm:zmaxth:clt:cll:clm:clh:prc:prls:bils:wss
    7884vartmean = tas:uas:vas:ps:pr:pracc:rsds:prw:evspsbl:hfss:hfls:hurs:huss:zmla:hufs:wakes:lwakeh:stherm:zmaxth:clt:cll:clm:clh:prc:prls:bils:wss
    79 varxmean = ta:ua:va:hur
     85varxmean = ta:ua:va:hur:hurs:tas:wss:ps
    8086vardiff = ualmean:valmean:talmean:huslmean:uas:vas:ps:pr
    8187varpinterp = ta:ua:va:hur
     
    8389
    8490# Operations which attach 'mean' at the end of the variable name
    85 varmeanname='Lmean:lmean:tmaen:xmean:ymean'
     91varmeanname='Lmean:lmean:tmean:xmean:ymean'
    8692
    8793# Pressure levels
     
    9298#   diffmap2Dsfc: 2D map of surface differences values of 1 variable
    9399#   diffmap2Dz: 2D map of 3D differences values of 1 variable
    94 #   hovmsfc: Hovmoeller diagrams of 1 variable at the surface
     100#   shadconthovmsfc: Hovmoeller diagrams of 2 variables at the surface in shadow and the other in contourn
    95101#   map2Dsfc: 2D map of surface values of 1 variable
    96102#   map3D: 2D map of 3D values of 1 variable
    97 #   shadcount2D: 2D map of shadow (1st variable) and countour (2nd variable) [stvar1]#[stvar2]
     103#   shadcont2Dsfc: 2D map of shadow (1st variable) and countour (2nd variable) [stvar1]#[stvar2]
    98104#
    99105#   ':' separated list of statitsics variable values are given as: [var]|[kind(including combo values)]
    100106#     in figures with more than 1 variable, use '#' to separate them
    101 drawplots = shadcount2Dsfc
     107drawplots = shadcont2Dsfc:shadconthovmsfc
    102108
    103109# Figures which can be made directly without another model/experiment output
    104 directplots = hovmsfc:map2Dsfc:map3D:shadcount2Dsfc
     110directplots = shadconthovmsfc:map2Dsfc:map3D:shadcont2Dsfc
    105111
    106 pltshadcount2Dsfc = huss|tmean#tas|tmean:vas|tmean#uas|tmean:ps|tmean#wss|tmean:pr|tmean#rsds|tmean:prw|tmean#clt|tmean:hfls|tmean#hfss|tmean:evspsbl|tmean#bils|tmean:zmaxth|tmean#stherm|tmean:wakeh|tmean#wakes|tmean:zmaxth|tmean#stherm|tmean:prls|tmean#prc|tmean:clt|tmean#cll|tmean:clm|tmean#clh|tmean:hurs|tmean#zmla|tmean:huss|last#tas|last:vas|last#uas|last:ps|last#wss|tmean:pr|last#rsds|last:prw|last#clt|last:hfls|last#hfss|last:evspsbl|last#bils|last:zmaxth|last#stherm|last:wakeh|last#wakes|last:zmaxth|last#stherm|last:prls|last#prc|last:clt|last#cll|last:clm|last#clh|last:hurs|last#zmla|last
     112pltshadcont2Dsfc = huss|tmean#tas|tmean:vas|tmean#uas|tmean:ps|tmean#wss|tmean:pr|tmean#rsds|tmean:prw|tmean#clt|tmean:hfls|tmean#hfss|tmean:evspsbl|tmean#bils|tmean:zmaxth|tmean#stherm|tmean:wakeh|tmean#wakes|tmean:zmaxth|tmean#stherm|tmean:prls|tmean#prc|tmean:clt|tmean#cll|tmean:clm|tmean#clh|tmean:hurs|tmean#zmla|tmean:huss|last#tas|last:vas|last#uas|last:ps|last#wss|tmean:pr|last#rsds|last:prw|last#clt|last:hfls|last#hfss|last:evspsbl|last#bils|last:zmaxth|last#stherm|last:wakeh|last#wakes|last:zmaxth|last#stherm|last:prls|last#prc|last:clt|last#cll|last:clm|last#clh|last:hurs|last#zmla|last
     113pltshadconthovmsfc = hurs|xmean#tas|xmean:wss|xmean#ps|xmean
    107114
    108115pltdiffmap2Dsfc = uas:vas:ps:pr
     
    128135mapval = lcc,l
    129136
     137# Time parameters
     138#  [timekind]; kind of output for the time ticks
     139#     'Nval': according to a given number of values as 'Nval',[Nval]
     140#     'exct': according to an exact number [Nunits] of time unit as 'exct',[tunit];
     141#       tunit= [Nunits],[tu]
     142#         [tu]= 'c': centuries, 'y': year, 'm': month, 'w': week, 'd': day, 'h': hour, 'i': minute, 's': second, 'l': milisecond
     143#  [timefmt]; desired format for the time ticks (combination of LaTeX and 'linux date formats')
     144#  [timelabel]; label at the graph ('!' for spaces)
     145
     146timekind = exct,6,h
     147timefmt = $%d^{%H}$
     148timelabel = date!($[DD]^{[HH]}$)
     149
    130150# Generic
    131151errmsg = ERROR--error--ERROR--error
Note: See TracChangeset for help on using the changeset viewer.