Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils.raster_to_polygons failing with ExecuteError #47

Open
HEdingfield opened this issue Nov 18, 2015 · 5 comments
Open

utils.raster_to_polygons failing with ExecuteError #47

HEdingfield opened this issue Nov 18, 2015 · 5 comments

Comments

@HEdingfield
Copy link
Contributor

This error currently causes 6 tests to fail:

  • Test_Flooder.test_analyze_no_optional_input
  • Test_Flooder.test_main_execute
  • Test_Flooder.test_main_execute_no_assets
  • Test_StandardScenarios.test_analyze_no_optional_input
  • Test_StandardScenarios.test_main_execute
  • Test_StandardScenarios.test_main_execute_no_assets

Traceback:

Analyzing flood elevation: 7.8 ft
---------------------------------
WorkSpace set to H:\Dev\PyCharm Projects\python-tidegates\tidegates\testing\analyze
Loading DEM H:\Dev\PyCharm Projects\python-tidegates\tidegates\testing\analyze\dem.tif
Processing H:\Dev\PyCharm Projects\python-tidegates\tidegates\testing\analyze\zones.shp polygons
Clipping DEM to extent of H:\Dev\PyCharm Projects\python-tidegates\tidegates\testing\analyze\zones.shp
Converting rasters to arrays
Flooding areas up to 7.8 ft
Converting flooded array to a raster dataset
Converting raster of floods to polygons



Error
Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.2\lib\unittest\case.py", line 327, in run
    testMethod()
  File "C:\Python27\ArcGIS10.2\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "H:\Dev\PyCharm Projects\python-tidegates\tidegates\tests\test_toolbox.py", line 361, in test_analyze_no_optional_input
    buildings=None
  File "H:\Dev\PyCharm Projects\python-tidegates\tidegates\toolbox.py", line 662, in analyze
    asMessage=True
  File "H:\Dev\PyCharm Projects\python-tidegates\tidegates\analysis.py", line 149, in flood_area
    **verbose_options
  File "H:\Dev\PyCharm Projects\python-tidegates\tidegates\utils.py", line 285, in wrapper
    return func(*args, **kwargs)
  File "H:\Dev\PyCharm Projects\python-tidegates\tidegates\utils.py", line 719, in raster_to_polygons
    raster_field="Value",
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\conversion.py", line 241, in RasterToPolygon
    raise e
ExecuteError: ERROR 010157: Unable to open feature class H:\Dev\PyCharm Projects\python-tidegates\tidegates\testing\analyze\_temp_flooding_no_opts7_8.
Failed to execute (RasterToPolygon).
@phobson
Copy link
Contributor

phobson commented Nov 18, 2015

I thought #45 took care of this?

@HEdingfield
Copy link
Contributor Author

No, this problem still exists and is triggered by 11 tests now that I got Fiona working. In addition to the 6 above:

  • test_analysis.test_flood_area
  • Test_Flooder.test_analyze_no_optional_input
  • Test_StandardScenarios.test_analyze_no_optional_input
  • test_utils.test_raster_to_polygons
  • test_utils.test_raster_to_polygons_with_new_field

@phobson
Copy link
Contributor

phobson commented Nov 19, 2015

@HEdingfield can you take a crack at fixing the function? can you get that arcpy function to work outside of the tool?

@phobson
Copy link
Contributor

phobson commented Nov 19, 2015

@HEdingfield try forcing the function to use the spatial extension, i.e.,

@update_status() # layer
def raster_to_polygons(zonal_raster, filename, newfield=None):
    """ ... """
    with OverwriteState(True), Extension("spatial"):
        results = arcpy.conversion.RasterToPolygon(
            in_raster=zonal_raster,
            out_polygon_features=filename,
            simplify="SIMPLIFY",
            raster_field="Value",
        )

    [yada yada]

@phobson
Copy link
Contributor

phobson commented Nov 19, 2015

@HEdingfield

And before you get too far down the rabbit hole, clone in to a fresh, normal directory away from pycharm and try the tests:

cd C:\users\hedingfield\Desktop
pip uninstall tidegates
git clone git@github.com:Geosyntec/python-tidegates.git
cd python-tidegates
pip install -e .
nosetests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants