#!/bin/ksh ## C070A1 run year [yearmax] 2004/01/23 ## C070A1 processes single year annual D files for one or more years ## of a specified run (e.g. C089). AIJ070, AIJK070 and OIJ070 are ## executed for each D file. Each variable in AIJ070.I and OIJ070.I ## should have been set to T (true); 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.O, ## AIJK070.O or OIJ070.O, are appended to prior (or newly created) A1 ## DataFiles for separate quantities. if [[ $# -lt 2 ]] ; then echo " Usage: C070A1 run year [yearmax] 2004/01/23" echo " Append records of specified years to A1 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 A1 directory if it does not exist already ## ------------------------------------------------ if [[ ! -d $Direc/A1 ]] ; then mkdir $Direc/A1 echo " Directory $Direc/A1 was just created." ; fi ## Loop over input years ## --------------------- Year=$2 Ymax=$Year if [[ $# -eq 3 ]] ; then Ymax=$3 ; fi until [[ $Year -gt $Ymax ]] ; do ## Create DAnnYear if it does not exist already ## -------------------------------------------- if [[ -f $Direc/A1/DAnn$Year ]] ; then echo " $Direc/A1/DAnn$Year already exists." else AVER070 $Direc/D*$Year || exit mv AVER070.O $Direc/A1/DAnn$Year echo " File $Direc/A1/DAnn$Year created." ; fi ## Create datafiles and append their records to Quantity datafiles ## --------------------------------------------------------------- AIJ070 $Direc/A1/DAnn$Year ; if [[ $? -ne 0 ]] ; then exit 1 ; fi AIJK070 $Direc/A1/DAnn$Year ; if [[ $? -ne 0 ]] ; then exit 1 ; fi OIJ070 $Direc/A1/DAnn$Year ; if [[ $? -ne 0 ]] ; then exit 1 ; fi FAPPEND AIJ070.O $Direc/A1/OIC 1 FAPPEND AIJ070.O $Direc/A1/SNOWC 2 FAPPEND AIJ070.O $Direc/A1/MSNOW 3 FAPPEND AIJ070.O $Direc/A1/HSEN 4 FAPPEND AIJ070.O $Direc/A1/PREC 5 FAPPEND AIJ070.O $Direc/A1/EVAP 6 FAPPEND AIJ070.O $Direc/A1/WETG 7 FAPPEND AIJ070.O $Direc/A1/TASMIN 10 FAPPEND AIJ070.O $Direc/A1/TASMAX 11 FAPPEND AIJ070.O $Direc/A1/PS 14 FAPPEND AIJ070.O $Direc/A1/PRECON 15 FAPPEND AIJ070.O $Direc/A1/MSOIL 17 FAPPEND AIJ070.O $Direc/A1/CLDOD 18 FAPPEND AIJ070.O $Direc/A1/CLDT 19 FAPPEND AIJ070.O $Direc/A1/RTEP 21 FAPPEND AIJ070.O $Direc/A1/RNS 22 FAPPEND AIJ070.O $Direc/A1/RSAP 24 FAPPEND AIJ070.O $Direc/A1/RSAS 26 FAPPEND AIJ070.O $Direc/A1/RSIS 27 FAPPEND AIJ070.O $Direc/A1/TG 28 FAPPEND AIJ070.O $Direc/A1/ZOS 29 FAPPEND AIJ070.O $Direc/A1/RIVERM 34 FAPPEND AIJ070.O $Direc/A1/TAS 35 FAPPEND AIJ070.O $Direc/A1/CLDL 41 FAPPEND AIJ070.O $Direc/A1/CLDM 42 FAPPEND AIJ070.O $Direc/A1/CLDH 43 FAPPEND AIJ070.O $Direc/A1/RUNS 44 FAPPEND AIJ070.O $Direc/A1/RUNU 45 FAPPEND AIJ070.O $Direc/A1/RUNI 46 FAPPEND AIJ070.O $Direc/A1/WS 51 FAPPEND AIJ070.O $Direc/A1/TKES 76 FAPPEND AIJ070.O $Direc/A1/PSL 79 FAPPEND AIJ070.O $Direc/A1/PCT 80 FAPPEND AIJ070.O $Direc/A1/TCT 81 FAPPEND AIJ070.O $Direc/A1/RHS 85 FAPPEND AIJ070.O $Direc/A1/ALBP 86 FAPPEND AIJ070.O $Direc/A1/ALBS 87 FAPPEND AIJ070.O $Direc/A1/HS 88 FAPPEND AIJ070.O $Direc/A1/TASDV 89 FAPPEND AIJ070.O $Direc/A1/TGDV 90 FAPPEND AIJ070.O $Direc/A1/PRECSD 91 FAPPEND AIJ070.O $Direc/A1/TASSD 92 FAPPEND AIJ070.O $Direc/A1/PSSD 93 FAPPEND AIJK070.O $Direc/A1/T850 1 FAPPEND AIJK070.O $Direc/A1/T500 2 FAPPEND AIJK070.O $Direc/A1/T200 3 FAPPEND AIJK070.O $Direc/A1/Q850 4 FAPPEND AIJK070.O $Direc/A1/Q500 5 FAPPEND AIJK070.O $Direc/A1/Q200 6 FAPPEND AIJK070.O $Direc/A1/Z850 7 FAPPEND AIJK070.O $Direc/A1/Z500 8 FAPPEND AIJK070.O $Direc/A1/Z200 9 FAPPEND OIJ070.O $Direc/A1/ZOS 1 FAPPEND OIJ070.O $Direc/A1/TOS 2 FAPPEND OIJ070.O $Direc/A1/SOS 3 FAPPEND OIJ070.O $Direc/A1/MOSI 5 FAPPEND OIJ070.O $Direc/A1/MSALT 6 FAPPEND OIJ070.O $Direc/A1/MLAKE 7 ## End of loop over years ## ---------------------- Year=$(( $Year + 1 )) ; done