forked from NOAA-OWP/nwm-rte
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_data.sh
More file actions
executable file
·59 lines (49 loc) · 2.21 KB
/
Copy pathsetup_data.sh
File metadata and controls
executable file
·59 lines (49 loc) · 2.21 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
#!/bin/bash
set -euo pipefail
source config.bashrc
##
## \brief
## Download various global input data, as well as specific input data for one example gage.
##
## \desc
## Download input data from S3 and from APIs. Not needed for the "default" gage at the "default" realization, since those inputs are included in the repository.
## Calls `./setup_data_one_gage.sh` for the default gage ID.
##
## Uses various OS env vars from `config.bashrc`.
##
## Has 0 positional arguments and 2 named arguments.
##
## \option -a, --api-environment
## For EDFS API URL for nwm-rte setup scripts. Used to construct URL subdomain. Not used during ngen runtime. See -e, --environment in the ngen runtime CLI scripts.
## Default: 'test'. Common choices: ['test', 'oe'].
##
## \option -r, --regionalization
## If provided, extra data will be downloaded for the regionalization workflow. Should be ran *after* cloning the `nwm-region-mgr` repository.
##
## \usage ./setup_data.sh
## \usage ./setup_data.sh -a 'oe'
## \usage ./setup_data.sh -a 'test' -r
## \usage ./setup_data.sh -a 'oe' -r
##
# Parse named arg -a, --api-environment
if [[ "$@" =~ (--api-environment|-a)[[:space:]]+([^ ]+) ]]; then
EDFS_API_ENVIRONMENT="${BASH_REMATCH[2]}"
else
EDFS_API_ENVIRONMENT="test"
fi
mkdir_p "${RUN_NGEN_ROOT__HOST}"
# Download regionalization data
# Check if --regionalization or -r flag (argument) is passed
if [[ "$@" =~ (--regionalization|-r) ]]; then
s3_sync "${SOURCE_BUCKET_DEV}/${SOURCE_PREFIX_ROOT}/regionalization/data/inputs" "${MNT__NWM_REGION_MGR__INPUT_DATA}"
fi
# Download test gage data using setup_data_one_gage.sh
./setup_data_one_gage.sh "${TEST_GAGE}" "${TEST_DOMAIN}" "${EDFS_API_ENVIRONMENT}"
# Download calibration parameterization files
s3_sync "${SOURCE_BUCKET_DEV}/${SOURCE_PREFIX_ROOT}/calib_params_tab_delimited" "${RUN_NGEN_ROOT__HOST}/data/calib_params_tab_delimited"
# Download ESMF mesh files for NWM forcing (CONUS and oCONUS)
s3_sync "${SOURCE_BUCKET_DEV}/${SOURCE_PREFIX_ROOT}/esmf/esmf_mesh" "${RUN_NGEN_ROOT__HOST}/data/esmf_mesh"
# Download RFC reservoir gage timeseries data
s3_sync "${SOURCE_BUCKET_DEV}/${SOURCE_PREFIX_ROOT}/rfc/reservoirs/timeseries" "${RUN_NGEN_ROOT__HOST}/data/rfc/reservoirs/timeseries"
set -x
exit 0