WPDx_Toolset.pyt
def calcUnserved(self, admin_zones, unserved_population):
        """Uses zonal statistics to calculate population unserved in each zone"""
        start = time.clock()
        pop_dict = dict()
        pop_by_region = arcpy.gp.ZonalStatisticsAsTable_sa(admin_zones, 'Name',
                                                           unserved_population,
                                                           r"in_memory\pop",
                                                           '', 'SUM')
        with arcpy.da.SearchCursor(pop_by_region, ['Name', 'SUM']) as cursor:
            for row in cursor:
                pop_dict[row[0]] = row[1]
        arcpy.AddMessage("Zonal stats took: {:.2f} seconds".format(time.clock() - start))
        return pop_dict
Uses zonal statistics to calculate population unserved in each zone
Uses zonal statistics to calculate population unserved in each zone
Uses zonal statistics to calculate population unserved in each zone
def calcUnserved(self, admin_zones, unserved_population):
        start = time.clock()
        pop_dict = dict()
        pop_by_region = arcpy.gp.ZonalStatisticsAsTable_sa(admin_zones, 'Name',
                                                           unserved_population,
                                                           r"in_memory\pop",
                                                           '', 'SUM')
        with arcpy.da.SearchCursor(pop_by_region, ['Name', 'SUM']) as cursor:
            for row in cursor:
                pop_dict[row[0]] = row[1]
        arcpy.AddMessage("Zonal stats took: {:.2f} seconds".format(time.clock() - start))
        return pop_dict
def calcUnserved ( self , admin_zones , unserved_population ) : start = time . clock ( ) pop_dict = dict ( ) pop_by_region = arcpy . gp . ZonalStatisticsAsTable_sa ( admin_zones , 'Name' , unserved_population , r"in_memory\pop" , '' , 'SUM' ) with arcpy . da . SearchCursor ( pop_by_region , [ 'Name' , 'SUM' ] ) as cursor : for row in cursor : pop_dict [ row [ 0 ] ] = row [ 1 ] arcpy . AddMessage ( "Zonal stats took: {:.2f} seconds" . format ( time . clock ( ) - start ) ) return pop_dict
Uses zonal statistics to calculate population unserved in each zone
Uses zonal statistics to calculate population unserved in each zone
"""Uses zonal statistics to calculate population unserved in each zone"""
self
admin_zones
unserved_population