Repository navigation
Expand file tree
/
Copy pathGet_Initial_Files
More file actions
executable file
·175 lines (144 loc) · 5.01 KB
/
Copy pathGet_Initial_Files
File metadata and controls
executable file
·175 lines (144 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#
# A utility to get the required files from HPSS to run a standalone GSI job.
# This is loosely based on R. Treadon's hpssget_gdas.sh
# This script is designed to be run interactively but can be incorporated into
# other scripts to be run in batch if desired.
#
# One argument, the desired analysis date, is required.
# By default the output goes to /ptmp/${USER}/data_sigmap/globalprod.${adate}
#
if [ $# -eq 1 ]; then
adate=$1
else
echo Incorrect number of arguments. Usage:
echo " Get_Initial_Files <analysis date>"
exit 1
fi
set -ax
#machine="Zeus"
machine="WCOSS"
if [[ "$machine" = "Zeus" ]]; then
nwprod=/scratch2/portfolios/NCEPDEV/global/save/Shrinivas.Moorthi/para
ptmp=/scratch2/portfolios/NCEPDEV/ptmp
stmp=/scratch2/portfolios/NCEPDEV/stmp
ndate=/scratch1/portfolios/NCEPDEV/da/save/Michael.Lueken/nwprod/util/exec/ndate
elif [[ "$machine" = "WCOSS" ]]; then
nwprod=/nwprod
ptmp=/ptmpp1
stmp=/stmpp1
ndate=$nwprod/util/exec/ndate
fi
# We are getting files for a single analysis date. Some will come from the previous cycle ($gdate).
incr=06
gdate=`$ndate -${incr} $adate`
# Specify temporary directory (tmpdir) in which to run script.
# Specify directory in which to store retrieved files (savdir)
uname=`whoami`
exp=globalprod.$adate
JCAP=382 # We only get 382 for now (emily: not used)
#tmpdir=/stmp/${uname}/get_initial_files.${adate}
#savdir=/ptmp/${USER}/data_sigmap/${exp}
tmpdir=$stmp/${uname}/get_initial_files.${adate}
savdir=$ptmp/${USER}/data_sigmap/${exp}
# Specify name of files to retrieve from this cycle
DFILESA="$DFILESA sgm3prep sgesprep sgp3prep prepbufr prepbufr.acft_profiles"
DFILESA="$DFILESA 1bamua.tm00.bufr_d 1bamub.tm00.bufr_d"
DFILESA="$DFILESA 1bhrs3.tm00.bufr_d 1bhrs4.tm00.bufr_d 1bmhs.tm00.bufr_d esamua.tm00.bufr_d"
DFILESA="$DFILESA esamub.tm00.bufr_d airsev.tm00.bufr_d mtiasi.tm00.bufr_d"
DFILESA="$DFILESA goesfv.tm00.bufr_d gpsro.tm00.bufr_d osbuv8.tm00.bufr_d sptrmm.tm00.bufr_d"
#DFILESA="$DFILESA ssmit.tm00.bufr_d spssmi.tm00.bufr_d ssmis.tm00.bufr_d amsre.tm00.bufr_d"
DFILESA="$DFILESA spssmi.tm00.bufr_d ssmisu.tm00.bufr_d amsre.tm00.bufr_d"
DFILESA="$DFILESA gome.tm00.bufr_d omi.tm00.bufr_d syndata.tcvitals.tm00"
DFILESA="$DFILESA atms.tm00.bufr_d cris.tm00.bufr_d"
DFILESA="$DFILESA satwnd.tm00.bufr_d"
# These come from the previous cycle
DFILESG="$DFILESG abias_pc abias satang radstat"
DFILESG="$DFILESG bf03 bf06 bf09"
# Make $tmpdir and $savdir. Change directory to $tmpdir
rm -rf $tmpdir
mkdir -p $tmpdir
if [[ -s $tmpdir ]]; then
cd $tmpdir
else
echo Temporary directory $tmpdir cannot be created
echo Check definition of \$stmp variable in this script
exit 1
fi
mkdir -p $savdir
# SWITCH is the date on which the runhistory tapes moved from
# hsm to hpss. The path to the tar files is different for
# hsm and hpss, hence the need to know when the switch occured.
SWITCH=2003051818
yyyya=`echo $adate | cut -c1-4`
mma=`echo $adate | cut -c5-6`
dda=`echo $adate | cut -c7-8`
hha=`echo $adate | cut -c9-10`
yyyyg=`echo $gdate | cut -c1-4`
mmg=`echo $gdate | cut -c5-6`
ddg=`echo $gdate | cut -c7-8`
hhg=`echo $gdate | cut -c9-10`
# Based on date in comparison to $SWITCH date, set path to tarfile
if [[ $adate -lt $SWITCH ]]; then
hpssdira=/hpssuser/g02/wx15gv/s70/hsmprod/runhistory/rh${yyyya}/${yyyya}${mma}/${yyyya}${mma}${dda}
hpssdirg=/hpssuser/g02/wx15gv/s70/hsmprod/runhistory/rh${yyyyg}/${yyyyg}${mmg}/${yyyyg}${mmg}${ddg}
else
hpssdira=/NCEPPROD/hpssprod/runhistory/rh${yyyya}/${yyyya}${mma}/${yyyya}${mma}${dda}
hpssdirg=/NCEPPROD/hpssprod/runhistory/rh${yyyyg}/${yyyyg}${mmg}/${yyyyg}${mmg}${ddg}
fi
tag=gdas
prefixa=./gdas1.t${hha}z
prefixg=./gdas1.t${hhg}z
tarfilea=com2_gfs_prod_gdas.${adate}.tar
tarfileg=com2_gfs_prod_gdas.${gdate}.tar
set +x
for file in $DFILESA; do DFA="$DFA ${prefixa}.$file" ; done
for file in $DFILESG; do DFG="$DFG ${prefixg}.$file" ; done
set -x
# Loop to pull desired files off tape
#hpsstar=/nwprod/util/ush/hpsstar
#hpsstar=/NCEPPROD/nwprod/util/ush/hpsstar
if [[ "$machine" = "Zeus" ]]; then
hpsstar=/home/Emily.Liu/bin/hpsstar #emily:for now
# hpsstar=$nwprod/util/ush/hpsstar #emily:eventually
elif [[ "$machine" = "WCOSS" ]]; then
hpsstar=$nwprod/util/ush/hpsstar
fi
cpy=""
cpn=""
# Files from analysis cycle:
$hpsstar get $hpssdira/$tarfilea $DFA
for ft in $DFILESA; do
fto=${prefixa}.$ft
ftn=$savdir/$fto
chmod 644 $fto
cp $fto $ftn
if [[ $? -eq 0 ]]; then
cpy="$cpy $ft"
else
cpn="$cpn $ft"
fi
done
# Files from guess cycle
$hpsstar get $hpssdirg/$tarfileg $DFG
for ft in $DFILESG; do
fto=${prefixg}.$ft
ftn=$savdir/$fto
# $hpsstar get $hpssdirg/$tarfileg $fto
chmod 644 $fto
cp $fto $ftn
if [[ $? -eq 0 ]]; then
cpy="$cpy $ft"
else
cpn="$cpn $ft"
fi
done
echo ${adate}: File types copied: $cpy
echo ${adate}: File types NOT copied: $cpn
echo ${gdate}: File types copied: $cpy
echo ${gdate}: File types NOT copied: $cpn
#Remove temporary directory
cd $tmpdir
rm -rf ./*
cd ../
rm -rf $tmpdir
exit