feat: add rain data audit and prediction scripts
This commit is contained in:
43
scripts/run_p0_rain_workflow.sh
Normal file
43
scripts/run_p0_rain_workflow.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SITE="${SITE:-home}"
|
||||
START="${START:-2026-02-01T00:00:00Z}"
|
||||
END="${END:-2026-03-03T23:55:00Z}"
|
||||
MODEL_VERSION="${MODEL_VERSION:-rain-logreg-v1}"
|
||||
MODEL_PATH="${MODEL_PATH:-models/rain_model.pkl}"
|
||||
REPORT_PATH="${REPORT_PATH:-models/rain_model_report.json}"
|
||||
AUDIT_PATH="${AUDIT_PATH:-models/rain_data_audit.json}"
|
||||
|
||||
if [[ -z "${DATABASE_URL:-}" ]]; then
|
||||
echo "DATABASE_URL is required"
|
||||
echo "example: export DATABASE_URL='postgres://postgres:postgres@localhost:5432/micrometeo?sslmode=disable'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running rain data audit..."
|
||||
python scripts/audit_rain_data.py \
|
||||
--site "$SITE" \
|
||||
--start "$START" \
|
||||
--end "$END" \
|
||||
--out "$AUDIT_PATH"
|
||||
|
||||
echo "Training baseline rain model..."
|
||||
python scripts/train_rain_model.py \
|
||||
--site "$SITE" \
|
||||
--start "$START" \
|
||||
--end "$END" \
|
||||
--train-ratio 0.7 \
|
||||
--val-ratio 0.15 \
|
||||
--min-precision 0.70 \
|
||||
--model-version "$MODEL_VERSION" \
|
||||
--out "$MODEL_PATH" \
|
||||
--report-out "$REPORT_PATH"
|
||||
|
||||
echo "Writing current prediction..."
|
||||
python scripts/predict_rain_model.py \
|
||||
--site "$SITE" \
|
||||
--model-path "$MODEL_PATH" \
|
||||
--model-name "rain_next_1h"
|
||||
|
||||
echo "P0 rain workflow complete."
|
||||
Reference in New Issue
Block a user