forsys-sp / forsysr

An R implementation of the ForSys program
GNU General Public License v3.0
8 stars 3 forks source link

Patchmax fails on #62

Closed codyevers closed 2 years ago

codyevers commented 2 years ago

Patchmax failing on SERAL data when thresholds aren't provided

> outputs = forsys::run(
+   return_outputs = TRUE,
+   stand_data = stands_dat,
+   scenario_name = "yss_patchmax_test",
+   stand_id_field = "LMU_ID",
+   proj_id_field = "POD",
+   stand_area_field = "Acres",
+   scenario_priorities = "TotConVol",
+   # stand_threshold = "TotConVol > 0",
+   # global_threshold = "Forest_Typ == 'Mixed conifer/fir'",
+   scenario_output_fields = c("Acres", "TotConVol"),
+   run_with_patchmax = TRUE,
+   patchmax_stnd_adj = adj,
+   patchmax_proj_size = 25000,
+   patchmax_proj_number = 5,
+   patchmax_sample_n = 1000
+ )
Output directory, /Users/codyevers/GitHub/forsysr/output/yss_patchmax_test/, already exists
...Overwriting previous files
Forsys Shiny data detected.
Forsys stand adjacency data detected

---------------
Weighting scenario 1 of 1: 1
Running PatchMax using 11 cores
Error in `pull_as_location2()`:
! Must extract column with a single valid subscript.
✖ Subscript `var` has size 0 but must be size 1.
Run `rlang::last_error()` to see where the error occurred.

> last_error()
<error/vctrs_error_subscript_type>
Error in `pull_as_location2()`:
! Must extract column with a single valid subscript.
✖ Subscript `var` has size 0 but must be size 1.
---
Backtrace:
  1. forsys::run(...)
 14. dplyr:::pull.data.frame(., !!threshold_field)
 15. tidyselect::vars_pull(names(.data), !!enquo(var))
 16. tidyselect:::pull_as_location2(loc, n, vars)
 25. vctrs::num_as_location2(i, n = n, negative = "ignore", arg = "var")
 26. vctrs:::result_get(...)
Run `rlang::last_trace()` to see the full context.
michelledayusfs commented 2 years ago

This was the old version of patchmax. If this error arises in the new version, please submit new issue.