sc 114 library formatting and cleaning
This commit is contained in:
parent
85d2f11ed6
commit
5c29c9b549
|
|
@ -50,9 +50,9 @@
|
||||||
#
|
#
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
|
# Spatial data handling
|
||||||
library(terra)
|
library(terra) # For raster operations (reading/writing GeoTIFFs, cropping to field boundaries)
|
||||||
library(sf)
|
library(sf) # For spatial operations (reading field boundaries GeoJSON, masking)
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# LOAD CENTRALIZED PARAMETERS & PATHS
|
# LOAD CENTRALIZED PARAMETERS & PATHS
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,17 @@
|
||||||
# 1. Load required packages
|
# 1. Load required packages
|
||||||
# -----------------------
|
# -----------------------
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(sf)
|
# Spatial data handling
|
||||||
library(terra)
|
library(sf) # For reading/manipulating field boundaries (GeoJSON)
|
||||||
library(tidyverse)
|
library(terra) # For raster operations (CI extraction from TIFFs)
|
||||||
library(lubridate)
|
|
||||||
library(readxl)
|
# Data manipulation
|
||||||
library(here)
|
library(tidyverse) # For dplyr, ggplot2, readr (data wrangling and visualization)
|
||||||
library(furrr)
|
library(lubridate) # For date/time operations (parsing satellite dates)
|
||||||
library(future)
|
|
||||||
|
# File I/O
|
||||||
|
library(readxl) # For reading harvest.xlsx (harvest dates for field mapping)
|
||||||
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
})
|
})
|
||||||
|
|
||||||
# 2. Process command line arguments
|
# 2. Process command line arguments
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,13 @@
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(tidyverse)
|
# File path handling
|
||||||
library(lubridate)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(zoo)
|
|
||||||
library(here)
|
# Data manipulation
|
||||||
|
library(tidyverse) # For dplyr, readr (data wrangling and CSV I/O)
|
||||||
|
library(lubridate) # For date/time operations (DOY calculation)
|
||||||
|
library(zoo) # For zoo objects (gap filling, rolling operations)
|
||||||
})
|
})
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,12 @@
|
||||||
# 1. Load required packages
|
# 1. Load required packages
|
||||||
# -----------------------
|
# -----------------------
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(tidyverse)
|
# File path handling
|
||||||
library(lubridate)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(here)
|
|
||||||
|
# Data manipulation
|
||||||
|
library(tidyverse) # For dplyr (data wrangling, grouping, mutating)
|
||||||
|
library(lubridate) # For date/time operations (date arithmetic, ISO week extraction)
|
||||||
})
|
})
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,16 @@
|
||||||
# 1. Load required packages
|
# 1. Load required packages
|
||||||
# -----------------------
|
# -----------------------
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(sf)
|
# File path handling
|
||||||
library(terra)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(tidyverse)
|
|
||||||
library(lubridate)
|
# Spatial data handling
|
||||||
library(here)
|
library(sf) # For spatial operations (field boundary masking)
|
||||||
|
library(terra) # For raster operations (reading/writing/stacking GeoTIFFs)
|
||||||
|
|
||||||
|
# Data manipulation
|
||||||
|
library(tidyverse) # For dplyr, readr (data wrangling)
|
||||||
|
library(lubridate) # For date/time operations (week extraction, date formatting)
|
||||||
})
|
})
|
||||||
|
|
||||||
# 2. Process command line arguments and run mosaic creation
|
# 2. Process command line arguments and run mosaic creation
|
||||||
|
|
|
||||||
|
|
@ -127,23 +127,26 @@ WEEKS_FOR_CV_TREND_LONG <- 8
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(here)
|
# File path handling
|
||||||
library(sf)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(terra)
|
|
||||||
library(dplyr)
|
# Spatial data handling
|
||||||
library(tidyr)
|
library(sf) # For reading/manipulating field boundaries (GeoJSON)
|
||||||
library(lubridate)
|
library(terra) # For raster operations (reading mosaic TIFFs)
|
||||||
library(readr)
|
|
||||||
library(readxl)
|
# Data manipulation
|
||||||
library(writexl)
|
library(dplyr) # For data wrangling (filter, mutate, group_by, summarize)
|
||||||
library(purrr)
|
library(tidyr) # For data reshaping (pivot_longer, pivot_wider, gather)
|
||||||
library(furrr)
|
library(lubridate) # For date/time operations (week extraction, date arithmetic)
|
||||||
library(future)
|
|
||||||
library(caret)
|
# File I/O
|
||||||
library(CAST)
|
library(readr) # For reading CSV files (harvest predictions from Python)
|
||||||
library(randomForest)
|
library(readxl) # For reading harvest.xlsx (harvest dates for field mapping)
|
||||||
|
library(writexl) # For writing Excel outputs (KPI summary tables)
|
||||||
|
|
||||||
|
# ML/Analysis (optional - only for harvest model inference)
|
||||||
tryCatch({
|
tryCatch({
|
||||||
library(torch)
|
library(torch) # For PyTorch model inference (harvest readiness prediction)
|
||||||
}, error = function(e) {
|
}, error = function(e) {
|
||||||
message("Note: torch package not available - harvest model inference will be skipped")
|
message("Note: torch package not available - harvest model inference will be skipped")
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -38,21 +38,26 @@ reporting_script <- TRUE
|
||||||
|
|
||||||
# Load all packages at once with suppressPackageStartupMessages
|
# Load all packages at once with suppressPackageStartupMessages
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(here)
|
# File path handling
|
||||||
library(sf)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(terra)
|
|
||||||
library(tidyverse)
|
# Spatial data handling
|
||||||
library(tmap)
|
library(sf) # For reading/manipulating field boundaries (GeoJSON)
|
||||||
library(lubridate)
|
library(terra) # For raster operations (reading mosaic TIFFs for visualization)
|
||||||
library(zoo)
|
|
||||||
library(rsample)
|
# Data manipulation
|
||||||
library(caret)
|
library(tidyverse) # For dplyr, ggplot2, tidyr (data wrangling and visualization)
|
||||||
library(randomForest)
|
library(tidyr) # For data reshaping (pivot_longer, pivot_wider for wide-to-long conversion)
|
||||||
library(CAST)
|
library(lubridate) # For date/time operations (week extraction, date formatting)
|
||||||
library(knitr)
|
library(zoo) # For zoo objects (time series manipulation, na.locf for gap filling)
|
||||||
library(tidyr)
|
|
||||||
library(flextable)
|
# Visualization
|
||||||
library(officer)
|
library(tmap) # For interactive maps (field boundary visualization)
|
||||||
|
|
||||||
|
# Reporting
|
||||||
|
library(knitr) # For R Markdown document generation (code execution and output)
|
||||||
|
library(flextable) # For formatted tables in Word output (professional table styling)
|
||||||
|
library(officer) # For Word document manipulation (custom formatting, headers, footers)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Load custom utility functions
|
# Load custom utility functions
|
||||||
|
|
|
||||||
|
|
@ -38,20 +38,25 @@ reporting_script <- TRUE
|
||||||
|
|
||||||
# Load all packages at once with suppressPackageStartupMessages
|
# Load all packages at once with suppressPackageStartupMessages
|
||||||
suppressPackageStartupMessages({
|
suppressPackageStartupMessages({
|
||||||
library(here)
|
# File path handling
|
||||||
library(sf)
|
library(here) # For relative path resolution (platform-independent file paths)
|
||||||
library(terra)
|
|
||||||
library(tidyverse)
|
# Spatial data handling
|
||||||
library(tmap)
|
library(sf) # For reading/manipulating field boundaries (GeoJSON)
|
||||||
library(lubridate)
|
library(terra) # For raster operations (reading mosaic TIFFs for visualization)
|
||||||
library(zoo)
|
|
||||||
library(rsample)
|
# Data manipulation
|
||||||
library(caret)
|
library(tidyverse) # For dplyr, ggplot2, tidyr (data wrangling and visualization)
|
||||||
library(randomForest)
|
library(tidyr) # For data reshaping (pivot_longer, pivot_wider for wide-to-long conversion)
|
||||||
library(CAST)
|
library(lubridate) # For date/time operations (week extraction, date formatting)
|
||||||
library(knitr)
|
library(zoo) # For zoo objects (time series manipulation, na.locf for gap filling)
|
||||||
library(tidyr)
|
|
||||||
library(flextable)
|
# Visualization
|
||||||
|
library(tmap) # For interactive maps (field boundary visualization)
|
||||||
|
|
||||||
|
# Reporting
|
||||||
|
library(knitr) # For R Markdown document generation (code execution and output)
|
||||||
|
library(flextable) # For formatted tables in Word output (professional table styling)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Load custom utility functions
|
# Load custom utility functions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue