DIFM-Brain / ofpetrial

GNU General Public License v3.0
0 stars 1 forks source link

cascading rates #29

Closed tmieno2 closed 4 months ago

brittanikedge commented 4 months ago

@tmieno2 Is this the issue with the error with the diagonal pattern being created? I noticed today that it seems to happen when the number of levels is between 3 and 5.

tmieno2 commented 4 months ago

Yes, this is about that. Sorry, could you share the field you had problem with again or point me to the files you already shared (the one for Haiying)?

brittanikedge commented 4 months ago

Actually, I even see it on the boundary and abline that are in the package data. Here is the code I was looking at today:

`devtools::load_all()

seed_plot_info <- prep_plot( input_name = "seed", unit_system = "imperial", machine_width = 60, section_num = 24, harvester_width = 30, plot_width = 30, headland_length = 60, side_length = 60 )

input_plot_info <- list(seed_plot_info)

exp_data <- make_exp_plots( input_plot_info = input_plot_info, boundary_data = system.file("extdata", "boundary-simple1.shp", package = "ofpetrial"), abline_data = system.file("extdata", "ab-line-simple1.shp", package = "ofpetrial"), abline_type = "free" )

seed_rate_info <- prep_rate( plot_info = seed_plot_info, gc_rate = 30000, unit = "seed", min_rate = 16000, max_rate = 40000, num_rates = 5, rates = NULL, design_type = "ls" )

td <- assign_rates(exp_data, rate_info = list(seed_rate_info))

viz(td) `

brittanikedge commented 4 months ago

@tmieno2 When num_rates = 3, 4, or 5 there is a cascade because with pattern in the horizontal and vertical directions is the same. That seems to change when num_rates = 6.

tmieno2 commented 4 months ago

Got it. I wrote codes to avoid explicitly that and it is still happening. Haha. Obviously, something is wrong. I will take a look.

tmieno2 commented 4 months ago

Okay, my code was not avoiding having the same rate diagonally (obviously) just checking the rates horizontally. Please test the code. Also, when number of rates is 3, it is simply impossible to avoid the problem.

brittanikedge commented 4 months ago

@tmieno2 Okay, I'll pull these changes and test on a few fields and rates. Yes, with three rates, there is nothing to be done.

brittanikedge commented 4 months ago

@tmieno2 I've been working on another issue using a one input trial, but when I test the new edits on a 2 input trial I see the following error:

Error indplyr::mutate(): ℹ In argument:experiment_design = list(...). ℹ In row 1. Caused by error inFUN(): ! object 'mat_dif_diag' not found

I'll look into this more, but for now, I just know that it appears with the following two input example:

`seed_plot_info <- prep_plot( input_name = "seed", unit_system = "imperial", machine_width = 60, section_num = 24, harvester_width = 30, plot_width = 30 )

n_plot_info <- prep_plot( input_name = "uan28", unit_system = "imperial", machine_width = 60, section_num = 1, harvester_width = 30, plot_width = 60 )

input_plot_info <- list(seed_plot_info, n_plot_info)

exp_data <- make_exp_plots( input_plot_info = input_plot_info, boundary_data = system.file("extdata", "boundary-simple1.shp", package = "ofpetrial"), abline_data = system.file("extdata", "ab-line-simple1.shp", package = "ofpetrial"), abline_type = "free" )

seed_rate_info <- prep_rate( plot_info = seed_plot_info, gc_rate = 32000, unit = "seed", min_rate = 16000, max_rate = 40000, num_rates = 4, design_type = "ls" )

n_rate_info <- prep_rate( plot_info = n_plot_info, gc_rate = 20, unit = "gallons", min_rate = 10, max_rate = 30, num_rates = 4, design_type = "ls" )

trial_design <- assign_rates(exp_data, rate_info = list(seed_rate_info, n_rate_info))`

tmieno2 commented 4 months ago

Sorry, I already fixed the issue, but has not pushed it yet. Just wait a bit.