1

I want to calculate mean luminosity for a district using several rasters and a shapefile with administrative borders. Since I have many files, I want to do the operation iteratively using a model builder in ArcGIS. This how the model looks like:

Calculate zonal statistics as table for every raster image

My logic was as follows:

  1. Take every raster from the folder `Lights_2013_2016'
  2. Calculate zonal statistics
  3. Save statistics as a .dbf file using the original name of the file

Yet, when I perform it, I get a mistake:

Executing (Zonal Statistics as Table): ZonalStatisticsAsTable C:\Users\1\Desktop\Projects\East_Ukraine\Shapefiles\UKR_adm\UKR_adm2.shp NAME_2 D:\Lights_2013_2016\20130101.tif C:\Users\1\Documents\ArcGIS\Default.gdb\20130101.tif.dbf DATA ALL Start Time: Sun Nov 12 21:12:21 2017 ERROR 999999: Error executing function. Failed to execute (Zonal Statistics as Table). Failed at Sun Nov 12 21:12:23 2017 (Elapsed Time: 1,43 seconds)

The operation works manually. The operation does not perform in the Model Builder. Could you tell me, what did I do wrong and what should I do?

  • 1
    Unfortunately 999999 is a generic error, there's no real information on what caused this in the error message. Can you try that exact tool manually (not in model builder) and see if you get an error.. DBF files like to start with a letter, can you try manually but first rename (copy) the raster to L20130101.tif and create a table called L20130101.tif.dbf (if that still fails try the name L20130101_tif.dbf ). – Michael Stimson Nov 12 '17 at 21:06
  • Thank you, Michael. I tried what you suggested with the "L" letter but it did not work though. I get the same mistake. But I could not use the second piece of your advice: how can I replace the dot in the name by the "_" sign? – Artem Kochnev Nov 12 '17 at 21:37
  • I'm not sure in model builder but it's easy in python; that request was for executing manually to see if the .tif.dbf extension was confusing the process. – Michael Stimson Nov 12 '17 at 21:47
  • It works manually just fine. So yes, it may be the .tif.dbf problem. – Artem Kochnev Nov 12 '17 at 21:48
  • This one gis.stackexchange.com/questions/92254/… might help to set the output name with an underscore instead of a dot, I cannot attest to its efficacy because I found python easier than using the iteration in model builder. – Michael Stimson Nov 12 '17 at 21:54
1

I figured out how to circumvent the problem. Many thanks to Michael Stimson for discussion and references in the comments section.

As Michael pointed out, the problem is (most likely) that the %Name% variable contains a .tif extension in it. Taking %Name%.dbf as the end of the name produces two extensions in the end (e.g. L20130101.tif.dbf) and ArcGIS does not like it. The natural way of solving the problem is to introduce a new variable, which would contain the extension-free name only. To do that, one needs to augment the 'model' with the 'Calculate Value' tool (see the picture).

Extended Model. Calculate Value cuts the name of the variable before the extension

The Calculate Value tool manipulates existing variables using the Python code to produce something else. In my case, I just needed to use only the first 7 letters of the string variable Name, which is a string. To make the magic come true, I typed

'%Name%'[0:7]

in the input command. The ' ' signs around the %Name% are essential because ArcMap needs ' ' to interpret something as strings (if you get a 000593 Error, chances are ArcMap cannot interpret a string. See more on the issue here: http://support.esri.com/en/technical-article/000011652)

After typing that in, substitute the %Name% with the %output_value% of the Calculate Value tool, run the tool and live happily after as I do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.