WPDx_Toolset.pyt
def execute(self, parameters, messages):
        """Removes urban areas and areas near a functioning well from population raster."""

        # Get Paramters
        global scratch
        scratch = tempfile.mkdtemp()
        zone = parameters[0].valueAsText
        buff_dist = parameters[1].valueAsText
        pop_grid = parameters[2].value
        out_path = parameters[3].value

        # Query WPDx database
        query_response, mask = queryWPDx(zone)
        pnts = getWaterPoints(query_response)

        start = time.clock()
        pnts_func = arcpy.MakeFeatureLayer_management(pnts, 'Functioning',
                                                      "status_id='yes'")

        pnts_buff = arcpy.Buffer_analysis(pnts_func, r"in_memory\buffer", "{} Meters".format(buff_dist))
        if mask == "Error":
            arcpy.env.extent = arcpy.Describe(pnts_buff).extent
        arcpy.AddMessage("Buffer took: {:.2f} seconds".format(time.clock() - start))

        area_urban = join(dirname(__file__), "Data", "ToolData.gdb", "Urban")
        pop_not_served = getPopNotServed(pnts_buff, pop_grid, area_urban)

        output = arcpy.CopyRaster_management(pop_not_served, out_path)
        parameters[3] = output
Removes urban areas and areas near a functioning well from population raster.
Removes urban areas and areas near a functioning well from population raster.
Removes urban areas and areas near a functioning well from population raster .
def execute(self, parameters, messages):
        global scratch
        scratch = tempfile.mkdtemp()
        zone = parameters[0].valueAsText
        buff_dist = parameters[1].valueAsText
        pop_grid = parameters[2].value
        out_path = parameters[3].value
        query_response, mask = queryWPDx(zone)
        pnts = getWaterPoints(query_response)
        start = time.clock()
        pnts_func = arcpy.MakeFeatureLayer_management(pnts, 'Functioning',
                                                      "status_id='yes'")
        pnts_buff = arcpy.Buffer_analysis(pnts_func, r"in_memory\buffer", "{} Meters".format(buff_dist))
        if mask == "Error":
            arcpy.env.extent = arcpy.Describe(pnts_buff).extent
        arcpy.AddMessage("Buffer took: {:.2f} seconds".format(time.clock() - start))
        area_urban = join(dirname(__file__), "Data", "ToolData.gdb", "Urban")
        pop_not_served = getPopNotServed(pnts_buff, pop_grid, area_urban)
        output = arcpy.CopyRaster_management(pop_not_served, out_path)
        parameters[3] = output
def execute ( self , parameters , messages ) : global scratch scratch = tempfile . mkdtemp ( ) zone = parameters [ 0 ] . valueAsText buff_dist = parameters [ 1 ] . valueAsText pop_grid = parameters [ 2 ] . value out_path = parameters [ 3 ] . value query_response , mask = queryWPDx ( zone ) pnts = getWaterPoints ( query_response ) start = time . clock ( ) pnts_func = arcpy . MakeFeatureLayer_management ( pnts , 'Functioning' , "status_id='yes'" ) pnts_buff = arcpy . Buffer_analysis ( pnts_func , r"in_memory\buffer" , "{} Meters" . format ( buff_dist ) ) if mask == "Error" : arcpy . env . extent = arcpy . Describe ( pnts_buff ) . extent arcpy . AddMessage ( "Buffer took: {:.2f} seconds" . format ( time . clock ( ) - start ) ) area_urban = join ( dirname ( __file__ ) , "Data" , "ToolData.gdb" , "Urban" ) pop_not_served = getPopNotServed ( pnts_buff , pop_grid , area_urban ) output = arcpy . CopyRaster_management ( pop_not_served , out_path ) parameters [ 3 ] = output
Removes urban areas and areas near a functioning well from population raster.
Removes urban areas and areas near a functioning well from population raster .
"""Removes urban areas and areas near a functioning well from population raster.""" # Get Paramters # Query WPDx database
self
parameters
messages