Пример #1
0
def test_flood_area():
    topo = numpy.mgrid[:8, :8].sum(axis=0) * tidegates.METERS_PER_FOOT
    zones = numpy.array([
        [-1,  2,  2,  2,  2,  2,  2, -1,],
        [-1,  2,  2,  2, -1,  2,  2, -1,],
        [ 1,  1,  1,  1, -1,  2,  2, -1,],
        [ 1,  1,  1,  1, -1,  2,  2, -1,],
        [ 1, -1,  1,  1,  2,  2,  2,  2,],
        [-1, -1,  1,  1,  2,  2,  2,  2,],
        [-1, -1, -1, -1, -1, -1, -1, -1,],
        [-1, -1, -1, -1, -1, -1, -1, -1,]
    ])
    template = utils.RasterTemplate(8, 4, 6)
    ws = resource_filename('tidegates.testing', 'flood_area')
    filename = 'test_flood_area_output.shp'
    with utils.WorkSpace(ws), utils.OverwriteState(True):
        floods = tidegates.flood_area(
            topo_array=topo,
            zones_array=zones,
            template=template,
            ID_column='GeoID',
            elevation_feet=5,
            filename=filename,
            cleanup=True,
            verbose=False,
        )

    nt.assert_true(isinstance(floods, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(
        resource_filename('tidegates.testing.flood_area', 'known_flood_area_output.shp'),
        resource_filename('tidegates.testing.flood_area', filename)
    )

    utils.cleanup_temp_results(floods)
Пример #2
0
    def test_analyze_no_optional_input(self):
        ws = resource_filename('tidegates.testing', 'analyze')
        testdir = 'tidegates.testing.analyze'
        test_dem = resource_filename(testdir, 'dem.tif')
        test_zones = resource_filename(testdir, 'zones.shp')
        test_wetlands = resource_filename(testdir, 'wetlands.shp')
        test_buidlings = resource_filename(testdir, 'buildings.shp')
        output = resource_filename(testdir, 'flooding_no_opts.shp')

        with utils.WorkSpace(ws), utils.OverwriteState(True):
            flood, wetland, building = self.tbx.analyze(
                elev=self.elev,
                slr=self.slr,
                surge=self.surge,
                flood_output=output,
                dem=test_dem,
                zones=test_zones,
                ID_column='GeoID',
                wetlands=None,
                buildings=None
            )

        nt.assert_true(isinstance(flood, arcpy.mapping.Layer))
        nt.assert_equal(flood.dataSource, resource_filename(testdir, self.flood_output_no_opts))
        nt.assert_true(wetland is None)
        nt.assert_true(building is None)

        tgtest.assert_shapefiles_are_close(
            resource_filename(testdir, self.flood_output_no_opts),
            resource_filename(testdir, self.known_flood_output_no_opts)
        )
Пример #3
0
    def test_single_squeeze_true(self):
        with utils.OverwriteState(True):
            newlayer = utils.copy_data(self.destfolder, *self.srclayers[:1], squeeze=True)

        nt.assert_true(isinstance(newlayer, arcpy.mapping.Layer))

        nt.assert_true(isinstance(newlayer, arcpy.mapping.Layer))
        tgtest.assert_shapefiles_are_close(self.output[0], self.srclayers[0])
Пример #4
0
    def test_single_squeeze_false(self):
        with utils.OverwriteState(True):
            newlayers = utils.copy_data(self.destfolder, *self.srclayers[:1])

        nt.assert_true(isinstance(newlayers, list))

        for newlyr, newname, oldname in zip(newlayers[:1], self.output[:1], self.srclayers[:1]):
            nt.assert_true(isinstance(newlyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(newname, oldname)
Пример #5
0
    def test_single_squeeze_true(self):
        with utils.OverwriteState(True):
            newlayer = utils.copy_data(self.destfolder,
                                       *self.srclayers[:1],
                                       squeeze=True)

        nt.assert_true(isinstance(newlayer, arcpy.mapping.Layer))

        nt.assert_true(isinstance(newlayer, arcpy.mapping.Layer))
        tgtest.assert_shapefiles_are_close(self.output[0], self.srclayers[0])
Пример #6
0
    def test_single_squeeze_false(self):
        with utils.OverwriteState(True):
            newlayers = utils.copy_data(self.destfolder, *self.srclayers[:1])

        nt.assert_true(isinstance(newlayers, list))

        for newlyr, newname, oldname in zip(newlayers[:1], self.output[:1],
                                            self.srclayers[:1]):
            nt.assert_true(isinstance(newlyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(newname, oldname)
Пример #7
0
def test_raster_to_polygons_with_new_field():
    zonefile = resource_filename("tidegates.testing.raster_to_polygons", "input_raster_to_polygon.tif")
    knownfile = resource_filename("tidegates.testing.raster_to_polygons", "known_polygons_from_raster_2.shp")
    testfile = resource_filename("tidegates.testing.raster_to_polygons", "test_polygons_from_raster_2.shp")

    with utils.OverwriteState(True):
        zones = utils.load_data(zonefile, 'raster')
        known = utils.load_data(knownfile, 'layer')
        test = utils.raster_to_polygons(zones, testfile, newfield="GeoID")

    tgtest.assert_shapefiles_are_close(test.dataSource, known.dataSource)
    utils.cleanup_temp_results(testfile)
Пример #8
0
def test_join_results_to_baseline():
    known = resource_filename('tidegates.testing.join_results', 'merge_result.shp')
    with utils.OverwriteState(True):
        test = utils.join_results_to_baseline(
            resource_filename('tidegates.testing.join_results', 'merge_result.shp'),
            resource_filename('tidegates.testing.join_results', 'merge_join.shp'),
            resource_filename('tidegates.testing.join_results', 'merge_baseline.shp')
        )
    nt.assert_true(isinstance(test, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(test.dataSource, known)

    utils.cleanup_temp_results(test)
Пример #9
0
def test_concat_results():
    known = resource_filename('tidegates.testing.concat_results', 'known.shp')
    with utils.OverwriteState(True):
        test = utils.concat_results(
            resource_filename('tidegates.testing.concat_results', 'result.shp'),
            resource_filename('tidegates.testing.concat_results', 'input1.shp'),
            resource_filename('tidegates.testing.concat_results', 'input2.shp')
        )

    nt.assert_true(isinstance(test, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(test.dataSource, known)

    utils.cleanup_temp_results(test)
Пример #10
0
def test_aggregate_polygons():
    inputfile = resource_filename("tidegates.testing.aggregate_polygons", "input_polygons_from_raster.shp")
    knownfile = resource_filename("tidegates.testing.aggregate_polygons", "known_dissolved_polygons.shp")
    testfile = resource_filename("tidegates.testing.aggregate_polygons", "test_dissolved_polygons.shp")

    with utils.OverwriteState(True):
        raw = utils.load_data(inputfile, 'layer')
        known = utils.load_data(knownfile, 'layer')
        test = utils.aggregate_polygons(raw, "gridcode", testfile)

    tgtest.assert_shapefiles_are_close(test.dataSource, known.dataSource)

    utils.cleanup_temp_results(testfile)
Пример #11
0
def test_concat_results():
    known = resource_filename('tidegates.testing.concat_results', 'known.shp')
    with utils.OverwriteState(True):
        test = utils.concat_results(
            resource_filename('tidegates.testing.concat_results',
                              'result.shp'),
            resource_filename('tidegates.testing.concat_results',
                              'input1.shp'),
            resource_filename('tidegates.testing.concat_results',
                              'input2.shp'))

    nt.assert_true(isinstance(test, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(test.dataSource, known)

    utils.cleanup_temp_results(test)
Пример #12
0
def test_join_results_to_baseline():
    known = resource_filename('tidegates.testing.join_results',
                              'merge_result.shp')
    with utils.OverwriteState(True):
        test = utils.join_results_to_baseline(
            resource_filename('tidegates.testing.join_results',
                              'merge_result.shp'),
            resource_filename('tidegates.testing.join_results',
                              'merge_join.shp'),
            resource_filename('tidegates.testing.join_results',
                              'merge_baseline.shp'))
    nt.assert_true(isinstance(test, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(test.dataSource, known)

    utils.cleanup_temp_results(test)
Пример #13
0
def test_raster_to_polygons_with_new_field():
    zonefile = resource_filename("tidegates.testing.raster_to_polygons",
                                 "input_raster_to_polygon.tif")
    knownfile = resource_filename("tidegates.testing.raster_to_polygons",
                                  "known_polygons_from_raster_2.shp")
    testfile = resource_filename("tidegates.testing.raster_to_polygons",
                                 "test_polygons_from_raster_2.shp")

    with utils.OverwriteState(True):
        zones = utils.load_data(zonefile, 'raster')
        known = utils.load_data(knownfile, 'layer')
        test = utils.raster_to_polygons(zones, testfile, newfield="GeoID")

    tgtest.assert_shapefiles_are_close(test.dataSource, known.dataSource)
    utils.cleanup_temp_results(testfile)
Пример #14
0
def test_aggregate_polygons():
    inputfile = resource_filename("tidegates.testing.aggregate_polygons",
                                  "input_polygons_from_raster.shp")
    knownfile = resource_filename("tidegates.testing.aggregate_polygons",
                                  "known_dissolved_polygons.shp")
    testfile = resource_filename("tidegates.testing.aggregate_polygons",
                                 "test_dissolved_polygons.shp")

    with utils.OverwriteState(True):
        raw = utils.load_data(inputfile, 'layer')
        known = utils.load_data(knownfile, 'layer')
        test = utils.aggregate_polygons(raw, "gridcode", testfile)

    tgtest.assert_shapefiles_are_close(test.dataSource, known.dataSource)

    utils.cleanup_temp_results(testfile)
Пример #15
0
    def test_finish_results_no_source(self):
        results = [
            resource_filename('tidegates.testing.finish_result', 'res1.shp'),
            resource_filename('tidegates.testing.finish_result', 'res2.shp'),
            resource_filename('tidegates.testing.finish_result', 'res3.shp')
        ]
        with utils.OverwriteState(True):
            self.tbx.finish_results(
                resource_filename('tidegates.testing.finish_result', 'finished_no_src.shp'),
                results,
                cleanup=False
            )

        tgtest.assert_shapefiles_are_close(
            resource_filename('tidegates.testing.finish_result', 'finished_no_src.shp'),
            resource_filename('tidegates.testing.finish_result', 'known_finished_no_src.shp'),
        )
Пример #16
0
def test_intersect_polygon_layers():
    input1_file = resource_filename("tidegates.testing.intersect_polygons", "intersect_input1.shp")
    input2_file = resource_filename("tidegates.testing.intersect_polygons", "intersect_input2.shp")
    known_file = resource_filename("tidegates.testing.intersect_polygons", "intersect_known.shp")
    output_file = resource_filename("tidegates.testing.intersect_polygons", "intersect_output.shp")

    with utils.OverwriteState(True):
        output = utils.intersect_polygon_layers(
            output_file,
            input1_file,
            input2_file,
        )

    nt.assert_true(isinstance(output, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(output_file, known_file)

    utils.cleanup_temp_results(output)
Пример #17
0
    def test_main_execute_no_assets(self):
        with utils.OverwriteState(True), utils.WorkSpace(self.main_execute_ws):
            self.tbx.main_execute(
                zones='zones.shp',
                workspace=self.main_execute_ws,
                flood_output='test_floods_no_assets.shp',
                ID_column='GeoID',
                dem='dem.tif',
                elevation=self.elev_list
            )

            utils.cleanup_temp_results("tempraster")

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir, 'test_floods_no_assets.shp'),
            resource_filename(self.main_execute_dir, 'known_floods_no_assets.shp'),
        )
Пример #18
0
    def test_main_execute_no_assets(self):
        with utils.OverwriteState(True), utils.WorkSpace(self.main_execute_ws):
            self.tbx.main_execute(zones='zones.shp',
                                  workspace=self.main_execute_ws,
                                  flood_output='test_floods_no_assets.shp',
                                  ID_column='GeoID',
                                  dem='dem.tif',
                                  elevation=self.elev_list)

            utils.cleanup_temp_results("tempraster")

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir,
                              'test_floods_no_assets.shp'),
            resource_filename(self.main_execute_dir,
                              'known_floods_no_assets.shp'),
        )
Пример #19
0
    def test_finish_results_no_source(self):
        results = [
            resource_filename('tidegates.testing.finish_result', 'res1.shp'),
            resource_filename('tidegates.testing.finish_result', 'res2.shp'),
            resource_filename('tidegates.testing.finish_result', 'res3.shp')
        ]
        with utils.OverwriteState(True):
            self.tbx.finish_results(resource_filename(
                'tidegates.testing.finish_result', 'finished_no_src.shp'),
                                    results,
                                    cleanup=False)

        tgtest.assert_shapefiles_are_close(
            resource_filename('tidegates.testing.finish_result',
                              'finished_no_src.shp'),
            resource_filename('tidegates.testing.finish_result',
                              'known_finished_no_src.shp'),
        )
Пример #20
0
    def test_analyze(self):
        ws = resource_filename('tidegates.testing', 'analyze')
        testdir = 'tidegates.testing.analyze'
        test_dem = resource_filename(testdir, 'dem.tif')
        test_zones = resource_filename(testdir, 'zones.shp')
        test_wetlands = resource_filename(testdir, 'wetlands.shp')
        test_buidlings = resource_filename(testdir, 'buildings.shp')
        output = resource_filename(testdir, 'flooding.shp')

        topo_array, zones_array, template = tidegates.process_dem_and_zones(
            dem=test_dem,
            zones=test_zones,
            ID_column="GeoID",

            cleanup=True,
            verbose=False
        )

        with utils.WorkSpace(ws), utils.OverwriteState(True):
            flood, wetland, building = self.tbx.analyze(
                topo_array=topo_array,
                zones_array=zones_array,
                template=template,
                elev=self.elev,
                slr=self.slr,
                surge=self.surge,
                num=None,
                flood_output=output,
                dem=test_dem,
                zones=test_zones,
                ID_column='GeoID',
                wetlands=test_wetlands,
                buildings=test_buidlings,
            )

        nt.assert_true(isinstance(flood, arcpy.mapping.Layer))
        nt.assert_equal(flood.dataSource, resource_filename(testdir, self.flood_output))
        nt.assert_true(isinstance(wetland, arcpy.mapping.Layer))
        nt.assert_true(isinstance(building, arcpy.mapping.Layer))

        tgtest.assert_shapefiles_are_close(
            resource_filename(testdir, self.flood_output),
            resource_filename(testdir, self.known_flood_output)
        )
Пример #21
0
    def test_analyze(self):
        ws = resource_filename('tidegates.testing', 'analyze')
        testdir = 'tidegates.testing.analyze'
        test_dem = resource_filename(testdir, 'dem.tif')
        test_zones = resource_filename(testdir, 'zones.shp')
        test_wetlands = resource_filename(testdir, 'wetlands.shp')
        test_buidlings = resource_filename(testdir, 'buildings.shp')
        output = resource_filename(testdir, 'flooding.shp')

        topo_array, zones_array, template = tidegates.process_dem_and_zones(
            dem=test_dem,
            zones=test_zones,
            ID_column="GeoID",
            cleanup=True,
            verbose=False)

        with utils.WorkSpace(ws), utils.OverwriteState(True):
            flood, wetland, building = self.tbx.analyze(
                topo_array=topo_array,
                zones_array=zones_array,
                template=template,
                elev=self.elev,
                slr=self.slr,
                surge=self.surge,
                num=None,
                flood_output=output,
                dem=test_dem,
                zones=test_zones,
                ID_column='GeoID',
                wetlands=test_wetlands,
                buildings=test_buidlings,
            )

        nt.assert_true(isinstance(flood, arcpy.mapping.Layer))
        nt.assert_equal(flood.dataSource,
                        resource_filename(testdir, self.flood_output))
        nt.assert_true(isinstance(wetland, arcpy.mapping.Layer))
        nt.assert_true(isinstance(building, arcpy.mapping.Layer))

        tgtest.assert_shapefiles_are_close(
            resource_filename(testdir, self.flood_output),
            resource_filename(testdir, self.known_flood_output))
Пример #22
0
def test_intersect_polygon_layers():
    input1_file = resource_filename("tidegates.testing.intersect_polygons",
                                    "intersect_input1.shp")
    input2_file = resource_filename("tidegates.testing.intersect_polygons",
                                    "intersect_input2.shp")
    known_file = resource_filename("tidegates.testing.intersect_polygons",
                                   "intersect_known.shp")
    output_file = resource_filename("tidegates.testing.intersect_polygons",
                                    "intersect_output.shp")

    with utils.OverwriteState(True):
        output = utils.intersect_polygon_layers(
            output_file,
            input1_file,
            input2_file,
        )

    nt.assert_true(isinstance(output, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(output_file, known_file)

    utils.cleanup_temp_results(output)
Пример #23
0
def test_flood_area():
    ws = resource_filename('tidegates.testing', 'flood_area')
    with utils.WorkSpace(ws), utils.OverwriteState(True):
        filename = 'test_flood_area_output.shp'
        floods = tidegates.flood_area(
            dem='test_dem.tif',
            zones='test_zones.shp',
            ID_column='GeoID',
            elevation_feet=7.8,
            filename=filename,
            cleanup=True,
            verbose=False,
        )

    nt.assert_true(isinstance(floods, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(
        resource_filename('tidegates.testing.flood_area', 'known_flood_area_output.shp'),
        resource_filename('tidegates.testing.flood_area', filename)
    )

    utils.cleanup_temp_results(floods)
Пример #24
0
    def test_buildings(self):

        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            outputlayer = tidegates.area_of_impacts(
                floods_path=self.floods,
                flood_idcol='GeoID',
                assets_input=self.buildings,
                fieldname='bldg_area',
                assets_output=os.path.join(self.workspace,
                                           'flooded_buildings.shp'),
                cleanup=False,
                verbose=False,
            )

            nt.assert_true(isinstance(outputlayer, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(outputlayer.dataSource,
                                               self.known_buildings)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(self.floods, 'flooded_buildings.shp',
                                       '_temp_flooded_buildings.shp')
Пример #25
0
    def test_fxn(self):

        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            floodslyr, wetlandslyr, buildingslyr = tidegates.assess_impact(
                floods_path=self.floods,
                flood_idcol='GeoID',
                wetlands_path=self.wetlands,
                buildings_path=self.buildings,
                buildings_output=os.path.join(self.workspace, 'flooded_buildings.shp'),
                wetlands_output=os.path.join(self.workspace, 'flooded_wetlands.shp'),
                cleanup=False,
                verbose=False,
            )

            nt.assert_true(isinstance(floodslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(floodslyr.dataSource, self.known_floods)

            nt.assert_true(isinstance(wetlandslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(wetlandslyr.dataSource, self.known_wetlands)

            nt.assert_true(isinstance(buildingslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(buildingslyr.dataSource, self.known_buildings)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(
                self.floods,
                'flooded_buildings.shp',
                'flooded_wetlands.shp',
                '_temp_flooded_wetlands.shp'
            )
Пример #26
0
    def test_fxn(self):

        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            floodslyr, wetlandslyr, buildingslyr = tidegates.assess_impact(
                floods_path=self.floods,
                flood_idcol='GeoID',
                wetlands_path=self.wetlands,
                buildings_path=self.buildings,
                buildings_output=os.path.join(self.workspace,
                                              'flooded_buildings.shp'),
                wetlands_output=os.path.join(self.workspace,
                                             'flooded_wetlands.shp'),
                cleanup=False,
                verbose=False,
            )

            nt.assert_true(isinstance(floodslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(floodslyr.dataSource,
                                               self.known_floods)

            nt.assert_true(isinstance(wetlandslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(wetlandslyr.dataSource,
                                               self.known_wetlands)

            nt.assert_true(isinstance(buildingslyr, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(buildingslyr.dataSource,
                                               self.known_buildings)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(self.floods, 'flooded_buildings.shp',
                                       'flooded_wetlands.shp',
                                       '_temp_flooded_wetlands.shp')
Пример #27
0
    def test_buildings(self):

        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            outputlayer = tidegates.area_of_impacts(
                floods_path=self.floods,
                flood_idcol='GeoID',
                assets_input=self.buildings,
                fieldname='bldg_area',
                assets_output=os.path.join(self.workspace, 'flooded_buildings.shp'),
                cleanup=False,
                verbose=False,
            )

            nt.assert_true(isinstance(outputlayer, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(outputlayer.dataSource, self.known_buildings)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(
                self.floods,
                'flooded_buildings.shp',
                '_temp_flooded_buildings.shp'
            )
Пример #28
0
    def test_wetlands(self):
        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            outputlayer = tidegates.count_of_impacts(
                floods_path=self.floods,
                flood_idcol='GeoID',
                fieldname='wetlands',
                assets_input=self.wetlands,
                asset_idcol='WETCODE',
                assets_output=os.path.join(self.workspace, 'flooded_wetlands.shp'),
                verbose=False,
            )

            nt.assert_true(isinstance(outputlayer, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(outputlayer.dataSource, self.known_wetlands)

            tgtest.assert_shapefiles_are_close(self.floods, self.known_floods_with_wtld)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(
                self.floods,
                'flooded_wetlands.shp',
                '_temp_flooded_wetlands.shp'
            )
Пример #29
0
    def test_wetlands(self):
        with utils.WorkSpace(self.workspace), utils.OverwriteState(True):
            outputlayer = tidegates.count_of_impacts(
                floods_path=self.floods,
                flood_idcol='GeoID',
                fieldname='wetlands',
                assets_input=self.wetlands,
                asset_idcol='WETCODE',
                assets_output=os.path.join(self.workspace,
                                           'flooded_wetlands.shp'),
                verbose=False,
            )

            nt.assert_true(isinstance(outputlayer, arcpy.mapping.Layer))
            tgtest.assert_shapefiles_are_close(outputlayer.dataSource,
                                               self.known_wetlands)

            tgtest.assert_shapefiles_are_close(self.floods,
                                               self.known_floods_with_wtld)

        with utils.WorkSpace(self.workspace):
            utils.cleanup_temp_results(self.floods, 'flooded_wetlands.shp',
                                       '_temp_flooded_wetlands.shp')
Пример #30
0
def test_flood_area():
    topo = numpy.mgrid[:8, :8].sum(axis=0) * tidegates.METERS_PER_FOOT
    zones = numpy.array([[
        -1,
        2,
        2,
        2,
        2,
        2,
        2,
        -1,
    ], [
        -1,
        2,
        2,
        2,
        -1,
        2,
        2,
        -1,
    ], [
        1,
        1,
        1,
        1,
        -1,
        2,
        2,
        -1,
    ], [
        1,
        1,
        1,
        1,
        -1,
        2,
        2,
        -1,
    ], [
        1,
        -1,
        1,
        1,
        2,
        2,
        2,
        2,
    ], [
        -1,
        -1,
        1,
        1,
        2,
        2,
        2,
        2,
    ], [
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
    ], [
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
        -1,
    ]])
    template = utils.RasterTemplate(8, 4, 6)
    ws = resource_filename('tidegates.testing', 'flood_area')
    filename = 'test_flood_area_output.shp'
    with utils.WorkSpace(ws), utils.OverwriteState(True):
        floods = tidegates.flood_area(
            topo_array=topo,
            zones_array=zones,
            template=template,
            ID_column='GeoID',
            elevation_feet=5,
            filename=filename,
            cleanup=True,
            verbose=False,
        )

    nt.assert_true(isinstance(floods, arcpy.mapping.Layer))
    tgtest.assert_shapefiles_are_close(
        resource_filename('tidegates.testing.flood_area',
                          'known_flood_area_output.shp'),
        resource_filename('tidegates.testing.flood_area', filename))

    utils.cleanup_temp_results(floods)