Skip to content
Snippets Groups Projects
Commit 93394c81 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Add virtualenv, use of .env and logging

parent 5e1f7cb3
No related branches found
No related tags found
No related merge requests found
*.nc *.nc
*.tif *.tif
*.tif.aux.xml *.tif.aux.xml
.env
.venv
mapfile/SEPTREFHUM.map mapfile/SEPTREFHUM.map
*
*/
!.gitignore
\ No newline at end of file
Jinja2
netCDF4
pytz
\ No newline at end of file
#!/bin/bash
# First: Test that we have CDO and GDAL installed
if ! command -v cdo &> /dev/null
then
echo "ERROR: CDO could not be found. Exiting."
exit
fi
if ! command -v gdal_merge.py &> /dev/null
then
echo "ERROR: GDAL is either not installed, or not built with Python support. Exiting."
exit
fi
# Defines HOME_DIR
source .env
# Paths to scripts and requirements
APP_PATH=$HOME_DIR/SEPTREFHUM
LOG_FILE=$APP_PATH/log/SEPTREFHUM.log
REQUIREMENTS=$APP_PATH/requirements.txt
cd $APP_PATH
# Create and activate the virtual environment
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
pip install -r $REQUIREMENTS
# Run the model
echo "==== `date`: Running model" &>> "$LOG_FILE"
python3 $APP_PATH/SEPTREFHUM.py &>> "$LOG_FILE"
echo "==== `date`: DONE running model" &>> "$LOG_FILE"
# Deactivate the virtual environment
deactivate
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment