Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move variable extraction to detection from effort #14

Open
simonrolph opened this issue Jul 10, 2024 · 0 comments
Open

move variable extraction to detection from effort #14

simonrolph opened this issue Jul 10, 2024 · 0 comments
Assignees

Comments

@simonrolph
Copy link
Member

simonrolph commented Jul 10, 2024

Move all this stuff:

#get values from env, suitability, realised
  extracted_values <- terra::extract(simulation_object@state_env,effort_sf,ID=T)
  effort_sf[,names(extracted_values)] <- extracted_values

  #loop through each target
  targets_sf <- list()
  for (target in names(simulation_object@state_target_suitability)){
    target_sf <- effort_sf
    target_sf$target <- target

    #extract suitability
    extracted_values <- terra::extract(simulation_object@state_target_suitability[target],effort_sf,ID=F)

    target_sf[,"target_suitability"] <- extracted_values

    #extract realised
    extracted_values <- terra::extract(simulation_object@state_target_realised[target],effort_sf,ID=F)
    target_sf[,"target_realised"] <- extracted_values

    targets_sf[[target]] <- target_sf
  }

  effort_sf <- do.call(rbind,targets_sf)
  rownames(effort_sf) <- NULL

from sim_effort to sim_detect

Need to consider how to resolve extraction via non-point effort types eg. transect. Use argument fun to specify how that summarisation happens, or so we want separate data from every grid cell that the effort interacts with.

In 'extract()' I currently have ID=T but I should really have cell=T as I'm interested in cell numbers

Will need to update readme/vignette/tests to reflect this. Is there a way to streamline everytime we change something in the code? Eg a common basic workflow that is used in readme+tests.

@simonrolph simonrolph self-assigned this Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant