fixed plot colouring and made ci_extraction resilient against none file;
This commit is contained in:
parent
c8ef406545
commit
576250982c
|
|
@ -343,7 +343,7 @@ ggplot(pred_ffs_rf, aes(y = predicted_Tcha, x = tonnage_ha)) +
|
||||||
y = "Predicted tonnage/ha (Tcha)") +
|
y = "Predicted tonnage/ha (Tcha)") +
|
||||||
theme_minimal()
|
theme_minimal()
|
||||||
|
|
||||||
ggplot(pred_rf_current_season, aes(x = Age_days, y = predicted_Tcha, col = field)) +
|
ggplot(pred_rf_current_season, aes(x = Age_days, y = predicted_Tcha)) +
|
||||||
geom_point(size = 2, alpha = 0.6) + # Adjust point size and transparency
|
geom_point(size = 2, alpha = 0.6) + # Adjust point size and transparency
|
||||||
labs(title = "Predicted Yields for Fields Over 300 Days \nOld Yet to Be Harvested",
|
labs(title = "Predicted Yields for Fields Over 300 Days \nOld Yet to Be Harvested",
|
||||||
x = "Age (days)",
|
x = "Age (days)",
|
||||||
|
|
|
||||||
BIN
r_app/Rplots.pdf
BIN
r_app/Rplots.pdf
Binary file not shown.
|
|
@ -48,11 +48,23 @@ raster_files <- list.files(planet_tif_folder,full.names = T, pattern = ".tif")
|
||||||
filtered_files <- map(dates$days_filter, ~ raster_files[grepl(pattern = .x, x = raster_files)]) %>%
|
filtered_files <- map(dates$days_filter, ~ raster_files[grepl(pattern = .x, x = raster_files)]) %>%
|
||||||
compact() %>%
|
compact() %>%
|
||||||
flatten_chr()
|
flatten_chr()
|
||||||
head(filtered_files)
|
|
||||||
|
# Remove files that do not exist
|
||||||
|
existing_files <- filtered_files[file.exists(filtered_files)]
|
||||||
|
|
||||||
|
# Check if the list of existing files is empty
|
||||||
|
if (length(existing_files) == 0) {
|
||||||
|
message("No files exist for the given date(s).")
|
||||||
|
stop("Terminating script.")
|
||||||
|
}
|
||||||
|
|
||||||
|
# Continue with the rest of the script
|
||||||
|
print(existing_files)
|
||||||
|
|
||||||
|
|
||||||
vrt_list <- list()
|
vrt_list <- list()
|
||||||
|
|
||||||
for (file in filtered_files) {
|
for (file in existing_files) {
|
||||||
v_crop <- create_mask_and_crop(file, field_boundaries, merged_final)
|
v_crop <- create_mask_and_crop(file, field_boundaries, merged_final)
|
||||||
emtpy_or_full <- global(v_crop, "notNA")
|
emtpy_or_full <- global(v_crop, "notNA")
|
||||||
|
|
||||||
|
|
@ -109,7 +121,7 @@ if (!file.exists(file_path)) {
|
||||||
extracted_values <- map(dates$days_filter, ~ extracted_values[grepl(pattern = .x, x = extracted_values)]) %>%
|
extracted_values <- map(dates$days_filter, ~ extracted_values[grepl(pattern = .x, x = extracted_values)]) %>%
|
||||||
compact() %>%
|
compact() %>%
|
||||||
flatten_chr()
|
flatten_chr()
|
||||||
|
|
||||||
pivot_stats <- extracted_values %>%
|
pivot_stats <- extracted_values %>%
|
||||||
map(readRDS) %>% list_rbind() %>%
|
map(readRDS) %>% list_rbind() %>%
|
||||||
group_by(sub_field)
|
group_by(sub_field)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue