forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink_workflow.sh
More file actions
executable file
·583 lines (512 loc) · 19 KB
/
link_workflow.sh
File metadata and controls
executable file
·583 lines (512 loc) · 19 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#!/bin/bash
#--make symbolic links for EMC installation and hardcopies for NCO delivery
HOMEgfs=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}")")" > /dev/null 2>&1 && git rev-parse --show-toplevel)
TRACE=NO source "${HOMEgfs}/ush/preamble.sh"
function usage() {
cat << EOF
Builds all of the global-workflow components by calling the individual build
scripts in sequence.
Usage: ${BASH_SOURCE[0]} [-h][-o][--nest]
-h:
Print this help message and exit
-o:
Configure for NCO (copy instead of link)
EOF
exit 1
}
RUN_ENVIR="emc"
# Reset option counter in case this script is sourced
OPTIND=1
while getopts ":ho-:" option; do
case "${option}" in
h) usage ;;
o)
echo "-o option received, configuring for NCO"
RUN_ENVIR="nco"
;;
-)
if [[ "${OPTARG}" == "nest" ]]; then
LINK_NEST=ON
fi
;;
:)
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument"
usage
;;
*)
echo "[${BASH_SOURCE[0]}]: Unrecognized option: ${option}"
usage
;;
esac
done
shift $((OPTIND - 1))
# LINK is always ln, LINK_OR_COPY can be ln or cp depending on RUN_ENVIR being emc or nco, respectively
LINK="ln -fs"
if [[ "${RUN_ENVIR}" == "nco" ]]; then
LINK_OR_COPY="cp -rp"
else
LINK_OR_COPY="ln -fs"
fi
# shellcheck disable=SC1091
COMPILER="intel" source "${HOMEgfs}/ush/detect_machine.sh" # (sets MACHINE_ID)
# shellcheck disable=
machine=$(echo "${MACHINE_ID}" | cut -d. -f1)
#------------------------------
#--Set up build.ver and run.ver
#------------------------------
${LINK_OR_COPY} "${HOMEgfs}/versions/build.${machine}.ver" "${HOMEgfs}/versions/build.ver"
${LINK_OR_COPY} "${HOMEgfs}/versions/run.${machine}.ver" "${HOMEgfs}/versions/run.ver"
#------------------------------
#--model fix fields
#------------------------------
case "${machine}" in
"wcoss2") FIX_DIR="/lfs/h2/emc/global/noscrub/emc.global/FIX/fix" ;;
"hera" | "ursa") FIX_DIR="/scratch3/NCEPDEV/global/role.glopara/fix" ;;
"orion") FIX_DIR="/work2/noaa/global/role-global/fix" ;;
"hercules") FIX_DIR="/work2/noaa/global/role-global/fix" ;;
"gaeac5") FIX_DIR="/gpfs/f5/ufs-ard/world-shared/global/glopara/data/fix" ;;
"gaeac6") FIX_DIR="/gpfs/f6/drsa-precip3/world-shared/role.glopara/fix" ;;
"noaacloud") FIX_DIR="/lustre/fix" ;;
*)
echo "FATAL: Unknown target machine ${machine}, couldn't set FIX_DIR"
exit 1
;;
esac
# Source fix version file
source "${HOMEgfs}/versions/fix.ver"
# Link GDASapp python packages in ush/python
packages=("jcb")
for package in "${packages[@]}"; do
cd "${HOMEgfs}/ush/python" || exit 1
if [[ -s "${package}" ]]; then
rm -f "${package}"
fi
${LINK} "${HOMEgfs}/sorc/gdas.cd/sorc/${package}/src/${package}" .
done
# Link fix directories
if [[ -n "${FIX_DIR}" ]]; then
mkdir -p "${HOMEgfs}/fix" || exit 1
fi
cd "${HOMEgfs}/fix" || exit 1
for dir in aer \
am \
chem \
cice \
cpl \
datm \
gsi \
lut \
mom6 \
orog \
sfc_climo \
ugwd \
verif \
wave; do
if [[ -d "${dir}" ]]; then
if [[ "${RUN_ENVIR}" == "nco" ]]; then
chmod -R 755 "${dir}"
fi
rm -rf "${dir}"
fi
fix_ver="${dir}_ver"
${LINK_OR_COPY} "${FIX_DIR}/${dir}/${!fix_ver}" "${dir}"
done
# global-nest uses different versions of orog and ugwd
if [[ "${LINK_NEST:-OFF}" == "ON" ]]; then
for dir in orog \
ugwd; do
nestdir=${dir}_nest
if [[ -d "${nestdir}" ]]; then
if [[ "${RUN_ENVIR}" == "nco" ]]; then
chmod -R 755 "${nestdir}"
fi
rm -rf "${nestdir}"
fi
fix_ver="${dir}_nest_ver"
${LINK_OR_COPY} "${FIX_DIR}/${dir}/${!fix_ver}" "${nestdir}"
done
fi
#---------------------------------------
#--add files from external repositories
#---------------------------------------
#--copy/link NoahMp table form ccpp-physics repository
cd "${HOMEgfs}/parm/ufs" || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/noahmptable.tbl" .
cd "${HOMEgfs}/parm/post" || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/parm/params_grib2_tbl_new" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/fix/nam_micro_lookup.dat" .
for dir in gfs gcafs gefs sfs; do
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/parm/${dir}" .
done
for file in optics_luts_DUST.dat optics_luts_DUST_nasa.dat optics_luts_NITR_nasa.dat \
optics_luts_SALT.dat optics_luts_SALT_nasa.dat optics_luts_SOOT.dat optics_luts_SOOT_nasa.dat \
optics_luts_SUSO.dat optics_luts_SUSO_nasa.dat optics_luts_WASO.dat optics_luts_WASO_nasa.dat; do
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/fix/chem/${file}" .
done
for file in ice_gfs.csv ice_gefs.csv ocean_gfs.csv ocean_gefs.csv ocnicepost.nml.jinja2; do
${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/parm/ocnicepost/${file}" .
done
cd "${HOMEgfs}/scripts" || exit 8
if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then
declare -a gdas_scripts=(exglobal_prep_ocean_obs.py)
for gdas_script in "${gdas_scripts[@]}"; do
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/scripts/${gdas_script}" .
done
fi
# Link these templates from ufs-weather-model
cd "${HOMEgfs}/parm/ufs" || exit 1
declare -a ufs_templates=("model_configure.IN" "input_global_nest.nml.IN"
"MOM_input_025.IN" "MOM_input_050.IN" "MOM_input_100.IN" "MOM_input_500.IN"
"MOM6_data_table.IN"
"ice_in.IN"
"ufs.configure.atm.IN"
"ufs.configure.atmaero.IN"
"ufs.configure.s2s.IN"
"ufs.configure.s2sa.IN"
"ufs.configure.s2sw.IN"
"ufs.configure.s2swa.IN"
"ufs.configure.leapfrog_atm_wav.IN"
"ww3_shel.nml.IN"
"post_itag_gfs"
"post_itag_gcafs"
"global_control.nml.IN")
for file in "${ufs_templates[@]}"; do
if [[ -s "${file}" ]]; then
rm -f "${file}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/${file}" .
done
# Link the script from ufs-weather-model that parses the templates
cd "${HOMEgfs}/ush" || exit 1
if [[ -s "atparse.bash" ]]; then
rm -f "atparse.bash"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/atparse.bash" .
# add ufs_utils parm dir
if [[ -d "${HOMEgfs}/sorc/ufs_utils.fd" ]]; then
cd "${HOMEgfs}/parm" || exit 1
mkdir -p regrid_sfc
cd regrid_sfc || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_utils.fd/parm/regrid_sfc/regrid.nml_tmpl" .
fi
#------------------------------
#--add GDASApp fix directory
#------------------------------
if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then
cd "${HOMEgfs}/fix" || exit 1
mkdir -p gdas
cd gdas || exit 1
for gdas_sub in fv3jedi gsibec obs soca aero snow; do
if [[ -d "${gdas_sub}" ]]; then
rm -rf "${gdas_sub}"
fi
fix_ver="gdas_${gdas_sub}_ver"
${LINK_OR_COPY} "${FIX_DIR}/gdas/${gdas_sub}/${!fix_ver}" "${gdas_sub}"
done
fi
#------------------------------
#--add GDASApp parm directory
#------------------------------
if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then
cd "${HOMEgfs}/parm" || exit 1
mkdir -p gdas
cd gdas || exit 1
declare -a gdasapp_comps=("aero" "atm" "io" "ioda" "snow" "marine" "jcb-gdas" "jcb-algorithms" "anlstat" "analcalc")
for comp in "${gdasapp_comps[@]}"; do
if [[ -d "${comp}" ]]; then
rm -rf "${comp}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/parm/${comp}" .
done
fi
#------------------------------
#--add SPOC parm and ush directory
#------------------------------
sources=("config" "scripts")
targets=("parm/gdas" "ush")
for i in "${!sources[@]}"; do
src="${HOMEgfs}/sorc/gdas.cd/sorc/spoc/dump/${sources[${i}]}"
dst="${HOMEgfs}/${targets[${i}]}"
if [[ -d "${src}" ]]; then
cd "${dst}" || exit 1
${LINK_OR_COPY} "${src}" "spoc"
fi
done
#------------------------------
#--add GDASApp files
#------------------------------
if [[ -d "${HOMEgfs}/sorc/gdas.cd/build" ]]; then
cd "${HOMEgfs}/ush/python" || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/soca" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/ufsda" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/ioda/bufr2ioda/gen_bufr2ioda_json.py" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/ioda/bufr2ioda/gen_bufr2ioda_yaml.py" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/ioda/bufr2ioda/run_bufr2ioda.py" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/sorc/da-utils/ush/gsincdiag_to_ioda" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/sorc/da-utils/ush/pyiodaconv" .
cd "${HOMEgfs}/ush" || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/gsi_satbias2ioda_all.sh" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/snow/bufr_snocvr_snomad.py" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/snow/ghcn_snod2ioda.py" .
fi
#------------------------------
#--add DA Monitor file (NOTE: ensure to use correct version)
#------------------------------
if [[ -d "${HOMEgfs}/sorc/gsi_monitor.fd" ]]; then
cd "${HOMEgfs}/parm" || exit 1
if [[ -d monitor ]]; then
rm -rf monitor
fi
mkdir -p monitor
cd monitor || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_cost.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_gnorm.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_cost.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gfs/fix/gfs_minmon_gnorm.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_scaninfo.txt" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" da_mon.parm
# ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/parm/gdas_minmon.parm" .
# ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gfs/parm/gfs_minmon.parm" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/parm/gdas_oznmon.parm" .
# ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" .
fi
#-------------------------------------------
#--Add GSI conv, sat, and oz info parm files
#-------------------------------------------
if [[ -d "${HOMEgfs}/sorc/gsi_enkf.fd/fix/build_gsinfo" ]]; then
cd "${HOMEgfs}/parm" || exit 1
mkdir -p gsinfo
cd gsinfo || exit 1
for dir in convinfo satinfo ozinfo obs_input hirs_fix; do
if [[ -d "${dir}" ]]; then
rm -rf "${dir}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_enkf.fd/fix/build_gsinfo/${dir}" "${dir}"
done
fi
#------------------------------
#--add NEXUS files
#------------------------------
if [[ -d "${HOMEgfs}/sorc/nexus.fd" ]]; then
cd "${HOMEgfs}/parm/chem" || exit 1
if [[ -d nexus ]]; then
rm -rf nexus
fi
mkdir -p nexus/gocart
cd nexus/gocart || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/config/gocart/NEXUS_Config.rc.j2" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/config/gocart/HEMCO_sa_Grid.rc.j2" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/config/gocart/HEMCO_sa_Time.rc.j2" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/config/gocart/HEMCO_sa_Diag.rc.j2" .
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/config/gocart/HEMCO_sa_Spec.rc.j2" .
fi
#------------------------------
#--link executables
#------------------------------
mkdir -p "${HOMEgfs}/exec" || exit 1
cd "${HOMEgfs}/exec" || exit 1
for utilexe in fbwndgfs.x gaussian_sfcanl.x gfs_bufr.x supvit.x syndat_getjtbul.x \
syndat_maksynrc.x syndat_qctropcy.x tocsbufr.x overgridid.x rdbfmsua.x \
mkgfsawps.x enkf_chgres_recenter_nc.x tave.x vint.x ocnicepost.x webtitle.x \
ensadd.x ensppf.x ensstat.x wave_stat.x tref_calc.x; do
if [[ -s "${utilexe}" ]]; then
rm -f "${utilexe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/install/bin/${utilexe}" .
done
declare -a model_systems=("gfs" "gefs" "sfs" "gcafs")
for sys in "${model_systems[@]}"; do
model_exe="${sys}_model.x"
if [[ -s "${model_exe}" ]]; then
rm -f "${model_exe}"
fi
if [[ -f "${HOMEgfs}/sorc/ufs_model.fd/tests/${model_exe}" ]]; then
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/${model_exe}" "${model_exe}"
fi
done
# WW3 pre/post executables
declare -a ww3_exes=("ww3_grid" "ww3_prep" "ww3_prnc" "ww3_outp" "ww3_outf" "ww3_gint" "ww3_ounf" "ww3_ounp" "ww3_grib")
# TODO: ww3_prep, ww3_outf, ww3_ounf, ww3_ounp are not used in the workflow # FIXME or remove them from the list
declare -A wave_systems
wave_systems["gfs"]="pdlib_ON"
wave_systems["gefs"]="pdlib_OFF"
wave_systems["sfs"]="pdlib_OFF"
for sys in "${!wave_systems[@]}"; do
build_loc="${wave_systems[${sys}]}"
if [[ -d "${HOMEgfs}/sorc/ufs_model.fd/WW3/install/${build_loc}" ]]; then
for ww3exe in "${ww3_exes[@]}"; do
target_ww3_exe="${sys}_${ww3exe}.x"
if [[ -s "${target_ww3_exe}" ]]; then
rm -f "${target_ww3_exe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/WW3/install/${build_loc}/bin/${ww3exe}" "${HOMEgfs}/exec/${target_ww3_exe}"
done
fi
done
if [[ -s "upp.x" ]]; then
rm -f upp.x
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/exec/upp.x" .
for ufs_utilsexe in emcsfc_ice_blend emcsfc_snow2mdl global_cycle fregrid regridStates.x; do
if [[ -s "${ufs_utilsexe}" ]]; then
rm -f "${ufs_utilsexe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_utils.fd/exec/${ufs_utilsexe}" .
done
# GSI
if [[ -d "${HOMEgfs}/sorc/gsi_enkf.fd/install" ]]; then
for gsiexe in enkf.x gsi.x; do
if [[ -s "${gsiexe}" ]]; then
rm -f "${gsiexe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_enkf.fd/install/bin/${gsiexe}" .
done
fi
# GSI Utils
if [[ -d "${HOMEgfs}/sorc/gsi_utils.fd/install" ]]; then
for exe in calc_analysis.x calc_increment_ens_ncio.x calc_increment_ens.x \
getsfcensmeanp.x getsigensmeanp_smooth.x getsigensstatp.x \
interp_inc.x recentersigp.x; do
if [[ -s "${exe}" ]]; then
rm -f "${exe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_utils.fd/install/bin/${exe}" .
done
fi
# GSI Monitor
if [[ -d "${HOMEgfs}/sorc/gsi_monitor.fd/install" ]]; then
for exe in oznmon_horiz.x oznmon_time.x radmon_angle.x \
radmon_bcoef.x radmon_bcor.x radmon_time.x; do
if [[ -s "${exe}" ]]; then
rm -f "${exe}"
fi
${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/install/bin/${exe}" .
done
fi
# GDASApp executables
if [[ -d "${HOMEgfs}/sorc/gdas.cd/install" ]]; then
cp -f "${HOMEgfs}/sorc/gdas.cd/install/bin"/gdas* ./
cp -f "${HOMEgfs}/sorc/gdas.cd/install/bin/apply_incr.exe" ./gdas_apply_incr.x
fi
# GDASApp libraries
if [[ -d "${HOMEgfs}/sorc/gdas.cd/install" ]]; then
mkdir -p "${HOMEgfs}/lib" || exit 1
cd "${HOMEgfs}/lib" || exit 1
cp -af "${HOMEgfs}/sorc/gdas.cd/install/lib/." ./
fi
# NEXUS executable
if [[ -d "${HOMEgfs}/sorc/nexus.fd/build/bin" ]]; then
cd "${HOMEgfs}/exec" || exit 1
${LINK_OR_COPY} "${HOMEgfs}/sorc/nexus.fd/build/bin/nexus" nexus.x
fi
#------------------------------
#--link source code directories
#------------------------------
cd "${HOMEgfs}/sorc" || exit 8
if [[ -d ufs_model.fd ]]; then
if [[ -d upp.fd ]]; then
rm -rf upp.fd
fi
${LINK} ufs_model.fd/UFSATM/upp upp.fd
fi
if [[ -d gsi_enkf.fd ]]; then
if [[ -d gsi.fd ]]; then
rm -rf gsi.fd
fi
${LINK} gsi_enkf.fd/src/gsi gsi.fd
if [[ -d enkf.fd ]]; then
rm -rf enkf.fd
fi
${LINK} gsi_enkf.fd/src/enkf enkf.fd
fi
if [[ -d gsi_utils.fd ]]; then
if [[ -d calc_analysis.fd ]]; then
rm -rf calc_analysis.fd
fi
${LINK} gsi_utils.fd/src/netcdf_io/calc_analysis.fd .
if [[ -d calc_increment_ens.fd ]]; then
rm -rf calc_increment_ens.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/calc_increment_ens.fd .
if [[ -d calc_increment_ens_ncio.fd ]]; then
rm -rf calc_increment_ens_ncio.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/calc_increment_ens_ncio.fd .
if [[ -d getsfcensmeanp.fd ]]; then
rm -rf getsfcensmeanp.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/getsfcensmeanp.fd .
if [[ -d getsigensmeanp_smooth.fd ]]; then
rm -rf getsigensmeanp_smooth.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/getsigensmeanp_smooth.fd .
if [[ -d getsigensstatp.fd ]]; then
rm -rf getsigensstatp.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/getsigensstatp.fd .
if [[ -d recentersigp.fd ]]; then
rm -rf recentersigp.fd
fi
${LINK} gsi_utils.fd/src/EnKF/gfs/src/recentersigp.fd .
if [[ -d interp_inc.fd ]]; then
rm -rf interp_inc.fd
fi
${LINK} gsi_utils.fd/src/netcdf_io/interp_inc.fd .
fi
if [[ -d gsi_monitor.fd ]]; then
if [[ -d oznmon_horiz.fd ]]; then
rm -rf oznmon_horiz.fd
fi
${LINK} gsi_monitor.fd/src/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd .
if [[ -d oznmon_time.fd ]]; then
rm -rf oznmon_time.fd
fi
${LINK} gsi_monitor.fd/src/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd .
if [[ -d radmon_angle.fd ]]; then
rm -rf radmon_angle.fd
fi
${LINK} gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd radmon_angle.fd
if [[ -d radmon_bcoef.fd ]]; then
rm -rf radmon_bcoef.fd
fi
${LINK} gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd radmon_bcoef.fd
if [[ -d radmon_bcor.fd ]]; then
rm -rf radmon_bcor.fd
fi
${LINK} gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd radmon_bcor.fd
if [[ -d radmon_time.fd ]]; then
rm -rf radmon_time.fd
fi
${LINK} gsi_monitor.fd/src/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd radmon_time.fd
fi
for prog in global_cycle.fd emcsfc_ice_blend.fd emcsfc_snow2mdl.fd; do
if [[ -d "${prog}" ]]; then
rm -rf "${prog}"
fi
${LINK} "ufs_utils.fd/sorc/${prog}" "${prog}"
done
for prog in enkf_chgres_recenter_nc.fd \
fbwndgfs.fd \
gaussian_sfcanl.fd \
gfs_bufr.fd \
mkgfsawps.fd \
overgridid.fd \
rdbfmsua.fd \
supvit.fd \
syndat_getjtbul.fd \
syndat_maksynrc.fd \
syndat_qctropcy.fd \
tave.fd \
tocsbufr.fd \
tref_calc.fd \
vint.fd \
webtitle.fd \
ocnicepost.fd; do
if [[ -d "${prog}" ]]; then rm -rf "${prog}"; fi
${LINK_OR_COPY} "gfs_utils.fd/src/${prog}" .
done
exit 0