#!/bin/ksh ## C070M1 run year [yearmax] 2004/01/23 ## C070M1 processes all 12 months of individual D files for one or more ## years of 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.O and AIJK070.O, are ## appended to prior (or newly created) M1 DataFiles for separate ## quantities. if [[ $# -lt 2 ]] ; then echo " Usage: C070M1 run year [yearmax] 2004/01/23" echo " Append records of specified years to M1 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 M1 directory if it does not exist already ## ------------------------------------------------ if [[ ! -d $Direc/M1 ]] ; then mkdir $Direc/M1 echo " Directory $Direc/M1 was just created." ; fi ## Loop over input years ## --------------------- Year=$2 Ymax=$Year if [[ $# -eq 3 ]] ; then Ymax=$3 ; fi until [[ $Year -gt $Ymax ]] ; do ## Loop over months ## ---------------- for Mon in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ; do AIJ070 $Direc/D$Mon$Year ; if [[ $? -ne 0 ]] ; then exit 1 ; fi AIJK070 $Direc/D$Mon$Year ; if [[ $? -ne 0 ]] ; then exit 1 ; fi ## Append specific records of created datafiles to Quantity datafiles ## ------------------------------------------------------------------ FAPPEND AIJ070.O $Direc/M1/OIC 1 FAPPEND AIJ070.O $Direc/M1/SNOWC 2 FAPPEND AIJ070.O $Direc/M1/MSNOW 3 FAPPEND AIJ070.O $Direc/M1/HSEN 4 FAPPEND AIJ070.O $Direc/M1/PREC 5 FAPPEND AIJ070.O $Direc/M1/EVAP 6 FAPPEND AIJ070.O $Direc/M1/WETG 7 FAPPEND AIJ070.O $Direc/M1/TASMIN 10 FAPPEND AIJ070.O $Direc/M1/TASMAX 11 FAPPEND AIJ070.O $Direc/M1/PS 14 FAPPEND AIJ070.O $Direc/M1/PRECON 15 FAPPEND AIJ070.O $Direc/M1/MSOIL 17 FAPPEND AIJ070.O $Direc/M1/CLDOD 18 FAPPEND AIJ070.O $Direc/M1/CLDT 19 FAPPEND AIJ070.O $Direc/M1/RTEP 21 FAPPEND AIJ070.O $Direc/M1/RNS 22 FAPPEND AIJ070.O $Direc/M1/RSAP 24 FAPPEND AIJ070.O $Direc/M1/RSAS 26 FAPPEND AIJ070.O $Direc/M1/RSIS 27 FAPPEND AIJ070.O $Direc/M1/TG 28 # FAPPEND AIJ070.O $Direc/M1/ZOS 29 FAPPEND AIJ070.O $Direc/M1/RIVERM 34 FAPPEND AIJ070.O $Direc/M1/TAS 35 FAPPEND AIJ070.O $Direc/M1/CLDL 41 FAPPEND AIJ070.O $Direc/M1/CLDM 42 FAPPEND AIJ070.O $Direc/M1/CLDH 43 FAPPEND AIJ070.O $Direc/M1/RUNS 44 FAPPEND AIJ070.O $Direc/M1/RUNU 45 FAPPEND AIJ070.O $Direc/M1/RUNI 46 FAPPEND AIJ070.O $Direc/M1/WS 51 FAPPEND AIJ070.O $Direc/M1/TKES 76 FAPPEND AIJ070.O $Direc/M1/PSL 79 FAPPEND AIJ070.O $Direc/M1/PCT 80 FAPPEND AIJ070.O $Direc/M1/TCT 81 FAPPEND AIJ070.O $Direc/M1/RHS 85 FAPPEND AIJ070.O $Direc/M1/ALBP 86 FAPPEND AIJ070.O $Direc/M1/ALBS 87 FAPPEND AIJ070.O $Direc/M1/HS 88 FAPPEND AIJ070.O $Direc/M1/TASDV 89 FAPPEND AIJ070.O $Direc/M1/TGDV 90 # FAPPEND AIJ070.O $Direc/M1/PRECSD 91 # FAPPEND AIJ070.O $Direc/M1/TASSD 92 # FAPPEND AIJ070.O $Direc/M1/PSSD 93 FAPPEND AIJK070.O $Direc/M1/T850 1 FAPPEND AIJK070.O $Direc/M1/T500 2 FAPPEND AIJK070.O $Direc/M1/T200 3 FAPPEND AIJK070.O $Direc/M1/Q850 4 FAPPEND AIJK070.O $Direc/M1/Q500 5 FAPPEND AIJK070.O $Direc/M1/Q200 6 FAPPEND AIJK070.O $Direc/M1/Z850 7 FAPPEND AIJK070.O $Direc/M1/Z500 8 FAPPEND AIJK070.O $Direc/M1/Z200 9 done ## End of loop over years ## ---------------------- Year=$(( $Year + 1 )) ; done