Ignore:
Timestamp:
Mar 31, 2010 10:36:23 AM (15 years ago)
Author:
heinze
Message:

palmplot expects lists which are separated by blanks. The lists have to be enclosed in single quotes in the prompt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palmplot

    r526 r529  
    99    # 30/03/10 - Rieke - substituting double quotes (") with a character
    1010    #                    variable (dq) containing double quotes
     11    # 31/03/10 - Rieke - list of variable names can be specified using
     12    #                    blank separated lists instead of comma
     13    #                    separated lists
    1114
    1215
     
    1619    (printf "\n   palmplot is designed to run the NCL scripts of PALM \n"
    1720     printf "\n   palmplot can be called as follows:"
    18      printf "\n   palmplot script_identifier file_1=OUTPUT/test.nc file_out=test format_out=pdf var=,pt,u, no_rows=2 ...\n"
     21     printf "\n   palmplot script_identifier file_1=OUTPUT/test.nc file_out=test format_out=pdf var='pt w\"pt\" w*pt* u' no_rows=2 ...\n"
    1922     printf "\n   script_identifier has to be one of the following:"
    2023     printf "\n    xy, xz, yz, pr, ts, sp"
     
    3033 a=""
    3134 arg=""
     35 b=""
    3236 key=""
    3337 script=""
     
    4044 STRINGPARAMS_SP=""
    4145 STRINGPARAMS_TS=""
     46 STRINGPARAMS_VA=""
    4247
    4348
     
    4550 # CO: PARAMETERS WHICH ARE COMMON FOR ALL NCL SCRIPTS
    4651 # CS: cross_sections.ncl PR: profiles.ncl SP: spectra.ncl TS: timeseries.ncl
     52 # VA: PARAMETERS WHICH CONTAIN LISTS OF VARIABLE NAMES
    4753 STRINGPARAMS_CO="file_1 format_out file_out var "
    4854 STRINGPARAMS_CS="sort mode fill_mode unit_x unit_y unit_z vec1 vec2 plotvec"
     
    5056 STRINGPARAMS_SP="sort unit_x unit_y"
    5157 STRINGPARAMS_TS="unit_t"
     58 STRINGPARAMS_VA="var c_var vec1 vec2 plotvec"
    5259
    5360
     
    96103    key=${arg%%=*}
    97104    value=${arg#*=}
    98    
     105
    99106    # ALLOWING RELATIVE AND ABSOLUTE FILE PATHS
    100107    if [[ "$key" ==  @(file_*) && "$value" != @(~/*|/*) ]]
     
    108115      if [ "$key" = "$a" ]
    109116      then
     117
     118         # PROCESSING STRINGS CONTAINING LISTS OF VARIABLES
     119         for b in $STRINGPARAMS_VA
     120         do
     121           if [ "$key" = "$b" ]
     122           then
     123              if [[ "$value" != "all" ]]
     124              then
     125                 # SUBSTITUTING BLANKS WITH COMMAS IN
     126                 # PARAMETERS CONTAINING LISTS OF VARIABLES
     127                 value=`echo $value | sed 's/ /,/g'`           
     128                 if [[ "$value" == ${value#,} ]]
     129                 then
     130                    value=,$value
     131                 fi
     132                 if [[ "$value" == ${value%,} ]]
     133                 then
     134                    value=$value,
     135                 fi
     136                 break
     137              fi
     138           fi
     139         done
     140
    110141         # SUBSTITUTING DOUBLE QUOTES - REQUIRED BY NCL
    111142         value=`echo $value | sed 's/\"/\"+dq+\"/g'`
    112143         # SETTING ENTIRE STRING IN DOUBLE QUOTES - REQUIRED BY NCL
    113144         value=\"$value\"
    114          break
    115145      fi
    116146    done
Note: See TracChangeset for help on using the changeset viewer.