Ignore:
Timestamp:
11/26/07 12:39:53 (17 years ago)
Author:
pinsard
Message:

introduce a shell to get outputs of model in GEOMAG environement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/detectbarotopemode.sh

    r32 r33  
    22# 
    33# module : 
    4 # build file for detection of baratrope mode 
     4# build file for detection of barotrope mode 
    55# 
    66# usage : 
    7 # $ ./detectbaratropemode.sh ++ 
     7# $ detectbarotropemode.sh -l list 
     8# 
     9# example : 
     10# $ detectbarotropemode.sh -l ${GEOMAG_OD}/list_G42 
    811# 
    912# update : 
    1013# $Id$ 
    1114# pas fini ++ 
     15# reee522 2007-11-26T11:33:42Z rhodes (IRIX64) 
     16# externalization of  copy of data file in getmodelout.sh 
     17# reee522 2007-11-26T10:55:44Z rhodes (IRIX64) 
     18# add ncks, ncrcat and some informations inspired by 
     19# http://dods.ipsl.jussieu.fr/projets_ES/misc/myls 
    1220# fplod 2007-11-23T17:02:56Z aedon.locean-ipsl.upmc.fr (Darwin) 
    1321# creation 
    1422#  
     23command=detectbarotopemode.sh 
     24# 
    1525# ++ simulation parametres 
    1626yearmin=8 
    1727yearmax=10 
     28latmin=-50 
     29latmax=-30 
     30longmin=295 
     31longmax=335 
    1832grid=gridT 
     33orcares=ORCA025 
    1934DRAKKAR_EXP=G42 
    2035# 
     36usage=" Usage : ${command} -f list" 
     37# 
     38while [ ! -z "${1}" ] # ++ pb bash 
     39do 
     40 case ${1} in 
     41 -l) 
     42    list=${2} 
     43    shift 
     44 ;; 
     45 
     46 *) # other choice 
     47    echo "${usage}" 
     48 ;; 
     49 esac 
     50 shift # next flag 
     51done 
     52# 
     53set -u 
     54# 
     55# check GEOMAG environement 
     56if [ ! -d ${GEOMAG_LOG} ] 
     57then 
     58 echo " eee : \${GEOMAG_LOG} not found" 
     59 exit 1 
     60fi 
    2161# ++ blindage en tout genre 
    2262# 
    2363#  
    24 #++list=/tmp/${LOGNAME}/listfiles${$} 
    25 list=./listfiles${$} 
     64# ++ conversion of latitude and longitude in x and y indexes 
     65case in ${orcares} in 
     66ORCA025) 
     67   xmin=10 
     68   xmax=30 
     69   ymin=10 
     70   ymax=40 
     71; 
     72*) 
     73  echo "eee : pb conversion lat,long to x,y" 
     74  exit 1 
     75;; 
     76esac 
    2677# 
    27 # pour info liste des fichiers à prendre en compte 
    28 iyear=${yearmin} 
    29 while [ ${iyear} -lt ${yearmax} ] 
    30 do  
    31   cyear=`printf "%4.4d" ${iyear}` 
    32   ls /u/rech/cli/rcli002/ORCA025/ORCA025-${DRAKKAR_EXP}-S/${cyear}/ORCA025-${DRAKKAR_EXP}_y${cyear}m??d??_${grid}.nc >> ${list} 
    33  
    34   # ++ calcul taille cf myls dans faq es dods 
    35   # iyear=$(( ${iyear} + 1 )) ++ pas ok sur rhodes 
    36   # iyear=$(expr  ${iyear} + 1 )  ++ pas ok sur rhodes 
    37   iyear=`expr  ${iyear} + 1 `  
     78# extract ssh and create a new set of files 
     79list_ssh="" 
     80for file in  `cat ${list}` 
     81do 
     82 fileb=`basename ${file}` 
     83 filessh=`basename ${file} .nc`_ssh.nc 
     84 rm -f ${GEOMAG_OD}/${filessh} 2> /dev/null 
     85 ncks --dimension x,${xmin},${xmax} --dimension y,${ymin},${ymax}  \ 
     86       -v sossheig \ 
     87 ${GEOMAG_ID}/${fileb} ${GEOMAG_OD}/${filessh} 
     88 status_ncks=${?} 
     89 if [ ${status_ncks} -ne 0 ] 
     90 then 
     91    echo "eee : pb with ncks ${file}" 
     92    exit 1 
     93 else 
     94    list_ssh="${list_ssh} ${file_ssh}" 
     95 fi 
    3896done 
    3997# 
    40 # put files in ${GEOMAG_ID} 
    41 # ++ ln cp ou scp  
    42 # ++ -f ou test si deja existant  
    43 for file in  `cat ${list}` 
    44 do 
    45   ln -sf ${file} ${GEOMAG_ID} 
    46 done  
    47 # 
    48 # 
    49 # extract ssh and create a new set of files 
    50 for file in  `cat ${list}` 
    51 do 
    52  filessh=`basename ${file} .nc`_ssh.nc 
    53  # ++ test si exist deja 
    54  ncks -v sossheig ${GEOMAG_ID}/${file} ${GEOMAG_OD}/${filessh} #++ lat long et sortie x, y, t 
    55  #++ test status 
    56  ls -l  ${GEOMAG_ID}/${file} ${GEOMAG_OD}/${filessh} 
    57  read a 
    58 done 
    59 # 
     98datemin=19980101#++ 
     99datemax=19991231#++ 
    60100# concatenation ++ 
    61 # ++ ncrcat 
    62  
     101varlist=`cat ${list_ssh}` 
     102filetot=ssh_zone_${datemin}_${datemax}_${orcares}_${DRAKKAR_EXP}.nc 
     103ncrcat ${varlist} ${filetot} 
     104status_ncrcat=${?} 
     105if [ ${status_ncrcat} -ne 0 ] 
     106then 
     107   echo "eee : pb with ncrcat" 
     108   exit 1 
     109fi 
    63110#  
    64111# menage 
    65112rm ${list} 
     113rm ${list_ssh} 
    66114# 
    67115# end 
Note: See TracChangeset for help on using the changeset viewer.