Recurrent droughts caused by El Niño in Indonesia have a strong impact on both rice (Naylor, 2007) and oil palm cultivation. Mixing rice cultivation and palm trees in intercropping systems could alleviate those issues. The palm trees would be planted at lower density, and the rice would be grown during the wet season. The competition for water during dry periods could be reduced between palms thanks to a lower tree density, while sustaining the profitability for the stakeholders thanks to the production of rice in the interrow. The feasibility of such a system, however, requires adjusting the density of palm trees in the plantation to maintain a relatively high annual production of oil and rice using shade-adapted rice varieties.
The objective of this project is to evaluate the genetic variability of the tolerance to shade in rice to target varieties adapted to shade. Shade-tolerant rice varieties will be selected using an experimental set-up. The longer-term objective is to initiate a large-scale research project to test different palm-rice agroforestry systems and a rice breeding program adapted to these systems.
The experimental set-up consisted of rice plots grown under full sun or artificial shade. A net placed above the rice plots were used as artificial shade. In order to get a realistic level of shade, the nets were set-up to intercept as much light as intercepted by palm trees.
The ARCHIMED model was used to simulate the light transmitted by the palm trees to a plane at 1 meter above the ground. This modelling approach help to compute the light transmitted according to any planting design.
The modelling workflow follows several steps:
Design_plot
project)Setting the path to ARCHIMED on the system:
path_archimed= "D:/OneDrive/Travail_AMAP/ARCHIMED/Archimed_feb2019"
This path has to be adapted to where ARCHIMED is located in the computer.
We only simulate the ephemeris of march for this pre-study, at half-hourly time-step, clearness of 75% (i.e. sunny day), and mean temperature of 24:
timestep= 30*60 # 30 minutes
clearness= 0.75
sim_date= data.frame(date= as.POSIXct("2019-03-20"), clearness= 0.5)
The time steps will start from 05:00 to 18:30 by 30 minutes time-step. A dynamic of air temperature is generated from a minimum and maximum daily temperature (18 and 30°C resp.).
Hour= seq(from= as.POSIXct("2019-01-01 05:00:00"), by= timestep,
to = as.POSIXct("2019-01-01 18:30:00"))
# Dummy temperatures in the day:
Tair= archimedR::temperature_dynamic(Tmax = 30, Tmin = 18, per = (24*60*60)/timestep,
shift = 3*pi/2)[10:37]
Meteo=
expand.grid(date= sim_date$date, hour_start= Hour)%>%
arrange(date,hour_start)%>%
mutate(hour_end= format(hour_start+timestep,"%H:%M:%S"),
hour_start= format(hour_start,"%H:%M:%S"),
temperature= Tair,
relativeHumidity= 90,
clearness= clearness)%>%
mutate(date= format(date, "%Y/%m/%d"), wind= 3)
The meteo file is saved into the ARCHIMED input folders:
data.table::fwrite(
Meteo,sep=";",
file = file.path(path_archimed,'app_parameters/meteo/meteo_palm_rice.csv'))
and ARCHIMED is set to use it:
archimedR::set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "meteoFile", value = "app_parameters/meteo/meteo_palm_rice.csv")
site_location= list(Latitude= 0.9261918, Altitude = 45)
set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "latitude", value = site_location$Latitude)
set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "altitude", value = site_location$Altitude)
archimedR::set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "skySectors", value = 46)
archimedR::set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "numberOfPixels", value = 200000)
And finally the output directory:
sim_folder= "output_palm_rice"
set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "outputDirectory", value = sim_folder)
To simulate the different designs, we need first the 3D mock-ups of the palm trees (OPF files) and their planting design (OPS files).
We only need an average palm tree for this study, so we use the parameters from an average palm tree. The scene is made using VPalmr
. A less advanced user may prefer to make the scenes using VPALM-IDE instead.
Several files are imported :
The planting designs data.frames (*2).
The parameters input to VPALM, for each physiological age.
Creating and writing the OPF and OPS:
planting_designs= list.files("Designs/planting_design", full.names = TRUE)
palm_param_files= list.files("Designs/Palm_parameters", full.names = TRUE)
param_df=
expand.grid(param_file= palm_param_files,
design= planting_designs,stringsAsFactors = FALSE)%>%
mutate(name= basename(.data$design)%>%gsub(".csv","",.))
# Cleaning:
if(dir.exists("Designs/Vpalm_outputs")){
unlink("Designs/Vpalm_outputs", recursive = TRUE)
}
# Making the OPF and first OPS:
designs=
lapply(1:length(palm_param_files), function(x){
params= readRDS(param_df[x,1])
design= data.table::fread(file = param_df[x,2], data.table = FALSE)
# Making the scene:
scene=
Vpalmr::make_scene(data = params,
path = file.path("Designs","Vpalm_outputs"),
AMAPStudio = "Designs/vpalm.jar",
plot_design= design)
# Remove whole average:
list.files(file.path("Designs","Vpalm_outputs","scenes"),
full.names = TRUE)%>%
.[grep("Average_MAP",.)]%>%
unlink(x = .)
list.files(file.path("Designs","Vpalm_outputs","scenes","opf"),
full.names = TRUE)%>%
.[grep("Average_Average_MAP",.)]%>%
unlink(x = .)
})
# Rename scene folder:
file.rename("Designs/Vpalm_outputs/scenes","Designs/Vpalm_outputs/scenes_palm_rice")
# Rename OPS:
list.files(file.path("Designs","Vpalm_outputs","scenes_palm_rice"),
full.names = TRUE)%>%
.[grep(".ops",.)]%>%
file.rename(., {file.path(dirname(.),paste0(basename(.)%>%gsub("\\.ops",'',.),"_",param_df[1,3],".ops"))})
Adding the other designs OPS
param_df_others= param_df[-c(1:length(palm_param_files)),]
lapply(1:nrow(param_df_others), function(x){
design= data.table::fread(file = param_df_others[x,2], data.table = FALSE)
params= readRDS(param_df_others[x,1])
prog= unique(params$input$Parameter$Progeny)
map= params$input$MAP_requested
format_ops(design = design, Progeny = prog,
map = map, average = TRUE)%>%
write_ops(file.path("Designs","Vpalm_outputs","scenes_palm_rice",
paste0(prog, "_MAP_", map,"_",param_df_others[x,3], ".ops")),
overwrite = TRUE)
})
First we have to copy the 3D scene onto the ARCHIMED installation folder
scene_path= file.path(path_archimed,"app_parameters/scene/scenes_palm_rice")
if(!dir.exists(scene_path)){dir.create(scene_path)}
file.copy("Designs/Vpalm_outputs/scenes_palm_rice",dirname(scene_path),recursive = TRUE)
Then, running the simulation for each scene
parameters= list("xMin","yMin","xMax","yMax")
design_files= list.files(scene_path)%>%.[grep('.ops',.)]
# Cleaning the Output folder:
unlink(file.path(path_archimed,sim_folder), recursive = T)
# Reading the model manager:
model_manager= fread(file.path(path_archimed,"app_parameters/models_manager/models_palmtree.csv"), data.table = F)
# NB: if ARCHIMED did not complete the simulation and returned an error, open the OPS file and
# change the OPF files for ones that worked previously, run a simulation, change back the OPFs
# to the right ones and it may work.
tmp=
lapply(design_files, function(x){
# Set the scene boundaries:
density= x%>%strsplit(.,"_")%>%unlist()%>%.[grep(".ops",.)]%>%gsub(".ops","",.)
planting_design= data.table::fread(planting_designs[grep(density,basename(planting_designs))],
data.table = FALSE)
tmp=
lapply(parameters, function(z){
value= unique(planting_design[,grep(z,colnames(planting_design), ignore.case = TRUE)])
set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = z, value = value)
})
# Set the ops name:
path= file.path('app_parameters', "scene","scenes_palm_rice", x)
set_config(file = file.path(path_archimed,"app_parameters/ArchimedConfiguration.properties"),
parameter = "file", value = path)
# Updating the model manager:
model_manager$Node_id[model_manager$Group=="pavement"]= 2 + nrow(planting_design)
fwrite(model_manager,
file.path(path_archimed,"app_parameters/models_manager/models_palmtree.csv"),
sep = ";", quote = FALSE)
# Run ARCHIMED:
run_archimed(exe = file.path(path_archimed,"archimed-lib_florian-1.0.0.jar"), memory= 16384, config= "Archimed")
})%>%unlist()
# Test if the simulations ran successfully:
if(any(!tmp)){
warning(paste("Error during ARCHIMED simulation for:\n *",paste(names(tmp)[!tmp], collapse = "\n * ")))
}
Light transmitted to the soil throughout the day:
plane_df_step%>%
filter(Treatment== "DA1_MAP_72_inter11xintra9_d101" |
Treatment== "DA1_MAP_90_inter11xintra9_d101")%>%
ggplot(aes(x=x, y=y))+
facet_wrap(~paste0("Density: ",dens, ", Age: ",MAP)) +
geom_tile(aes(fill=irradiance*10^6))+
coord_fixed()+
labs(title = 'Hour: {frame_time}', x = 'x (m)', y = 'y (m)',
fill= "Irradiance (W m-2)") +
# scale_fill_gradientn(
# colours = rev(RColorBrewer::brewer.pal(5,name = "OrRd")),
# breaks=seq(0,13,3),
# limits = c(0,13))+
theme(legend.position="bottom")+
gganimate::transition_time(Date)
gganimate::anim_save(filename = 'map_light_rice_low_density.gif',path = "outputs")
plane_df_step%>%
filter(Treatment== "DA1_MAP_72_inter10xintra8_d125" |
Treatment== "DA1_MAP_90_inter10xintra8_d125")%>%
ggplot(aes(x=x, y=y))+
facet_wrap(~paste0("Density: ",dens, ", Age: ",MAP)) +
geom_tile(aes(fill=irradiance*10^6))+
coord_fixed()+
labs(title = 'Hour: {frame_time}', x = 'x (m)', y = 'y (m)',
fill= "Irradiance (W m-2)") +
# scale_fill_gradientn(
# colours = rev(RColorBrewer::brewer.pal(5,name = "OrRd")),
# breaks=seq(0,13,3),
# limits = c(0,13))+
theme(legend.position="bottom")+
gganimate::transition_time(Date)
gganimate::anim_save(filename = 'map_light_rice_high_density.gif',path = "outputs")
plane_df_step%>%
ggplot(aes(x=dist_tree, y=irradiance))+
facet_wrap(~paste0("Density: ",dens, ", Age: ",MAP)) +
geom_point(aes(color= irradiance*10^6), show.legend = FALSE)+
labs(title = 'Hour: {frame_time}', x = 'Distance to the closest palm tree (m)',
y = 'Irradiance (W m-2)')+
gganimate::transition_time(Date)+
gganimate::ease_aes('linear')