-
Notifications
You must be signed in to change notification settings - Fork 235
/
template_geo.job
54 lines (40 loc) · 1.1 KB
/
template_geo.job
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
#!/bin/bash -l
# redirect output
exec 3>&1
exec &> "@OUTDIR@/logfile.txt"
# host specific setup
@HOST_SETUP@
@CDO_SETUP@
# create output folder
mkdir -p "@OUTDIR@"
# see if application needs running
if [ ! -e "@OUTDIR@/sipnet.out" ]; then
cd "@RUNDIR@"
ln -s "@SITE_MET@" sipnet.clim
"@BINARY@"
STATUS=$?
# copy output
mv "@RUNDIR@/sipnet.out" "@OUTDIR@"
# check the status
if [ $STATUS -ne 0 ]; then
echo -e "ERROR IN MODEL RUN\nLogfile is located at '@OUTDIR@/logfile.txt'" >&3
exit $STATUS
fi
# convert to MsTMIP
echo "require (PEcAn.SIPNET)
model2netcdf.SIPNET('@OUTDIR@', @SITE_LAT@, @SITE_LON@, '@START_DATE@', '@END_DATE@', @DELETE.RAW@, '@REVISION@', '@PREFIX@', @OVERWRITE@, @CONFLICT@)
" | R --no-save
fi
# copy readme with specs to output
cp "@RUNDIR@/README.txt" "@OUTDIR@/README.txt"
# run getdata to extract right variables
# host specific teardown
@HOST_TEARDOWN@
#copy files back.
@CPRUNCMD@
@CPOUTCMD@
#delete files in the run and out folder.
@RMRUNDIRCMD@
@RMOUTDIRCMD@
# all done
echo -e "MODEL FINISHED\nLogfile is located at '@OUTDIR@/logfile.txt'" >&3