-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch_file.sh
37 lines (26 loc) · 1.09 KB
/
batch_file.sh
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
#!/bin/bash
#SBATCH --job-name=API_Runner
#SBATCH --cpus-per-task=1
#SBATCH --mem=16G
echo ============ Local environments ============ $(hostname) $(date)
source environment.sh
echo ============ Checking config file ==========
if ! jq -e . config.json >/dev/null 2>&1; then
echo "Config JSON file is nat valid:"; jq . config.json
return || exit
fi
if [ `jq ."job_number_max" config.json` -gt 1 ]; then
if [ -z $(which sbatch) ]; then
echo "'sbatch' command not found. In 'config.json' assign 1 for 'job_number_max' to proceed in serial."
return || exit
fi
fi
echo =============== Preparations =============== $(hostname) $(date)
source download.sh
python prep_data.py config.json || return || exit
echo =============== JSON queries =============== $(hostname) $(date)
## Download level of forest attributes from online source (EVALIDator)
if jq ."query_type" config.json | grep -q "coordinate"; then
python fia_coordinate.py config.json attributes.json coordinate.json || return || exit; fi
if jq ."query_type" config.json | grep -Pq "county|state"; then
python fia_county.py config.json attributes.json; fi