-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from uw-ssec/carlos/issue75
feat: Support data transformation "verbs" in the docker container #77
- Loading branch information
Showing
7 changed files
with
104 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ Imports: | |
logger, | ||
tidyverse, | ||
optparse, | ||
here | ||
here, | ||
stars | ||
Suggests: | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
source run_container.sh | ||
|
||
if [ $# -lt 2 ]; then | ||
echo "usage: $0 <data_dir> <output_dir> <extra-args>" | ||
exit 1 | ||
fi | ||
|
||
DATA_DIR=$1 | ||
OUT_DIR=$2 | ||
shift 2 | ||
run_with_mounts $DATA_DIR $OUT_DIR exposure -d data-raw $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
source run_container.sh | ||
|
||
if [ $# -lt 2 ]; then | ||
echo "Usage: $0 <input_file> <output__file> <extra-args>" | ||
exit 1 | ||
fi | ||
INPUT_FILE=$1 | ||
OUT_FILE=$2 | ||
shift 2 | ||
run_with_mounts $(dirname $INPUT_FILE) $(dirname $OUT_FILE) \ | ||
shp2rds -i ./data-raw/$(basename $INPUT_FILE) \ | ||
-o ./outputs/$(basename $OUT_FILE) $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
#!/bin/bash | ||
# This script runs the Docker container with the provided directories for input and output data | ||
# CONTAINER=biodiv # for development, change this to the name of your local Docker ccontainer build | ||
CONTAINER=ghcr.io/uw-ssec/biodiversity-horizons | ||
|
||
# Check if two arguments are provided | ||
if [ "$#" -lt 2 ]; then | ||
echo "Usage: $0 <data dir> <output dir>" | ||
exit 1 | ||
fi | ||
function run_with_mounts() { | ||
|
||
# Assign arguments to variables | ||
DATA_DIR=$1 | ||
OUT_DIR=$2 | ||
shift 2 | ||
# run the container with the given directories mounted as volumes | ||
# and then pass any additional arguments to the container | ||
DATA_DIR=$1 | ||
OUT_DIR=$2 | ||
shift 2 | ||
|
||
# Check if directories exist | ||
if [ ! -d "$DATA_DIR" ]; then | ||
echo "Error: Directory $DATA_DIR does not exist." | ||
exit 1 | ||
fi | ||
# Check if directories exist | ||
if [ ! -d "$DATA_DIR" ]; then | ||
echo "Error: Directory $DATA_DIR does not exist." | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d "$OUT_DIR" ]; then | ||
echo "Warning: Directory $OUT_DIR does not exist, creating it ..." | ||
mkdir -p "$OUT_DIR" | ||
fi | ||
if [ ! -d "$OUT_DIR" ]; then | ||
echo "Warning: Directory $OUT_DIR does not exist, creating it ..." | ||
mkdir -p "$OUT_DIR" | ||
fi | ||
|
||
# Run the Docker container with the provided directories mounted as volumes | ||
# TODO: Replace with the published Docker image name | ||
docker run -v "$DATA_DIR":/home/biodiversity-horizons/data-raw \ | ||
-v "$OUT_DIR":/home/biodiversity-horizons/outputs \ | ||
ghcr.io/uw-ssec/biodiversity-horizons $* # Pass any additional arguments to the Docker container | ||
docker run -v "$DATA_DIR":/home/biodiversity-horizons/data-raw \ | ||
-v "$OUT_DIR":/home/biodiversity-horizons/outputs \ | ||
$CONTAINER $* # Pass any additional arguments to the Docker container | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters