source: trunk/getmodelout.sh @ 40

Last change on this file since 40 was 40, checked in by pinsard, 14 years ago

project homogenization

  • Property svn:executable set to *
  • Property svn:keyword set to Id
File size: 2.2 KB
Line 
1#! /bin/sh
2#
3#+
4#
5# NAME
6# ====
7#
8# getmodelout.sh - get model data output file in ${GEOMAG_ID}
9#
10#
11# SYNOPSIS
12# ========
13#
14# ::
15#
16#  $ getmodelout.sh -r orcares -exp drakkar_exp -g grid -yearmin yyyy -yearmax yyyy -o list
17#
18# DESCRIPTION
19# ===========
20#
21# get model data output file in ${GEOMAG_ID}
22#
23# EXAMPLES
24# ========
25#
26#
27# To get DRAKKAR G42 experiment output on grid T points beteween year 9 and 10:
28# ::
29#
30#  $ getmodelout.sh -r ORCA025 -exp G42 -g gridT -yearmin 9 -yearmax 10 -o ${GEOMAG_OD}/list_G42
31#
32# EVOLUTIONS
33# ==========
34#
35# $Id$
36# - reee522 2007-11-26T11:21:37Z rhodes (IRIX64)
37#
38#   * creation
39#-
40#
41command=getmodelout.sh
42#
43usage=" Usage : ${command} -r orcares -exp drakkar_exp -g grid -o list"
44#
45while [ ! -z "${1}" ] # ++ pb bash
46do
47 case ${1} in
48 -r)
49    orcares=${2}
50    shift
51 ;;
52 -exp)
53    drakkar_exp=${2}
54    shift
55 ;;
56 -g)
57    grid=${2}
58    shift
59 ;;
60 -yearmin)
61   yearmin=${2}
62   shift
63 ;;
64 -yearmax)
65   yearmax=${2}
66   shift
67 ;;
68 -o)
69   list=${2}
70   shift
71 ;;
72 *) # other choice
73   echo "${usage}"
74 ;;
75 esac
76 shift # next flag
77done
78#
79set -u
80#
81# check GEOMAG environement
82if [ ! -d ${GEOMAG_LOG} ]
83then
84 echo " eee : \${GEOMAG_LOG} not found"
85 exit 1
86fi
87#
88if [ -f ${list} ]
89then
90  echo "eee : ${list} exist"
91  exit 1
92fi
93# ++ blindage en tout genre
94#
95case ${orcares} in
96ORCA025)
97   dirref=/u/rech/cli/rcli002/ # sur l'idris
98;;
99*)
100   echo "eee : pb \${orcares} = ${orcares}"
101;;
102esac
103#
104listfull=${GEOMAG_LOG}/lisfull${$}
105#
106iyear=${yearmin}
107while [ ${iyear} -le ${yearmax} ]
108do
109  cyear=`printf "%4.4d" ${iyear}`
110  ls ${dirref}/${orcares}/${orcares}-${drakkar_exp}-S/${cyear}/${orcares}-${drakkar_exp}_y${cyear}m??d??_${grid}.nc >> ${listfull}
111  # ++ calcul taille cf myls dans faq es dods
112  # iyear=$(( ${iyear} + 1 )) ++ pas ok sur rhodes
113  # iyear=$(expr  ${iyear} + 1 )  ++ pas ok sur rhodes
114  iyear=`expr  ${iyear} + 1 `
115done
116#
117# print total size of model files
118# ++ pb syntaxe unitsop="1024**2" # Mo
119#ls -l `cat ${listfull}` | \
120#awk 'NF>4 {print $5, $9}' | \
121#awk 'sum=$1/'$unitsop'+sum {printf("%08.3f '$units' -- %s\n",$1/'$unitsop', $2)}
122#
123# put files in ${GEOMAG_ID}
124# ++ ln cp ou scp
125# ++ -f ou test si deja existant
126for file in  `cat ${listfull}`
127do
128  ln -sf ${file} ${GEOMAG_ID}
129  echo ${GEOMAG_ID}/`basename ${file}` >> ${list}
130done
131#
132# end
133exit 0
Note: See TracBrowser for help on using the repository browser.