This is how I used Python in ArcGIS Pro Notebooks to automate a workflow.

Audiences:

Division:

Goal:

    • Total structures per county,
      • Structures per county within fire agencies,
      • Structures per county outside fire agencies,
        • Structures per county outside fire agencies but within Oregon Dept. of Forestry protection (underprotected structures),
        • Structures per county outside fire agencies and outside Oregon Dept. of Forestry protection (unprotected structures).
    • Structures per county outside a fire agency to the nearest agency,
      • Underprotected structures per county to the nearest agency,
      • Unprotected structures per county to the nearest agency.

Import:

Script explanation:

First, I made a script that selected structure points by location and returned counts within the various overlapping district layers, then looped through each county using a search cursor. The script then calculated mileage from each structure to the nearest fire agencies and averaged the mileage per county.

However, this script was too slow.

So, I remade it using spatial joins, classified structures using a search cursor with if/else statements, and ran summary statistics. I made sure to save the layers in the scratch geodatabase and intermediate layers in memory. My script then calculated the distance to the nearest fire agency and averaged the distance per county. The spatial joins were much faster than selecting by location, but the Near analysis tool still ran slowly, unfortunately, since it was iterating though each structure.

Nevertheless, this script accomplished my goal of calculating the necessary stats for each county. Recalculations will be much easier, for myself or future GIS Analysts.