Geographic Information Systems Asked by Charlera on August 18, 2020
I’m trying to get the zonal statistics output (mean), do some operations and add to my main archive the output value. I wrote this code, but it’s not running, the error message is:
Traceback (most recent call last):
File "Z:4 - TempCharlesNDVI_tempoNDVI_py3.tbx#Script3_NDVIpy3.py", line 21, in <module>
File "c:program filesarcgisproResourcesarcpyarcpysaFunctions.py", line 6328, in ZonalStatistics
ignore_nodata)
File "c:program filesarcgisproResourcesarcpyarcpysaUtils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "c:program filesarcgisproResourcesarcpyarcpysaFunctions.py", line 6321, in Wrapper
ignore_nodata)
File "c:program filesarcgisproResourcesarcpyarcpygeoprocessing_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool
Failed to execute (Script3).
import arcpy
import os
import datetime
from arcpy import env
from arcpy.sa import *
#Declarar as variáveis
arcpy.env.workspace = 'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL'
fcs = arcpy.ListFeatureClasses()
rasters = arcpy.ListRasters("test*", "All")
fc = 'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL\MA02ASEZ3S'
arcpy.CheckOutExtension("Spatial")
for tiff in rasters:
#Zonal statistics
Zonaltif = ZonalStatistics(fc, ["ID_TALHAO"], tiff, "MEAN")
Zonaltif.save('Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL\teste')
Zonalper = Times (Zonaltif, 100)
Zonalint = Int (Zonalper)
RasterToPolygon_conversion (Zonalint, Zonalpoly, "SIMPLIFY", "VALUE")
Intersect_analysis ([Zonalpoly, fc], 'Z:\04 - Temp\Charles\NDVI_tempo\NAL_PL\teste\intertif', "ALL", "", "")
What am I doing wrong?
Deleting spaces in output file directory worked in my case. Thanks!
Answered by Alex on August 18, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP