RASTER analysis(slope)

Xristos Xristoou saxri89 at gmail.com
Sun Oct 2 08:50:56 EDT 2016


Τη Σάββατο, 1 Οκτωβρίου 2016 - 8:52:13 μ.μ. UTC+3, ο χρήστης Xristos Xristoou έγραψε:
> hello team
> 
> i want to calculate slope and aspect from some RASTER IMAGE(.grid,tiff,geotiff)
> who is the better method to can i do this ?
> with numpy and scipy or with some package?
> 
> 
> thnx you team

pydem like easy but have errors like this :

from pydem.dem_processing import DEMProcessor
filename_to_elevation_geotiff = 'dem.tif'
dem_proc = DEMProcessor(filename_to_elevation_geotiff)
mag, aspect = dem_proc.calc_slopes_directions()

error message :
Warning (from warnings module):
  File "C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 563
    self.data[data.mask] = FILL_VALUE
MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
starting slope/direction calculation for chunk 1 [0:516, 0:516]

Traceback (most recent call last):
  File "C:/Python27/test/test/slop.py", line 4, in <module>
    mag, aspect = dem_proc.calc_slopes_directions()
  File "C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 853, in calc_slopes_directions
    self.dY[te:be-1])
  File "C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 879, in _slopes_directions
    return self._tarboton_slopes_directions(data, dX, dY)
  File "C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 890, in _tarboton_slopes_directions
    self.facets, self.ang_adj)
  File "C:\Python27\lib\site-packages\numba\dispatcher.py", line 285, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "C:\Python27\lib\site-packages\numba\dispatcher.py", line 531, in compile
    cres = self._compiler.compile(args, return_type)
  File "C:\Python27\lib\site-packages\numba\dispatcher.py", line 80, in compile
    flags=flags, locals=self.locals)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 725, in compile_extra
    return pipeline.compile_extra(func)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 369, in compile_extra
    return self.compile_bytecode(bc, func_attr=self.func_attr)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 378, in compile_bytecode
    return self._compile_bytecode()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 690, in _compile_bytecode
    return self._compile_core()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 677, in _compile_core
    res = pm.run(self.status)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 257, in run
    raise patched_exception
LoweringError: Caused By:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 249, in run
    stage()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 455, in stage_objectmode_frontend
    cres = self.frontend_looplift()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 446, in frontend_looplift
    func_attr=self.func_attr)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 743, in compile_ir
    return pipeline.compile_ir(interp=interp, lifted=lifted, lifted_from=lifted_from, func_attr=func_attr)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 389, in compile_ir
    return self._compile_ir()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 697, in _compile_ir
    return self._compile_core()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 677, in _compile_core
    res = pm.run(self.status)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 257, in run
    raise patched_exception
LoweringError: Caused By:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 249, in run
    stage()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 595, in stage_objectmode_backend
    self._backend(lowerfn, objectmode=True)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 572, in _backend
    lowered = lowerfn()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 546, in backend_object_mode
    self.flags)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 869, in py_lowering_stage
    lower.lower()
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 125, in lower
    self.lower_normal_function(self.fndesc)
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 160, in lower_normal_function
    entry_block_tail = self.lower_function_body()
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 185, in lower_function_body
    self.lower_block(block)
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 200, in lower_block
    self.lower_inst(inst)
  File "C:\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python27\lib\site-packages\numba\errors.py", line 249, in new_error_context
    six.reraise(type(newerr), newerr, sys.exc_info()[2])
  File "C:\Python27\lib\site-packages\numba\errors.py", line 243, in new_error_context
    yield
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 200, in lower_block
    self.lower_inst(inst)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 65, in lower_inst
    value = self.lower_assign(inst)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 159, in lower_assign
    return self.lower_expr(value)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 242, in lower_expr
    argvals = [self.loadvar(a.name) for a in expr.args]
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 520, in loadvar
    assert name in self._live_vars, name
LoweringError: slc0.8
File "..\..\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 2176
[1] During: lowering "$1309 = call $1308(ang_adj, dX, dY, data, direction, facets, mag, shp, slc0.8)" at C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py (2176)

Failed at object (object mode backend)
slc0.8
File "..\..\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 2176
[1] During: lowering "$1309 = call $1308(ang_adj, dX, dY, data, direction, facets, mag, shp, slc0.8)" at C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py (2176)

Failed at object (object mode frontend)
Caused By:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 249, in run
    stage()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 595, in stage_objectmode_backend
    self._backend(lowerfn, objectmode=True)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 572, in _backend
    lowered = lowerfn()
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 546, in backend_object_mode
    self.flags)
  File "C:\Python27\lib\site-packages\numba\compiler.py", line 869, in py_lowering_stage
    lower.lower()
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 125, in lower
    self.lower_normal_function(self.fndesc)
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 160, in lower_normal_function
    entry_block_tail = self.lower_function_body()
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 185, in lower_function_body
    self.lower_block(block)
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 200, in lower_block
    self.lower_inst(inst)
  File "C:\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Python27\lib\site-packages\numba\errors.py", line 249, in new_error_context
    six.reraise(type(newerr), newerr, sys.exc_info()[2])
  File "C:\Python27\lib\site-packages\numba\errors.py", line 243, in new_error_context
    yield
  File "C:\Python27\lib\site-packages\numba\lowering.py", line 200, in lower_block
    self.lower_inst(inst)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 65, in lower_inst
    value = self.lower_assign(inst)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 159, in lower_assign
    return self.lower_expr(value)
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 242, in lower_expr
    argvals = [self.loadvar(a.name) for a in expr.args]
  File "C:\Python27\lib\site-packages\numba\objmode.py", line 520, in loadvar
    assert name in self._live_vars, name
LoweringError: slc0.8
File "..\..\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 2176
[1] During: lowering "$1309 = call $1308(ang_adj, dX, dY, data, direction, facets, mag, shp, slc0.8)" at C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py (2176)

Failed at object (object mode backend)
slc0.8
File "..\..\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py", line 2176
[1] During: lowering "$1309 = call $1308(ang_adj, dX, dY, data, direction, facets, mag, shp, slc0.8)" at C:\Python27\lib\site-packages\pydem-0.1.1-py2.7-win32.egg\pydem\dem_processing.py (2176)






More information about the Python-list mailing list