Ignore:
Timestamp:
03/16/14 20:38:39 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/detectbarotropicmode.sh

    r47 r48  
    1616# ======== 
    1717# 
    18 # .. code-blcok:: bash 
     18# .. code-block:: bash 
    1919# 
    2020#    detectbarotropicmode.sh -l list -r resolution -exp experience -g grid \ 
     
    3131# in the box [-50,30] [295,335]: 
    3232# 
    33 # .. code-block :: bash 
     33# .. code-block:: bash 
    3434# 
    3535#    detectbarotropicmode.sh -l ${GEOMAG_OD}/list_G42 -r ORCA025 -exp G42 -g gridT \ 
     
    6060command=detectbarotropicmode.sh 
    6161# 
    62 usage=" Usage : ${command} -l list -r orcares -exp drakkar_exp -g grid -latmin latmin -latmax latmax -longmin longmin -longmax longmax" 
    63 # 
    64 set +u 
    65 while [ ! -z "${1}" ] 
     62usage="Usage : ${command} -l list -r orcares -exp drakkar_exp -g grid -latmin latmin -latmax latmax -longmin longmin -longmax longmax" 
     63# 
     64set -u 
     65while [ ${#} -gt 0 ] 
    6666do 
    67    case ${1} in 
    68       -l) 
    69          list=${2} 
    70          shift 
    71       ;; 
    72       -r) 
    73          orcares=${2} 
    74          shift 
    75       ;; 
    76       -exp) 
    77          drakkar_exp=${2} 
    78          shift 
    79       ;; 
    80       -g) 
    81          grid=${2} 
    82          shift 
    83       ;; 
    84       -latmin) 
    85          latmin=${2} 
    86          shift 
    87       ;; 
    88       -latmax) 
    89          latmax=${2} 
    90          shift 
    91       ;; 
    92       -longmin) 
    93          longmin=${2} 
    94          shift 
    95       ;; 
    96       -longmax) 
    97          longmax=${2} 
    98          shift 
    99       ;; 
    100       *) 
    101          # other choice 
    102          echo "eee : unknown option ${1}" 
    103          echo "${usage}" 
    104       ;; 
    105    esac 
    106    # next flag 
    107    shift 
     67    case ${1} in 
     68        -l) 
     69            list=${2} 
     70            shift 
     71        ;; 
     72        -r) 
     73            orcares=${2} 
     74            shift 
     75        ;; 
     76        -exp) 
     77            drakkar_exp=${2} 
     78            shift 
     79        ;; 
     80        -g) 
     81            grid=${2} 
     82            shift 
     83        ;; 
     84        -latmin) 
     85            latmin=${2} 
     86            shift 
     87        ;; 
     88        -latmax) 
     89            latmax=${2} 
     90            shift 
     91        ;; 
     92        -longmin) 
     93            longmin=${2} 
     94            shift 
     95        ;; 
     96        -longmax) 
     97            longmax=${2} 
     98            shift 
     99        ;; 
     100        *) 
     101            # other choice 
     102            echo "eee : unknown option ${1}" 
     103            echo "${usage}" 
     104        ;; 
     105    esac 
     106    # next flag 
     107    shift 
    108108done 
    109 # 
    110 set -u 
    111109# 
    112110# check GEOMAG environement 
    113111if [ ! -d ${GEOMAG_LOG} ] 
    114112then 
    115    echo " eee : \${GEOMAG_LOG} not found" 
    116    exit 1 
     113    echo " eee : \${GEOMAG_LOG} not found" 
     114    exit 1 
    117115fi 
    118116# ++ blindage en tout genre 
    119117# 
    120118case ${grid} in 
    121    gridT) 
    122       echo "iii : grid=${orcares}" 
    123    ;; 
    124    *) 
    125       echo "eee : pb \${grid} = ${grid}" 
    126       exit 1 
    127    ;; 
     119    gridT) 
     120        echo "iii : grid=${orcares}" 
     121    ;; 
     122    *) 
     123        echo "eee : pb \${grid} = ${grid}" 
     124        exit 1 
     125    ;; 
    128126esac 
    129127# 
    130128case ${orcares} in 
    131    ORCA025) 
    132       echo "iii : orcares=${orcares}" 
    133    ;; 
    134    *) 
    135       echo "eee : pb \${orcares} = ${orcares}" 
    136       exit 1 
    137    ;; 
     129    ORCA025) 
     130        echo "iii : orcares=${orcares}" 
     131    ;; 
     132    *) 
     133        echo "eee : pb \${orcares} = ${orcares}" 
     134        exit 1 
     135    ;; 
    138136esac 
    139137# 
    140138case ${drakkar_exp} in 
    141    G42) 
    142       echo "iii : drakkar_exp=${drakkar_exp}" 
    143    ;; 
    144    *) 
    145       echo "eee : pb \${drakkar_exp} = ${drakkar_exp}" 
    146       exit 1 
    147    ;; 
     139    G42) 
     140        echo "iii : drakkar_exp=${drakkar_exp}" 
     141    ;; 
     142    *) 
     143        echo "eee : pb \${drakkar_exp} = ${drakkar_exp}" 
     144        exit 1 
     145    ;; 
    148146esac 
    149147# 
    150148# ++ conversion of latitude and longitude in x and y indexes 
    151149case ${orcares} in 
    152    ORCA025) 
    153       xmin=529 
    154       xmax=689 
    155       ymin=266 
    156       ymax=372 
    157       echo "iii : forcage xmin xmax ymin ymax : ${xmin} ${xmax} ${ymin} ${ymax}" 
    158    ;; 
    159    *) 
    160       echo "eee : pb conversion lat,long to x,y" 
    161       exit 1 
    162    ;; 
     150    ORCA025) 
     151        xmin=529 
     152        xmax=689 
     153        ymin=266 
     154        ymax=372 
     155        echo "iii : forcage xmin xmax ymin ymax : ${xmin} ${xmax} ${ymin} ${ymax}" 
     156    ;; 
     157    *) 
     158        echo "eee : pb conversion lat,long to x,y" 
     159        exit 1 
     160    ;; 
    163161esac 
    164162# 
     
    167165for file in `cat ${list}` 
    168166do 
    169    echo "iii : extraction from ${file}" # ++ voir seulement si debug demandé 
    170    filessh=${GEOMAG_OD}/`basename ${file} .nc`_ssh.nc 
    171    rm -f ${filessh} 2> /dev/null 
    172    ncks --dimension x,${xmin},${xmax} --dimension y,${ymin},${ymax}  -v sossheig,nav_lon,nav_lat \ 
    173       ${file} ${filessh} 
    174    status_ncks=${?} 
    175    if [ ${status_ncks} -ne 0 ] 
    176    then 
    177       echo "eee : pb with ncks ${file}" 
    178       exit 1 
    179    else 
    180       list_ssh="${list_ssh} ${filessh}" 
    181    fi 
     167    echo "iii : extraction from ${file}" # ++ voir seulement si debug demandé 
     168    filessh=${GEOMAG_OD}/`basename ${file} .nc`_ssh.nc 
     169    rm -f ${filessh} 2> /dev/null 
     170    ncks --dimension x,${xmin},${xmax} --dimension y,${ymin},${ymax}  -v sossheig,nav_lon,nav_lat \ 
     171    ${file} ${filessh} 
     172    status_ncks=${?} 
     173    if [ ${status_ncks} -ne 0 ] 
     174    then 
     175        echo "eee : pb with ncks ${file}" 
     176        exit 1 
     177    else 
     178        list_ssh="${list_ssh} ${filessh}" 
     179    fi 
    182180done 
    183181line=`head -n 1 ${list}` 
     
    195193if [ ${status_ncrcat} -ne 0 ] 
    196194then 
    197    echo "eee : pb with ncrcat" 
    198    exit 1 
     195    echo "eee : pb with ncrcat" 
     196    exit 1 
    199197else 
    200    echo "iii : result in ${filetot}" 
     198    echo "iii : result in ${filetot}" 
    201199fi 
    202200# 
Note: See TracChangeset for help on using the changeset viewer.