Skip to content

Commit

Permalink
Merge branch 'report-csv' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfrantz committed Jul 22, 2024
2 parents cad30c7 + 3c5d1ab commit 7afa89c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
25 changes: 18 additions & 7 deletions bash/force-level2-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ while :; do
-h|--help) help ;;
-v|--version) force_version; exit 0;;
-i|--info) echo "Generate Level 2 processing report"; exit 0;;
-o|--output) OUTPUT="$2"; shift ;;
-o|--output) OUTREPORT="$2"; shift ;;
-- ) shift; break ;;
* ) break ;;
esac
Expand All @@ -97,18 +97,29 @@ if [ ! -d $LOGDIR ]; then
echoerr "$LOGDIR does not exist."; help
fi

if [ -z "$OUTPUT" ]; then
if [ -z "$OUTREPORT" ]; then
if [ ! -w $LOGDIR ]; then
echoerr "$LOGDIR is not writeable."; help
fi
TIME=$(date +"%Y%m%d-%H%M%S")
OUTPUT="$LOGDIR/FORCE_L2PS_$TIME.html"
OUTREPORT="$LOGDIR/FORCE_L2PS_$TIME.html"
fi
export OUTPUT=$(readlink -f $OUTPUT) # absolute directory path
export OUTDIR=`dirname $OUTPUT`;

if [[ $OUTREPORT != *.html ]]; then
echoerr "$OUTREPORT extension must be .html"; help
fi
OUTREPORT=$(readlink -f "$OUTREPORT") # absolute directory path
export OUTREPORT

OUTTABLE="${OUTREPORT%.*}.csv"
export OUTTABLE

OUTDIR=$(dirname "$OUTREPORT")
export


debug "binary directory: $BIN"
debug "log directory: $LOGDIR"
debug "output: $OUTPUT"
debug "output: $OUTREPORT"

$REPORT_EXE -e "rmarkdown::render('$REPORT_TEMPLATE', output_file = '$OUTPUT', intermediates_dir = '$OUTDIR', params = list(dlog = '$LOGDIR'))"
$REPORT_EXE -e "rmarkdown::render('$REPORT_TEMPLATE', output_file = '$OUTREPORT', intermediates_dir = '$OUTDIR', params = list(dlog = '$LOGDIR', ftable = '$OUTTABLE'))"
5 changes: 5 additions & 0 deletions misc/force-level2-report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ date: "`r Sys.Date()`"
output: html_document
params:
dlog: "log"
ftable: NULL
---

```{r load-packages, include = FALSE}
Expand Down Expand Up @@ -466,3 +467,7 @@ fig <- plot_ly(data = data,
fig
```

```{r write-csv, echo = FALSE, warning = FALSE}
write.csv(data, file = ftable)
```

2 changes: 1 addition & 1 deletion misc/force-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.12-dev:::2024-07-19_12:05:02
3.7.12-dev:::2024-07-22_06:46:13

0 comments on commit 7afa89c

Please sign in to comment.