Scripts
make_dataset.py and public_uses.py
make_dataset.py
is where all file paths and associated field names are stored. All other scripts read from this script. When datasets need to be updated, this should be the only place those changes need to be reflected.
public_uses.py
provides the land use types and owner name indicators for publicly owned land. It is anticipated that as municipal staff use the tool, more owner names or public land uses may need to be added to this list.
suitability_criteria.py
suitability_criteria.py contains a modified set of functions that were generated for the 3A Analytical Toolbox. Some of the main functions are describd below.
get_landuse_data()
used by get_parcels_row()
in ms4_funcs.py
to pull parcels from the 3A parcel file location.
calculate_suitability_criteria()
The main function calculate_suitability_criteria()
includes a "how"
parameter that draws from other functions in this script. These functions perform basic geoprocessing operations (calculating distance, spatial joins, calculating area of overlap) on an input geography (parcels in this case), adding fields with key statistics based on those operations.
how:
'overlap_area'
- calculates total area of overlap and the percentage of overlap for any polgyon layer within a parcel layer'overlap_sjoin'
- assigns the parcel with the (min/max/avg/first) value from an overlapping geograpy'distance'
- calculates the distance from parcel boundaries to the nearest boundary or point of another given layer'if_overlap'
- assigns the parcel with a value of 1 if it overlaps with another given layer
A new function, distance_with_fields()
was created for the community visibility layer. This allows a user to identify a set of fields to retain from the join field.
ms4_funcs.py
ms4_funcs.py contains a set of unique functions created specifically for this model.
get_parcels_row()
Creates base geometry for MS4 model at municipal level. See Pre-Processing for data preparation steps. Merges together municipal parcels (either from 3a or from direct/manual download) and right of way segments (from ModelBuilder or ArcPy).
get_lclu_muni()
For layer with 2016 lclu and pler estimates (created in models > pler_calc.py, see Pre-Processing), clips layer to municipal boundary and gives the total phosphorus load across each geometry.
get_tree_canopy_lc()
From municipal land cover dataset, extracts tree canopy land cover types. Resulting geodataframe encompasses all area of land in municipality that is covered by tree canopy.
tree_score()
For each block group in the municipality, determines the relative concentration of tree canopy compared to all other block groups. Those in the bottom 40% of scores are retained as having tree "need". Parcels or fishnet cells within those block groups can then be prioritized higher.
calculate_imperviousness()
Takes municipal land cover/land use data and extracts only impervious surfaces. Brings in building structures data to delineate whether coverage is rooftop (from structures) or cover (anything other than structures). Based on this, for each parcel, calculates total imperviousness (by type), given as square meters, acres, and percentage of parcel.
heat_score()
For each census block in the municipality, determines the relative heat index score compared to all other block groups. Those in the top 40% of scores are retained as having heat "vulnerability". Parcels within those block groups can then be prioritized higher.
soil_hsg_score()
For each SSURGO geometry in the muni, calculates a soil hydrology score based on te soil hydrologic group. Soils in group A get a score of 3, soils in group B get a score of 2, soils in group C, D, A/D, B/D, and C/D get a score of 1. Soils without a hydrologic soil group get a score of 0.
get_P_load()
For each parcel, calculates phosphorous load using raster stats.
comm_vis_layer()
For each parcel, calculates:
Whether or not the parcel is within a 'town center'
Distance from nearest "visibile" community location
If within threshold distance, provides information about what the nearest location is
drainage_data()
Where available, reads in drainage data (points, lines) and calculates distance to drainage system for each site. If there is no drainage data available for the town, distance is set to -999.
parcel_model.py
parcel_model.py brings together data from make_dataset.py
and functions from suitability_criteria.py
and ms4_funcs.py
to run full analysis on all parcels and right of way segments in each municipality in the MAPC region.
Last updated