Ejemplo n.º 1
0
    def test_main_execute(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.shp',
                wetland_output='test_wetlands.shp',
                building_output='test_buildings.shp',
                wetlands='wetlands.shp',
                buildings='buildings.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_wetlands.shp'),
            resource_filename(self.main_execute_dir, 'known_wetlands.shp'),
        )

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir, 'test_floods.shp'),
            resource_filename(self.main_execute_dir, 'known_floods.shp'),
        )

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir, 'test_buildings.shp'),
            resource_filename(self.main_execute_dir, 'known_buildings.shp'),
        )
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
    def test_main_execute(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.shp',
                                  wetland_output='test_wetlands.shp',
                                  building_output='test_buildings.shp',
                                  wetlands='wetlands.shp',
                                  buildings='buildings.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_wetlands.shp'),
            resource_filename(self.main_execute_dir, 'known_wetlands.shp'),
        )

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir, 'test_floods.shp'),
            resource_filename(self.main_execute_dir, 'known_floods.shp'),
        )

        tgtest.assert_shapefiles_are_close(
            resource_filename(self.main_execute_dir, 'test_buildings.shp'),
            resource_filename(self.main_execute_dir, 'known_buildings.shp'),
        )
Ejemplo n.º 4
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')
Ejemplo n.º 5
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'
            )
Ejemplo n.º 6
0
 def test_with_results(self):
     with utils.WorkSpace(self.workspace):
         res1 = arcpy.Result(toolname='Clip_management')
         res2 = arcpy.Result(toolname='Clip_management')
         with mock.patch.object(res1, 'getOutput', return_value='temp_1.tif'), \
              mock.patch.object(res2, 'getOutput', return_value='temp_2.tif'):
             utils.cleanup_temp_results(res1, res2)
             self.check_outcome()
Ejemplo n.º 7
0
 def test_with_results(self):
     with utils.WorkSpace(self.workspace):
         res1 = arcpy.Result(toolname='Clip_management')
         res2 = arcpy.Result(toolname='Clip_management')
         with mock.patch.object(res1, 'getOutput', return_value='temp_1.tif'), \
              mock.patch.object(res2, 'getOutput', return_value='temp_2.tif'):
             utils.cleanup_temp_results(res1, res2)
             self.check_outcome()
Ejemplo n.º 8
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)
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
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)
Ejemplo n.º 12
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)
Ejemplo n.º 13
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)
Ejemplo n.º 14
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)
Ejemplo n.º 15
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)
Ejemplo n.º 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)
Ejemplo n.º 17
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)
Ejemplo n.º 18
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)
Ejemplo n.º 19
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')
Ejemplo n.º 20
0
    def finish_results(outputname, results, **kwargs):
        """ Merges and cleans up compiled output from `analyze`.

        Parameters
        ----------
        outputname : str
            Path to where the final file sould be saved.
        results : list of str
            Lists of all of the floods, flooded wetlands, and flooded
            buildings, respectively, that will be merged and deleted.
        sourcename : str, optional
            Path to the original source file of the results. If
            provided, its attbutes will be spatially joined to the
            concatenated results.

        Returns
        -------
        None

        """

        sourcename = kwargs.pop('sourcename', None)
        cleanup = kwargs.pop('cleanup', True)

        if outputname is not None:
            if sourcename is not None:
                tmp_fname = utils.create_temp_filename(outputname, filetype='shape')
                utils.concat_results(tmp_fname, *results)
                utils.join_results_to_baseline(
                    outputname,
                    utils.load_data(tmp_fname, 'layer'),
                    utils.load_data(sourcename, 'layer')
                )
                utils.cleanup_temp_results(tmp_fname)

            else:
                utils.concat_results(outputname, *results)

        if cleanup:
            utils.cleanup_temp_results(*results)
