minor visualistion chagnes
This commit is contained in:
parent
b2fcd66d2b
commit
ea6842af48
|
|
@ -357,7 +357,8 @@ CI values typically range from 0 (bare soil or severely stressed vegetation) to
|
|||
|
||||
Use these insights to identify areas that may need irrigation, fertilization, or other interventions, and to track the effectiveness of your management practices over time.
|
||||
|
||||
\pagebreak
|
||||
\newpage
|
||||
|
||||
# RGB Satellite Image - Current Week (if available)
|
||||
```{r render_rgb_map, echo=FALSE, fig.height=7, fig.width=10, message=FALSE, warning=FALSE}
|
||||
# Check if RGB bands are available and create RGB map
|
||||
|
|
@ -440,6 +441,7 @@ tryCatch({
|
|||
```
|
||||
|
||||
\newpage
|
||||
|
||||
# Chlorophyll Index (CI) Overview Map - Current Week
|
||||
```{r render_ci_overview_map, echo=FALSE, fig.height=7, fig.width=10, message=FALSE, warning=FALSE}
|
||||
# Create overview chlorophyll index map
|
||||
|
|
@ -468,7 +470,6 @@ tryCatch({ # Base shape
|
|||
```
|
||||
|
||||
\newpage
|
||||
\pagebreak
|
||||
|
||||
# Weekly Chlorophyll Index Difference Map
|
||||
```{r render_ci_difference_map, echo=FALSE, fig.height=7, fig.width=10, message=FALSE, warning=FALSE}
|
||||
|
|
@ -498,9 +499,8 @@ tryCatch({ # Base shape
|
|||
```
|
||||
|
||||
\newpage
|
||||
\pagebreak
|
||||
|
||||
```{r generate_field_visualizations, eval=TRUE, fig.height=4.5, fig.width=12, message=FALSE,echo=FALSE, warning=FALSE, include=TRUE, results='asis'}
|
||||
```{r generate_field_visualizations, eval=TRUE, fig.height=3.8, fig.width=10, message=FALSE,echo=FALSE, warning=FALSE, include=TRUE, results='asis'}
|
||||
# Generate detailed visualizations for each field
|
||||
tryCatch({
|
||||
# Merge field polygons for processing
|
||||
|
|
@ -509,18 +509,24 @@ tryCatch({
|
|||
dplyr::summarise(.groups = 'drop')
|
||||
|
||||
# Generate plots for each field
|
||||
purrr::walk(AllPivots_merged$field, function(field_name) {
|
||||
tryCatch({
|
||||
cat("\n") # Add an empty line for better spacing
|
||||
for(i in seq_along(AllPivots_merged$field[1:3])) {
|
||||
field_name <- AllPivots_merged$field[i]
|
||||
|
||||
# Call ci_plot with explicit parameters
|
||||
tryCatch({
|
||||
# Add page break before each field (except the first one)
|
||||
if(i > 1) {
|
||||
cat("\\newpage\n\n")
|
||||
}
|
||||
|
||||
# Call ci_plot with explicit parameters (ci_plot will generate its own header)
|
||||
ci_plot(
|
||||
pivotName = field_name,
|
||||
field_boundaries = AllPivots0,
|
||||
current_ci = CI,
|
||||
ci_minus_1 = CI_m1,
|
||||
ci_minus_2 = CI_m2,
|
||||
last_week_diff = last_week_dif_raster_abs, three_week_diff = three_week_dif_raster_abs,
|
||||
last_week_diff = last_week_dif_raster_abs,
|
||||
three_week_diff = three_week_dif_raster_abs,
|
||||
harvesting_data = harvesting_data,
|
||||
week = week,
|
||||
week_minus_1 = week_minus_1,
|
||||
|
|
@ -529,7 +535,7 @@ tryCatch({
|
|||
borders = borders
|
||||
)
|
||||
|
||||
# cat("\n")
|
||||
cat("\n\n")
|
||||
|
||||
# Call cum_ci_plot with explicit parameters
|
||||
cum_ci_plot(
|
||||
|
|
@ -539,15 +545,18 @@ tryCatch({
|
|||
facet_on = FALSE
|
||||
)
|
||||
|
||||
cat("\n\n")
|
||||
|
||||
}, error = function(e) {
|
||||
safe_log(paste("Error generating plots for field", field_name, ":", e$message), "ERROR")
|
||||
cat(paste("## Error generating plots for field", field_name, "\n"))
|
||||
cat(paste(e$message, "\n"))
|
||||
cat("\\newpage\n\n")
|
||||
cat("# Error generating plots for field ", field_name, "\n\n")
|
||||
cat(e$message, "\n\n")
|
||||
})
|
||||
})
|
||||
}
|
||||
}, error = function(e) {
|
||||
safe_log(paste("Error in field visualization section:", e$message), "ERROR")
|
||||
cat("Error generating field plots. See log for details.\n")
|
||||
cat("Error generating field plots. See log for details.\n\n")
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -271,13 +271,13 @@ ci_plot <- function(pivotName,
|
|||
nrow = 1, widths = c(0.23, 0.18, 0.18, 0.18, 0.23))
|
||||
|
||||
# Output heading and map to R Markdown
|
||||
cat(paste("## Field", pivotName, "-", age, "weeks after planting/harvest", "\n"))
|
||||
cat(paste("## Field", pivotName, "-", age, "weeks after planting/harvest", "\n\n"))
|
||||
print(tst)
|
||||
|
||||
}, error = function(e) {
|
||||
safe_log(paste("Error creating CI plot for pivot", pivotName, ":", e$message), "ERROR")
|
||||
cat(paste("## Field", pivotName, "- Error creating visualization", "\n"))
|
||||
cat(paste("Error:", e$message, "\n"))
|
||||
cat(paste("# Field", pivotName, "- Error creating visualization", "\n\n"))
|
||||
cat(paste("Error:", e$message, "\n\n"))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ cum_ci_plot <- function(pivotName, ci_quadrant_data = CI_quadrant, plot_type = "
|
|||
}
|
||||
|
||||
# Output plot to R Markdown with reduced height
|
||||
subchunkify(g, 3.2, 10) # Reduced from 3.2 to 2.8
|
||||
subchunkify(g, 2.8, 10) # Reduced from 3.2 to 2.8
|
||||
|
||||
}, error = function(e) {
|
||||
safe_log(paste("Error creating CI trend plot for pivot", pivotName, ":", e$message), "ERROR")
|
||||
|
|
|
|||
Loading…
Reference in a new issue