Zonal statistics error in arcpy

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 -", line 21, in <module>
  File "c:program", line 6328, in ZonalStatistics
  File "c:program", line 53, in swapper
    result = wrapper(*args, **kwargs)
  File "c:program", line 6321, in Wrapper
  File "c:program", 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 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'

for tiff in rasters:
#Zonal statistics
    Zonaltif = ZonalStatistics(fc, ["ID_TALHAO"], tiff, "MEAN")'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?

One Answer

Deleting spaces in output file directory worked in my case. Thanks!

Answered by Alex on August 18, 2020

Add your own answers!

Related Questions

Converting polygon to line with neighbor info using QGIS?

0  Asked on July 7, 2021 by radek-nakielski


Can catalog_apply output a LAScatalog?

1  Asked on July 6, 2021 by kah574


Buffer around suburb lines

0  Asked on July 6, 2021


Raster to GeoTIFF file conversion problem

0  Asked on July 6, 2021


How to write sderaster commands

1  Asked on July 6, 2021


OpenLayers print preview

0  Asked on July 6, 2021 by r-kut


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir