-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_rfields.sh
executable file
·56 lines (46 loc) · 1.52 KB
/
gen_rfields.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Print execution date time
echo `date`
echo "Changing into ~/wrf_data_pusher"
cd /home/uwcc-admin/curw_wrf_data_pusher
echo "Inside `pwd`"
# If no venv (python3 virtual environment) exists, then create one.
if [ ! -d "venv" ]
then
echo "Creating venv python3 virtual environment."
virtualenv -p python3 venv
fi
# Activate venv.
echo "Activating venv python3 virtual environment."
source venv/bin/activate
# Install dependencies using pip.
if [ ! -f "db.log" ]
then
echo "Installing numpy"
pip install numpy
echo "Installing netCDF4"
pip install netCDF4
echo "Installing cftime"
pip install cftime
echo "Installing PyMySQL"
pip install PyMySQL
echo "Installing PyYAML"
pip install PyYAML
echo "Installing data layer"
# pip install git+https://github.com/shadhini/curw_db_adapter.git -U
pip install git+https://github.com/shadhini/curw_db_adapter.git
fi
config_file_path=$1
wrf_root_directory=$2
gfs_run=$3
gfs_data_hour=$4
wrf_system=$5
date=$6
## Push WRFv4 data into the database
echo "Running scripts to generate rfields. Logs Available in rfields.log file."
echo "Params passed:: config_file_path=$config_file_path, wrf_root_directory=$wrf_root_directory, gfs_run=$gfs_run,
gfs_data_hour=$gfs_data_hour, wrf_system=$wrf_system, date=$date"
./gen_rfields.py -c $config_file_path -d $wrf_root_directory -r $gfs_run -H $gfs_data_hour -s $wrf_system -D $date >> rfields.log 2>&1
# Deactivating virtual environment
echo "Deactivating virtual environment"
deactivate