I have a series of .asc files that are output from a modeling exercise (see image below). I need to scroll through each .asc raster, and calculate the mean pixel value within a certain outline. I can do this manually by using the "Calculate Statistics" tool in the Data Management toolbox and then clicking through to the Layer Properties of each .asc file. I have been successful at doing this but it is time consuming (see second image below).
I would prefer to create a script in Python to automate this process. However, when I try to run Calculate Statistics on these same files through Python, I get the following error:
CalculateStatistics_management(r"colby_cbp_run1\control_BP.asc", "1", "1", "", "OVERWRITE", path_to_area_of_interest)
Runtime error Traceback (most recent call last): File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\management.py", line 14811, in CalculateStatistics raise e ExecuteError: ERROR 000840: The value is not a Mosaic Dataset. ERROR 000840: The value is not a Mosaic Layer. ERROR 000840: The value is not a Raster Dataset.
What is happening here? Is there an error in the syntax of the above command, or do I need to convert the .asc files to another format to perform this calculation using Python? Why is the tool working one way and not the other?