forsys-sp / forsysr

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

Add `patchmax_exclusion_limit` to `forsys::run` #93

Closed codyevers closed 1 year ago

codyevers commented 1 year ago

I've added a new parameter to forsys::run called patchmax_exclusion_limit. This is tranferred directly to the patchmax wrapper. @michelledayusfs can you confirm this is completed?

michelledayusfs commented 1 year ago

something weird is happening, it keeps building and recording patches past the 10 (it errors out at patch 44 but what is it making so many patches?). What am I doing wrong here?

run_outputs_exclimit = forsys::run( return_outputs = TRUE, write_outputs = TRUE, stand_data = shp, scenario_name = "forsys_exclimit", stand_id_field = "LMU_ID", stand_area_field = "Acres", global_threshold = 'OwnerClass == "USDA FOREST SERVICE"', scenario_priorities = c("res_depart_SPM"), scenario_output_fields = c("Acres", "Am4RevBio_PCP", "prob_8p_PCP", "res_depart_PCP"), run_with_patchmax = TRUE, patchmax_proj_size = 500, patchmax_proj_number = 10, patchmax_SDW = 1, patchmax_EPW = 0, patchmax_sample_frac = 1, patchmax_exclusion_limit = 1 )

codyevers commented 1 year ago

Turns out this was an unrelated bug. Should be fixed now.

codyevers commented 1 year ago

@michelledayusfs Can you double check that patchmax stops correctly after X number of projects AND/OR the annual_target? Thanks

michelledayusfs commented 1 year ago

Also, if I set patchmax_sample_frac to 0.6 (and I have both global and stand thresholds) why is it sampling 44% of the stands?

michelledayusfs commented 1 year ago

Okay, @codyevers , please see the attached script. This is treating things that don't meet my global threshold. If you set the stand threshold to 2, it is even worse. But it looks like the exclusion limit is working. :)

Testing_patchmax_exclusionlimit.txt

codyevers commented 1 year ago

You're right: the filtering_function wasn't working (wihch means it also wasn't working with the SPM and PCP calculations). Nice catch. It's fixed now.

michelledayusfs commented 1 year ago

Working now, as well as exclusion_limit. Closing issue.