Ejemplo n.º 21
0
    def finish_results(outputname, results, **kwargs):
        """ Merges and cleans up compiled output from `analyze`.

        Parameters
        ----------
        outputname : str
            Path to where the final file sould be saved.
        results : list of str
            Lists of all of the floods, flooded wetlands, and flooded
            buildings, respectively, that will be merged and deleted.
        sourcename : str, optional
            Path to the original source file of the results. If
            provided, its attbutes will be spatially joined to the
            concatenated results.

        Returns
        -------
        None

        """

        sourcename = kwargs.pop('sourcename', None)
        cleanup = kwargs.pop('cleanup', True)

        if outputname is not None:
            if sourcename is not None:
                tmp_fname = utils.create_temp_filename(outputname, filetype='shape')
                utils.concat_results(tmp_fname, *results)
                utils.join_results_to_baseline(
                    outputname,
                    utils.load_data(tmp_fname, 'layer'),
                    utils.load_data(sourcename, 'layer')
                )
                utils.cleanup_temp_results(tmp_fname)

            else:
                utils.concat_results(outputname, *results)

        if cleanup:
            utils.cleanup_temp_results(*results)
Ejemplo n.º 22
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'
            )
Ejemplo n.º 23
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')
Ejemplo n.º 24
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'
            )
Ejemplo n.º 25
0
 def test_with_paths_absolute(self):
     utils.cleanup_temp_results(self.path1, self.path2)
     self.check_outcome()
Ejemplo n.º 26
0
 def test_with_names_in_a_workspace(self):
     with utils.WorkSpace(self.workspace):
         utils.cleanup_temp_results(self.name1, self.name2)
         self.check_outcome()
Ejemplo n.º 27
0
 def test_with_names_in_a_workspace(self):
     with utils.WorkSpace(self.workspace):
         utils.cleanup_temp_results(self.name1, self.name2)
         self.check_outcome()
Ejemplo n.º 28
0
 def test_with_paths_absolute(self):
     utils.cleanup_temp_results(self.path1, self.path2)
     self.check_outcome()
Ejemplo n.º 29
0
 def teardown(self):
     with utils.WorkSpace(self.workspace):
         utils.cleanup_temp_results('temp_1.tif', 'temp_2.tif')
Ejemplo n.º 30
0
 def test_with_layers(self):
     with utils.WorkSpace(self.workspace):
         lyr1 = utils.load_data('temp_1.tif', 'layer', greedyRasters=False)
         lyr2 = utils.load_data('temp_2.tif', 'layer', greedyRasters=False)
         utils.cleanup_temp_results(lyr1, lyr2)
         self.check_outcome()
Ejemplo n.º 31
0
 def test_with_bad_input(self):
     utils.cleanup_temp_results(1, 2, ['a', 'b', 'c'])
Ejemplo n.º 32
0
 def teardown(self):
     with utils.WorkSpace(self.workspace):
         utils.cleanup_temp_results('temp_1.tif', 'temp_2.tif')
Ejemplo n.º 33
0
 def test_with_rasters(self):
     with utils.WorkSpace(self.workspace):
         raster1 = utils.load_data(self.path1, 'raster')
         raster2 = utils.load_data(self.path2, 'raster')
         utils.cleanup_temp_results(raster1, raster2)
         self.check_outcome()
Ejemplo n.º 34
0
 def teardown(self):
     utils.cleanup_temp_results(*self.output)
Ejemplo n.º 35
0
 def test_with_layers(self):
     with utils.WorkSpace(self.workspace):
         lyr1 = utils.load_data('temp_1.tif', 'layer', greedyRasters=False)
         lyr2 = utils.load_data('temp_2.tif', 'layer', greedyRasters=False)
         utils.cleanup_temp_results(lyr1, lyr2)
         self.check_outcome()
Ejemplo n.º 36
0
 def test_with_bad_input(self):
     utils.cleanup_temp_results(1, 2, ['a', 'b', 'c'])
Ejemplo n.º 37
0
 def test_with_rasters(self):
     with utils.WorkSpace(self.workspace):
         raster1 = utils.load_data(self.path1, 'raster')
         raster2 = utils.load_data(self.path2, 'raster')
         utils.cleanup_temp_results(raster1, raster2)
         self.check_outcome()
Ejemplo n.º 38
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)
Ejemplo n.º 39
0
 def teardown(self):
     utils.cleanup_temp_results(*self.output)