DIFM-Brain / ofpetrial

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

make_trial_report() in V0-basic-work-flow #35

Closed tmieno2 closed 4 months ago

tmieno2 commented 4 months ago

@brittanikedge, I just realized that make_trial_report() was not exported, meaning it avoided the scrutiny of R CMD check. I am working on modifying it a bit without trying to break it. Setting that aside, when I ran make_trial_report() in V0-basic-work-flow.Rmd, it produced this error.

Screenshot 2024-05-02 at 10 16 19 PM

Can you take a look?

tmieno2 commented 4 months ago

Okay, so I did a little bit of digging. It is because of no intersection result from st_intersection() in the code below within find_center().

  line_coords <-
    st_intersection_quietly(trial_plot[1, ], ab_line) %>%
    .$result %>%
    sf::st_coordinates()
Screenshot 2024-05-02 at 10 47 53 PM

The red ab-line happens to be just outside of the trial_plot you picked earlier in the code.

Also,

trial_plot[1, ] in the above code always points to the polygon for the first input. Is that desired behavior? Using your codes for debugging, this is what I am getting:

Screenshot 2024-05-02 at 10 54 35 PM
brittanikedge commented 4 months ago

@tmieno2 Interesting, I will look at all of these today. This shouldn't be possible if the code is working as expected because the plot is chosen specifically to be the plot that intersects with the line. However, I've been thinking about changing the way it is done, so I will work on that today along with the other comments.

brittanikedge commented 4 months ago

@tmieno2 I'm having trouble replicating this error inside the V0 script. Did you already fix this one?

tmieno2 commented 4 months ago

No I did not do anything. Let me run that again.

tmieno2 commented 4 months ago

Weird. I just ran it and now it works just fine. Closing this.