From b1931caf5c4bf236077ba0275bc125d385a275b2 Mon Sep 17 00:00:00 2001 From: Ishika Date: Thu, 27 Feb 2025 15:31:00 -0800 Subject: [PATCH] add docker_climatearray2rds.sh --- docker_climatearray2rds.sh | 19 +++++++++++++++++++ scripts/main.R | 16 ---------------- 2 files changed, 19 insertions(+), 16 deletions(-) create mode 100755 docker_climatearray2rds.sh diff --git a/docker_climatearray2rds.sh b/docker_climatearray2rds.sh new file mode 100755 index 0000000..25b3db5 --- /dev/null +++ b/docker_climatearray2rds.sh @@ -0,0 +1,19 @@ +#!/bin/bash +source run_container.sh + +# Check for required arguments +if [ $# -lt 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Convert relative paths to absolute paths +INPUT_DIR=$(realpath "$1") +OUT_DIR=$(realpath "$2") + +shift 2 + +# Run the container with mounted directories +run_with_mounts "$INPUT_DIR" "$OUT_DIR" \ +climatearray2rds -i /home/biodiversity-horizons/data-raw \ +-o /home/biodiversity-horizons/outputs "$@" diff --git a/scripts/main.R b/scripts/main.R index f9d4e91..f0dc735 100644 --- a/scripts/main.R +++ b/scripts/main.R @@ -196,22 +196,6 @@ run_climatearray2rds <- function(args) { print("File converted successfully!") } -safe_parse_opts <- function(opt_parser, args) { - # Function to safely parse the options. Shows the help if there's an error. - opt <- tryCatch( - { - opt <- parse_args(opt_parser, args = args) - opt - }, - error = function(e) { - cat("Error parsing arguments:", e$message, "\n") - opt <- parse_args(opt_parser, args = c("--help")) - FALSE - } - ) - return(opt) -} - run_exposure <- function(args) { source("scripts/exposure_workflow.R") option_list <- list(