Changeset 808 for trunk/UTIL


Ignore:
Timestamp:
Oct 16, 2012, 12:57:35 PM (12 years ago)
Author:
slebonnois
Message:

SL: Many changes for VENUS (related to newstart) and TITAN (related to clouds). Please read DOC/chantiers/commit_importants.log (cf v808).

Location:
trunk/UTIL/NCL
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/NCL/help.txt

    r500 r808  
    4646
    4747  Default: liste => list the variables in file
     48
     49  If varname = customvar then a user-defined variable can be plotted
     50  with -v customvar,labelvar
     51  This labelvar must be defined in the customVar routine in visu-utils.ncl
    4852
    4953[-v2 varname]                    : Variable name to be overplotted
  • trunk/UTIL/NCL/planeto.ncl

    r500 r808  
    2828    tname=liste(i)
    2929  end if
    30   if ((liste(i).eq."lev").or.(liste(i).eq."presnivs")) then
     30  if ((liste(i).eq."lev").or.(liste(i).eq."presnivs").or.(liste(i).eq."levgrnd")) then
    3131    pname=liste(i)
    3232  end if
     
    8686;---- load variable(s)
    8787;---------------------
    88   variable=infile->$var$
    89   nbdim=dimsizes(filevardimsizes(infile,var))
    90 
     88
     89  if (var.ne."custom") then
     90    variable=infile->$var$
     91    nbdim=dimsizes(filevardimsizes(infile,var))
     92  else
     93    variable=customVar(infile,labelvar)
     94    nbdim=dimsizes(dimsizes(variable))
     95  end if
     96 
    9197  overplot=False
    9298  diffdims=False
  • trunk/UTIL/NCL/visu-ncl

    r500 r808  
    11#!/bin/bash
    22
    3 # Directory where the NCL files are located ** EDIT **
     3# Directory where the NCL files are located  ** EDIT **
    44
    55export NCLDIR=~/LMDZ5/UTIL/NCL
     
    1111inFile="nofile"
    1212var="liste"
     13labelvar="dummy"
    1314var2="dummy"
    1415media="x11"
     
    5657          inFile=$2 ; shift ; shift ;;
    5758      "-v")
    58           var=$2 ; shift ; shift ;;
     59          var=${2%%,*}
     60          tmp=${2#*,}
     61          labelvar=${tmp%%,*}
     62          if [ $labelvar != $var ]; then
     63            labelvar=${tmp#*,}
     64          fi
     65          shift ; shift ;;
    5966      "-v2")
    6067          var2=$2 ; shift ; shift ;;
     
    190197ncl inFile=\"$inFile\"  \
    191198    var=\"$var\" \
     199    labelvar=\"$labelvar\" \
    192200    var2=\"$var2\" \
    193201    media=\"$media\" \
     
    220228    planeto.ncl
    221229
    222 if [ -f *pdf ]; then
     230if [ -f *pdf ]; then 
    223231   mv *pdf $SIMUDIR
    224232fi
    225233
    226 if [ -f *ps ]; then
     234if [ -f *ps ]; then 
    227235   mv *ps $SIMUDIR
    228236fi
  • trunk/UTIL/NCL/visu-utils.ncl

    r497 r808  
    5656  if (nbdim.eq.4) then
    5757       vartrim=var({$dimname(0)$|mindimval(0):maxdimval(0)},{$dimname(1)$|mindimval(1):maxdimval(1)},{$dimname(2)$|mindimval(2):maxdimval(2)},{$dimname(3)$|mindimval(3):maxdimval(3)})
     58;       vartrim=var($dimname(0)$|0:0,{$dimname(1)$|mindimval(1):maxdimval(1)},{$dimname(2)$|mindimval(2):maxdimval(2)},{$dimname(3)$|mindimval(3):maxdimval(3)})
    5859  end if
    5960
     
    628629end
    629630
     631;;;;;;;;;;;; customVar ;;;;;;;;;;;;;;;;
     632
     633undef("customVar")
     634function customVar(infile,labelvar)
     635;============================
     636
     637; infile   : input file
     638; labelvar : input label for variable
     639
     640; THIS IS TO BE CUSTOMIZED EACH TIME ACCORDING TO YOUR NEEDS
     641; because it is impossible to make it automatic...
     642
     643begin
     644
     645prepared = "dummy"    ; DEFAULT
     646
     647if (labelvar.eq."dTdyn") then
     648  if (isfilevar(infile,"vitu")) then
     649    dtdyn = infile->dtdyn
     650  else
     651    dtdyn = infile->DTCORE
     652  end if
     653  myvar = dtdyn*1e7
     654  copy_VarMeta(dtdyn,myvar)
     655  myvar@units    ="K/Vd"
     656  myvar@long_name="Dynamics heating rate"
     657  prepared = labelvar
     658end if
     659
     660if (labelvar.eq."dTadj") then
     661  if (isfilevar(infile,"vitu")) then
     662    dtadj = infile->dtajs
     663  else
     664    dtadj = infile->DADJ
     665  end if
     666  myvar = dtadj*1e7
     667  copy_VarMeta(dtadj,myvar)
     668  myvar@units    ="K/Vd"
     669  myvar@long_name="Dry convection heating rate"
     670  prepared = labelvar
     671end if
     672
     673if (labelvar.eq."dTvdf") then
     674  if (isfilevar(infile,"vitu")) then
     675    dtvdf = infile->dtvdf
     676  else
     677    dtvdf = infile->DTV
     678  end if
     679  myvar = dtvdf*1e7
     680  copy_VarMeta(dtvdf,myvar)
     681  myvar@units    ="K/Vd"
     682  myvar@long_name="PBL heating rate"
     683  prepared = labelvar
     684end if
     685
     686if (labelvar.eq."dTrad") then
     687  if (isfilevar(infile,"vitu")) then
     688    dtlwr = infile->dtlwr
     689    dtswr = infile->dtswr
     690  else
     691    dtlwr = infile->QRL
     692    dtswr = infile->QRS
     693  end if
     694  myvar = (dtlwr+dtswr)*1e7
     695  copy_VarMeta(dtlwr,myvar)
     696  myvar@units    ="K/Vd"
     697  myvar@long_name="Radiative balance"
     698  prepared = labelvar
     699end if
     700
     701if (labelvar.eq."Tbal") then
     702  if (isfilevar(infile,"vitu")) then
     703    dtlwr = infile->dtlwr
     704    dtswr = infile->dtswr
     705    dtajs = infile->dtajs
     706    dtdyn = infile->dtdyn
     707    dtvdf = infile->dtvdf
     708  else
     709    dtlwr = infile->QRL
     710    dtswr = infile->QRS
     711    dtajs = infile->DADJ
     712    dtdyn = infile->DTCORE
     713    dtvdf = infile->DTV
     714  end if
     715  myvar = (dtlwr+dtswr+dtajs+dtdyn+dtvdf)*1e7
     716  copy_VarMeta(dtlwr,myvar)
     717  myvar@units    ="K/Vd"
     718  myvar@long_name="Thermal balance"
     719  prepared = labelvar
     720end if
     721
     722if (labelvar.eq."Tforc") then
     723  if (isfilevar(infile,"vitu")) then
     724    dtlwr = infile->dtlwr
     725    dtswr = infile->dtswr
     726    dtajs = infile->dtajs
     727    if (isfilevar(infile,"dtvdf")) then
     728          dtvdf = infile->dtvdf
     729    else
     730          dtvdf = dtajs*0.
     731    end if
     732  else
     733    dtlwr = infile->QRL
     734    dtswr = infile->QRS
     735    dtajs = infile->DADJ
     736    if (isfilevar(infile,"DTV")) then
     737          dtvdf = infile->DTV
     738    else
     739          dtvdf = dtajs*0.
     740    end if
     741  end if
     742  myvar = (dtlwr+dtswr+dtajs+dtvdf)*1e7
     743  copy_VarMeta(dtlwr,myvar)
     744  myvar@units    ="K/Vd"
     745  myvar@long_name="Thermal physical forcing"
     746  prepared = labelvar
     747end if
     748
     749if (labelvar.eq."ske") then
     750  if (isfilevar(infile,"vitu")) then
     751    u = infile->vitu
     752    v = infile->vitv
     753  else
     754    u = infile->U
     755    v = infile->V
     756  end if
     757  myvar = u*u+v*v
     758  copy_VarMeta(u,myvar)
     759  myvar@units    ="m2/s2"
     760  myvar@long_name="Specific kinetic energy"
     761  prepared = labelvar
     762end if
     763
     764if (prepared.eq."dummy") then   ; DEFAULT: LEAVE AS IS
     765  print("You chose a customized variable !")
     766  print("Modify the function customVar in visu-utils.ncl to prepare this variable")
     767  exit
     768end if
     769
     770  return(myvar)
     771
     772end
     773
Note: See TracChangeset for help on using the changeset viewer.