-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* modular scripts * make all_post_process executable * working on post_process * waiting for renv update to test * option to filter bad chains and workaround for command line * parse args * more command line args
- Loading branch information
1 parent
42c3891
commit cc7f156
Showing
2 changed files
with
130 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Check if the base directory is provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <base_dir>" | ||
exit 1 | ||
fi | ||
|
||
# Base directory containing subdirectories | ||
BASE_DIR="$1" | ||
|
||
|
||
# Iterate over each subdirectory in the base directory | ||
for SUBDIR in "$BASE_DIR"/*/; do | ||
# Run the R script with the current subdirectory as the model_dir argument | ||
echo "$SUBDIR" | ||
# will work once https://github.com/rstudio/renv/pull/2018 is merged | ||
Rscript -e "renv::run(\"post_process.R\", project = \"..\", args = c(\"--model_dir ${SUBDIR}\"))" | ||
done | ||
|
||
|
||
# # Get the name of the current directory (base_dir) | ||
base_dir_name=$(basename "$(pwd)") | ||
|
||
# Find all forecast_plot.pdf files and combine them using pdfunite | ||
find . -name "forecast_plot.pdf" | sort | xargs pdfunite - "${BASE_DIR}/${base_dir_name}_all_forecasts.pdf" | ||
|
||
echo "Combined PDF created: ${base_dir_name}_all_forecasts.pdf" |
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