-
Notifications
You must be signed in to change notification settings - Fork 11
Creating New Nearest Neighbor Matches
Ryan Hodges edited this page Dec 22, 2015
·
7 revisions
This document is intended to be a roadmap for future cases of creating a new set of plots to run nearest neighbor matches against.
- a file containing LAT/LON point data for all conditions to be considered
- IDB v2.0
- PNW FIA DB 2011
- etc...
- buffered polygon data representing the regional variants to be considered
- a file containing summary data for the conditions, including:
- stand age
- LAT, LON
- [fill in]
- Treelist data of the conditions, including
- species
- diameter (dbh)
- [fill in]
- run an intersection query between the condition point-data and the buffered variant polygon data
- required columns:
- Condition ID
- Latitude
- Longitude
- Variant ID
- Export as a CSV
- Tools to choose from:
- ArcMap (works well)
- QGIS
- Couldn't get field calculation to work as expected
- Spatialite
- geopandas (python package)
- Table including:
- User ID
- Forest Type ID
- Existing NN match for the Forest Type
- Variant
- Format as input for "Matt's Query" (https://github.com/Ecotrust/forestplanner/blob/9d7043e4520b7af885b16618fd2b781d6df5138d/lot/trees/plots.py)
- David creates CSVs
- Ryan truncates old tables and loads in the new data
- script to populate treelive_summary
- Workhorse: lot/load_new_conditions.py (does both Treelive & CVLookup)
- Run it from: lot/scripts/load_treelive.sh
- Process gradually sucks up all memory and slows to a crawl. This wrapper script will restart it when it slows down too much.
- This script does not like being executable in Vagrant Shared Folders. Feel free to copy it to /tmp and run it from there.
- script to populate condition variant lookup
- lot/load_new_conditions.py (uncomment correct lines)
- script to populate treelive_summary
- Current Nearest Neighbor matching code takes 1 Forest Type at a time.
- Wrap it in a loop to run once per each user-defined Forest Type/Stand info
- Creates a list of "Growth Candidates"
- output should be csv: each row is a user stand, variant, forest type, one of the matching ids found, and the rank (i.e. 1-10) of that match
- Be sure that you pull enough candidates to represent each variant
- Inputs:
- FP User Forest-Types/Previous-Nearest-Neighbor-Match Table
- Condition-Variant Lookup CSV
- Condition Summary Table
- Treelist for all Conditions