Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bash/download-wvdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ CONFIG=$1
# parse config file
IMAGE=$("$BIN"/read-config.sh "FORCE_IMAGE" "$CONFIG")
DIR_WVP=$("$BIN"/read-config.sh "DIR_WVP" "$CONFIG")
USER_GROUP=$("$BIN"/read-config.sh "USER_GROUP" "$CONFIG" "$(id -u):$(id -g)")
DIR_CREDENTIALS=$("$BIN"/read-config.sh "DIR_CREDENTIALS" "$CONFIG" "$HOME")

# date
if [ $# -eq 1 ]; then
Expand All @@ -42,7 +44,7 @@ fi

echo "$YEAR $MONTH $DAY"

TEMPDIR="$DIR_WVP/hdf-$YEAR-$MONTH-$DAY"
TEMPDIR="$DIR_WVP/tmp/hdf-$YEAR-$MONTH-$DAY"

mkdir -p "$TEMPDIR"

Expand All @@ -51,14 +53,14 @@ docker run \
--rm \
-e FORCE_CREDENTIALS=/app/credentials \
-e BOTO_CONFIG=/app/credentials/.boto \
-v "$HOME:/app/credentials" \
-v "$DIR_CREDENTIALS:/app/credentials" \
-v /codede:/codede \
-v /data:/data \
-v /force:/force \
-v /mnt:/mnt \
-v "$HOME:$HOME" \
-w "$PWD" \
-u "$(id -u):$(id -g)" \
-u "$USER_GROUP" \
"$IMAGE" \
force-lut-modis \
-d "$YEAR$MONTH$DAY,$YEAR$MONTH$DAY" \
Expand Down
19 changes: 12 additions & 7 deletions bash/read-config.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash

# use: read-config.sh PARAMETER_NAME config.txt [DEFAULT_VALUE]
PROG=$(basename "$0")
#BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"


# get config file
if [ $# -ne 2 ] ; then
echo "wrong number of arguments" 1>&2;
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
echo "wrong number of arguments ($#)" 1>&2;
echo "1: tag" 1>&2;
echo "2: configuration file" 1>&2;
echo "3: default value (optional)" 1>&2
exit 1
fi

TAG=$1
CONFIG=$2
DEFAULT=$3

# config found?
if [ ! -r "$CONFIG" ]; then
Expand All @@ -26,8 +27,12 @@ VALUE=$(grep "^$TAG " "$CONFIG" | sed 's/.* *= *//')

# read successful?
if [ -z "$VALUE" ]; then
echo "$TAG not found in config.txt" 1>&2;
exit 1
if [ -n "$DEFAULT" ]; then
VALUE="$DEFAULT"
else
echo "$TAG not found in $CONFIG" 1>&2
exit 1
fi
fi

# print value
Expand Down
2 changes: 1 addition & 1 deletion bash/update-wvdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DIR_WVP=$("$BIN"/read-config.sh "DIR_WVP" "$CONFIG")

# start and end dates
#d=2000-02-24
d=2021-06-01
d=$("$BIN"/read-config.sh "WVP_START" "$CONFIG" "2021-06-01")
#d=2021-01-01
#d=2021-06-19
#d=$(date --date "30 days ago")
Expand Down
15 changes: 14 additions & 1 deletion config/config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
FORCE_IMAGE = davidfrantz/force:3.7.10
FORCE_IMAGE = davidfrantz/force:3.10.04

# overwrite user- and group id
# defaults to "$(id -u):$(id -g)"
# USER_GROUP = 1234:5678

# overwrite WVPD
# defaults to "2021-06-01", see update-wvdb.sh
# WVP_START =

# overwrite DIR_CREDENTIALS
# defaults to $HOME
# DIR_CREDENTIALS =

LANDSATLINKS_IMAGE = ernstste/landsatlinks

DIR_CSD_META = /data/ahsoka/dc/input
Expand Down