#!/bin/ksh ## C070M10 run decade [decademax] 2004/01/23 ## C070M10 processes all 12 months of decade monthly D files for one or ## more years for a specified run (e.g. C089). AIJ070 and AIJK070 are ## executed for each D file. Each variable in AIJ070.I should have ## been set to T (true), while in AIJK070.I only these quantites should ## have been set: KT = 850,500,200, KQ = 850,500,200, KZ = 850,500,200. ## Individual records of the output files, AIJ070.I and AIJK070.I, are ## appended to prior (or newly created) M10 DataFiles for separate ## quantities. The first decade of C089 is 195 and the last is 209. if [[ $# -lt 2 ]] ; then echo " Usage: C070M10 run decade [decademax] 2004/01/23" echo " Append records of specified decades to M10 datafiles" exit ; fi # Run=$1 ## A073b or C089 # Runnum=${Run#C} ## 089 # Runnum=${Run#A} ## 073b ## Determine directory (raid device and run number) ## ------------------------------------------------ # if [[ -d /raid1/$1 ]] ; then Direc=/raid1/$1 # elif [[ -d /raid2/$1 ]] ; then Direc=/raid2/$1 # elif [[ -d /raid3/$1 ]] ; then Direc=/raid3/$1 # elif [[ -d /raid4/$1 ]] ; then Direc=/raid4/$1 ; fi Direc=$OUTPAR/$1 if [[ ! -d $Direc ]] ; then echo " Run directory $1 not found on any raid device." exit ; fi ## Create M10 directory if it does not exist already ## ------------------------------------------------- if [[ ! -d $Direc/M10 ]] ; then mkdir $Direc/M10 echo " Directory $Direc/M10 was just created." ; fi ## Loop over decades ## ----------------- Dec=$2 Decmax=$Dec if [[ $# -eq 3 ]] ; then Decmax=$3 ; fi until [[ $Dec -gt $Decmax ]] ; do DecX=$Dec'X' ## Loop over months ## ---------------- for Mon in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ; do ## Create DMonDecX if it does not exist already ## -------------------------------------------- if [[ -f $Direc/M10/D$Mon$DecX ]] ; then echo " $Direc/M10/D$Mon$DecX already exists." else AVER070 $Direc/D$Mon$Dec[0-9] || exit mv AVER070.O $Direc/M10/D$Mon$DecX echo " File $Direc/M10/D$Mon$DecX created." ; fi ## Create datafiles and append their records to Quantity datafiles ## --------------------------------------------------------------- AIJ070 $Direc/M10/D$Mon$DecX ; if [[ $? -ne 0 ]] ; then exit 1 ; fi AIJK070 $Direc/M10/D$Mon$DecX ; if [[ $? -ne 0 ]] ; then exit 1 ; fi FAPPEND AIJ070.O $Direc/M10/OIC 1 FAPPEND AIJ070.O $Direc/M10/SNOWC 2 FAPPEND AIJ070.O $Direc/M10/MSNOW 3 FAPPEND AIJ070.O $Direc/M10/HSEN 4 FAPPEND AIJ070.O $Direc/M10/PREC 5 FAPPEND AIJ070.O $Direc/M10/EVAP 6 FAPPEND AIJ070.O $Direc/M10/WETG 7 FAPPEND AIJ070.O $Direc/M10/TASMIN 10 FAPPEND AIJ070.O $Direc/M10/TASMAX 11 FAPPEND AIJ070.O $Direc/M10/PS 14 FAPPEND AIJ070.O $Direc/M10/PRECON 15 FAPPEND AIJ070.O $Direc/M10/MSOIL 17 FAPPEND AIJ070.O $Direc/M10/CLDOD 18 FAPPEND AIJ070.O $Direc/M10/CLDT 19 FAPPEND AIJ070.O $Direc/M10/RTEP 21 FAPPEND AIJ070.O $Direc/M10/RNS 22 FAPPEND AIJ070.O $Direc/M10/RSAP 24 FAPPEND AIJ070.O $Direc/M10/RSAS 26 FAPPEND AIJ070.O $Direc/M10/RSIS 27 FAPPEND AIJ070.O $Direc/M10/TG 28 # FAPPEND AIJ070.O $Direc/M10/ZOS 29 FAPPEND AIJ070.O $Direc/M10/EVAPAP 32 FAPPEND AIJ070.O $Direc/M10/EVAPPP 33 FAPPEND AIJ070.O $Direc/M10/RIVERM 34 FAPPEND AIJ070.O $Direc/M10/TAS 35 FAPPEND AIJ070.O $Direc/M10/CLDL 41 FAPPEND AIJ070.O $Direc/M10/CLDM 42 FAPPEND AIJ070.O $Direc/M10/CLDH 43 FAPPEND AIJ070.O $Direc/M10/RUNS 44 FAPPEND AIJ070.O $Direc/M10/RUNU 45 FAPPEND AIJ070.O $Direc/M10/RUNI 46 FAPPEND AIJ070.O $Direc/M10/WS 51 # FAPPEND AIJ070.O $Direc/M10/TKES 76 # FAPPEND AIJ070.O $Direc/M10/PSL 79 # FAPPEND AIJ070.O $Direc/M10/PCT 80 # FAPPEND AIJ070.O $Direc/M10/TCT 81 FAPPEND AIJ070.O $Direc/M10/RHS 85 FAPPEND AIJ070.O $Direc/M10/ALBP 86 FAPPEND AIJ070.O $Direc/M10/ALBS 87 FAPPEND AIJ070.O $Direc/M10/HS 88 FAPPEND AIJ070.O $Direc/M10/TASDV 89 FAPPEND AIJ070.O $Direc/M10/TGDV 90 # FAPPEND AIJ070.O $Direc/M10/PRECSD 91 FAPPEND AIJ070.O $Direc/M10/TASSD 92 # FAPPEND AIJ070.O $Direc/M10/PSSD 93 FAPPEND AIJK070.O $Direc/M10/T850 1 FAPPEND AIJK070.O $Direc/M10/T500 2 FAPPEND AIJK070.O $Direc/M10/T200 3 FAPPEND AIJK070.O $Direc/M10/Q850 4 FAPPEND AIJK070.O $Direc/M10/Q500 5 FAPPEND AIJK070.O $Direc/M10/Q200 6 FAPPEND AIJK070.O $Direc/M10/Z850 7 FAPPEND AIJK070.O $Direc/M10/Z500 8 FAPPEND AIJK070.O $Direc/M10/Z200 9 done ## End of loop over decades ## ------------------------ Dec=$(( $Dec + 1 )) done