USFS-PNW / Fia-Biosum-Manager

User interface and main code repository for Biosum
http://biosum.info/
Other
3 stars 3 forks source link

OPTIMIZER: Additional options for haul cost calculations #237

Open lbross opened 4 years ago

lbross commented 4 years ago

Add 3 additional options for haul cost calculations. Update the Wood Processing Sites tab in Optimizer to allow analyst to make a choice. The default and current choice is to use the closest site to a stand. Two new choices would be the second or third closest site to a stand.

Another new choice is an imaginary or composite site where the distance is the average of the top 3 sites. Perhaps this should be flexible and allow the analyst to choose how many sites to average? BioSum requires a site for many Optimizer functions so not sure how this would work yet.

lbross commented 4 years ago

Possible SQL statement to identify the travel_time rows to use. After the work table is built, delete the rows that are higher rank than you want to use to keep it small. Adjust the psite statements to include the desired psites. This can take a long time to run depending on how big the travel_time table is and how many psites are in use. Consider breaking into multiple queries if lots of psites.

SELECT tbl1.biosum_plot_id, tbl1.psite_id, tbl1.ONE_WAY_HOURS, count(*) AS Rank
INTO travel_time_rank
FROM travel_time AS tbl1 INNER JOIN travel_time AS tbl2 ON (tbl1.ONE_WAY_HOURS > tbl2.ONE_WAY_HOURS) 
AND (tbl1.biosum_plot_id = tbl2.biosum_plot_id)
WHERE tbl1.psite_id < 400 AND  tbl2.psite_id < 400
GROUP BY tbl1.biosum_plot_id, tbl1.psite_id, tbl1.one_way_hours
ORDER BY tbl1.biosum_plot_id;