Update reference document path in report output configuration
This commit is contained in:
parent
df2fb8bf7f
commit
23bbd7b450
|
|
@ -13,7 +13,8 @@ params:
|
||||||
x_axis_unit: "days"
|
x_axis_unit: "days"
|
||||||
output:
|
output:
|
||||||
word_document:
|
word_document:
|
||||||
reference_docx: !expr params$ref toc: no
|
reference_docx: !expr file.path("word-styles-reference-var1.docx")
|
||||||
|
toc: no
|
||||||
editor_options:
|
editor_options:
|
||||||
chunk_output_type: console
|
chunk_output_type: console
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -461,179 +461,3 @@ rmarkdown::render(
|
||||||
output_dir = "laravel_app/storage/app/angata/reports"
|
output_dir = "laravel_app/storage/app/angata/reports"
|
||||||
)
|
)
|
||||||
#
|
#
|
||||||
# EXPECTED OUTPUT:
|
|
||||||
# File: SmartCane_Report_*_{PROJECT}_{DATE}.docx
|
|
||||||
# Location: laravel_app/storage/app/{PROJECT}/reports/
|
|
||||||
# Script execution time: 5-10 minutes
|
|
||||||
#
|
|
||||||
# NOTE:
|
|
||||||
# These are R Markdown files and cannot be run directly via Rscript
|
|
||||||
# Use rmarkdown::render() from an R interactive session or wrapper script
|
|
||||||
# See run_full_pipeline.R for an automated example
|
|
||||||
#
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# QUICK REFERENCE: Common Workflows
|
|
||||||
# ==============================================================================
|
|
||||||
#
|
|
||||||
# WORKFLOW A: Weekly Update (Most Common)
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
# Goal: Process latest week of data through full pipeline
|
|
||||||
#
|
|
||||||
# Parameters:
|
|
||||||
# $PROJECT = "angata"
|
|
||||||
# $END_DATE = "2026-02-04" # Today or latest date available
|
|
||||||
# $OFFSET = 7 # One week back
|
|
||||||
#
|
|
||||||
# Steps:
|
|
||||||
# 1. SKIP Python download (if you already have data)
|
|
||||||
# 2. Run R10: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/10_create_per_field_tiffs.R angata 2026-02-04 7
|
|
||||||
# (Argument order: [PROJECT] [END_DATE] [OFFSET])
|
|
||||||
# 3. Run R20: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/20_ci_extraction_per_field.R angata 2026-02-04 7
|
|
||||||
# 4. Run R30: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/30_interpolate_growth_model.R angata
|
|
||||||
# 5. Run R21: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/21_convert_ci_rds_to_csv.R angata
|
|
||||||
# 6. Run R40: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/40_mosaic_creation_per_field.R 2026-02-04 7 angata
|
|
||||||
# (Argument order: [END_DATE] [OFFSET] [PROJECT])
|
|
||||||
# 7. Run R80: & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/80_calculate_kpis.R 2026-02-04 angata 7
|
|
||||||
# (Argument order: [END_DATE] [PROJECT] [OFFSET] - DIFFERENT from R40!)
|
|
||||||
# 8. OPTIONAL R91 (Cane Supply) - Use automated runner:
|
|
||||||
# & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/run_full_pipeline.R
|
|
||||||
# OR from R console:
|
|
||||||
# rmarkdown::render("r_app/91_CI_report_with_kpis_cane_supply.Rmd",
|
|
||||||
# params=list(data_dir="angata", report_date=as.Date("2026-02-04")),
|
|
||||||
# output_file="SmartCane_Report_cane_supply_angata_2026-02-04.docx",
|
|
||||||
# output_dir="laravel_app/storage/app/angata/reports")
|
|
||||||
#
|
|
||||||
# Execution time: ~60-90 minutes total
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# WORKFLOW B: Initial Setup (Large Backfill)
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
# Goal: Process multiple weeks of historical data
|
|
||||||
#
|
|
||||||
# Steps:
|
|
||||||
# 1. Python download (your entire date range)
|
|
||||||
# 2. Run R10 with large offset to process all historical dates:
|
|
||||||
# & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/10_create_per_field_tiffs.R angata 2026-02-04 365
|
|
||||||
# (This processes from 2025-02-04 to 2026-02-04, covering entire year)
|
|
||||||
# 3. Run R20 with large offset to process all historical dates:
|
|
||||||
# & "C:\Program Files\R\R-4.4.3\bin\x64\Rscript.exe" r_app/20_ci_extraction_per_field.R angata 2026-02-04 365
|
|
||||||
# (This processes from 2025-02-04 to 2026-02-04, covering entire year)
|
|
||||||
# 4. Run R30 once (growth model full season)
|
|
||||||
# 5. Run R21 once (CSV export)
|
|
||||||
# 6. Run R40 with specific week windows as needed
|
|
||||||
# 7. Run R80 for each week you want KPIs for
|
|
||||||
|
|
||||||
# 6. For each week, run:
|
|
||||||
# - R40 with different END_DATE values (one per week)
|
|
||||||
# - R80 with different WEEK/YEAR values (one per week)
|
|
||||||
# - R91 optional (one per week report)
|
|
||||||
#
|
|
||||||
# Pro tip: Script R40 with offset=14 covers two weeks at once
|
|
||||||
# Then R40 again with offset=7 for just one week
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# WORKFLOW C: Troubleshooting (Check Intermediate Outputs)
|
|
||||||
# ─────────────────────────────────────────────────────────────────────────
|
|
||||||
# Goal: Verify outputs before moving to next step
|
|
||||||
#
|
|
||||||
# After R10: Check field_tiles/{FIELD_ID}/ has #dates files
|
|
||||||
# After R20: Check field_tiles_CI/{FIELD_ID}/ has same #dates files
|
|
||||||
# After R30: Check Data/extracted_ci/cumulative_vals/ has All_pivots_*.rds
|
|
||||||
# After R40: Check weekly_mosaic/{FIELD_ID}/ has week_WW_YYYY.tif per week
|
|
||||||
# After R80: Check output/ has {PROJECT}_field_analysis_week*.xlsx
|
|
||||||
#
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# TROUBLESHOOTING
|
|
||||||
# ==============================================================================
|
|
||||||
#
|
|
||||||
# ISSUE: R20 not processing all field_tiles files
|
|
||||||
# ────────────────────────────────────────────────
|
|
||||||
# Symptom: field_tiles has 496 files, field_tiles_CI only has 5
|
|
||||||
#
|
|
||||||
# Possible causes:
|
|
||||||
# 1. Source files incomplete or corrupted
|
|
||||||
# 2. Script 20 skips because CI TIFF already exists (even if incomplete)
|
|
||||||
# 3. Partial run from previous attempt
|
|
||||||
#
|
|
||||||
# Solutions:
|
|
||||||
# 1. Delete the small number of files in field_tiles_CI/{FIELD}/ (don't delete all!)
|
|
||||||
# rm laravel_app/storage/app/angata/field_tiles_CI/{fieldnum}/*
|
|
||||||
# 2. Re-run Script 20
|
|
||||||
# 3. If still fails, delete field_tiles_CI completely and re-run Script 20
|
|
||||||
# rm -r laravel_app/storage/app/angata/field_tiles_CI/
|
|
||||||
#
|
|
||||||
# ISSUE: Script 80 says "No per-field mosaic files found"
|
|
||||||
# ────────────────────────────────────────────────────────
|
|
||||||
# Symptom: R80 fails to calculate KPIs
|
|
||||||
#
|
|
||||||
# Possible causes:
|
|
||||||
# 1. Script 40 hasn't run yet (weekly_mosaic doesn't exist)
|
|
||||||
# 2. Wrong END_DATE or WEEK/YEAR combination
|
|
||||||
# 3. weekly_mosaic/{FIELD}/ directory missing (old format?)
|
|
||||||
#
|
|
||||||
# Solutions:
|
|
||||||
# 1. Ensure Script 40 has completed: Check weekly_mosaic/{FIELD}/ exists with week_WW_YYYY.tif
|
|
||||||
# 2. Verify END_DATE is within date range of available CI data
|
|
||||||
# 3. For current week: End date must be THIS week (same ISO week as today)
|
|
||||||
#
|
|
||||||
# ISSUE: Python download fails ("Not authorized")
|
|
||||||
# ────────────────────────────────────────────────
|
|
||||||
# Symptom: python 00_download_8band_pu_optimized.py fails with authentication error
|
|
||||||
#
|
|
||||||
# Cause: PLANET_API_KEY environment variable not set
|
|
||||||
#
|
|
||||||
# Solution:
|
|
||||||
# 1. Save your Planet API key: $env:PLANET_API_KEY = "your_key_here"
|
|
||||||
# 2. Verify: $env:PLANET_API_KEY (should show your key)
|
|
||||||
# 3. Try download again
|
|
||||||
#
|
|
||||||
# ISSUE: R30 takes too long
|
|
||||||
# ──────────────────────────
|
|
||||||
# Symptom: Script 30 running for >30 minutes
|
|
||||||
#
|
|
||||||
# Cause: LOESS interpolation is slow with many dates/fields
|
|
||||||
#
|
|
||||||
# Solution:
|
|
||||||
# 1. This is normal - large date ranges slow down interpolation
|
|
||||||
# 2. Subsequent runs are faster (cached results)
|
|
||||||
# 3. If needed: reduce offset or run fewer weeks at a time
|
|
||||||
#
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# SUMMARY OF FILES CREATED BY EACH SCRIPT
|
|
||||||
# ==============================================================================
|
|
||||||
#
|
|
||||||
# Script 10 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/field_tiles/{FIELD}/{DATE}.tif
|
|
||||||
#
|
|
||||||
# Script 20 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/field_tiles_CI/{FIELD}/{DATE}.tif
|
|
||||||
# laravel_app/storage/app/{PROJECT}/Data/extracted_ci/daily_vals/{FIELD}/{DATE}.rds
|
|
||||||
#
|
|
||||||
# Script 30 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/Data/extracted_ci/cumulative_vals/All_pivots_Cumulative_CI_quadrant_year_v2.rds
|
|
||||||
#
|
|
||||||
# Script 21 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/ci_data_for_python.csv
|
|
||||||
#
|
|
||||||
# Python 31 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/reports/kpis/field_stats/{PROJECT}_harvest_imminent_week_{WW}_{YYYY}.csv
|
|
||||||
#
|
|
||||||
# Script 40 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/weekly_mosaic/{FIELD}/{DATE}/week_{WW}_{YYYY}.tif
|
|
||||||
#
|
|
||||||
# Script 80 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/output/{PROJECT}_field_analysis_week{WW}_{YYYY}.xlsx
|
|
||||||
# laravel_app/storage/app/{PROJECT}/output/{PROJECT}_field_analysis_week{WW}_{YYYY}.rds
|
|
||||||
#
|
|
||||||
# Script 90/91 creates:
|
|
||||||
# laravel_app/storage/app/{PROJECT}/output/SmartCane_Report_week{WW}_{YYYY}.docx
|
|
||||||
#
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue