GetRasterProperties_management failing on some machines.

777
3
01-26-2012 01:18 PM
ClarenceRobison
New Contributor II
I have section of Python code that does not work on all workstations. The code snippit follows:


393: gpOutput.save(Above_Freezing_Large_Non_Tss)
394: arcpy.CalculateStatistics_management(Above_Freezing_Large_Non_Tss, 1, 1 )             
395: #
396: # Find the minimum and average temperature for large non vegetated regions
397: log.write('  Pure non-vegetated large regions with # of cells > 375\n')
398: log.write('    and temperature above '+str(Mix_Min_Value_275)+'\n')
399: gpOutput = arcpyy.GetRasterProperties_management(Above_Freezing_Large_Non_Tss,"MINIMUM")
400: PNR_Tss_Min = gpOutput.getOutput(0)
401: log.write('    Minimum temperature ....... '+PNR_Tss_Min+' K\n')
402: gpOutput = arcpy.GetRasterProperties_management(Above_Freezing_Large_Non_Tss,"MEAN")
403: PNR_Tss_Ave = gpOutput.getOutput(0)
405: log.write('    Average temperature ....... '+PNR_Tss_Ave+' K\n')


On my machine it works fine; however, on my co-workers machine it does not. The traceback occurs:

Traceback (most recent call last):[INDENT]File "D:\SHARPENING_ESPA_2009_P39\ThermalSharpen_IP_07072009.py", line 402, in <module>[/INDENT]
[INDENT=2]gpOutput = arcpy.GetRasterProperties_management(Above_Freezing_Large_Non_Tss,"MEAN")
[/INDENT]
[INDENT]    File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 8537, in GetRasterProperties[/INDENT]
[INDENT=2]raise e
[/INDENT]
ExecuteError: ERROR 001100: Failed because no statistics is available.
Failed to execute (GetRasterProperties).


This does not make any sense to me. The GetRasterProperties worked on line 399 for the minimum of the raster dataset, yet on line 402 it appears that they are unavailable ... same raster dataset.  Additionally, I have not found the 001100 error code on the web site to verify.  Both workstations report the same when I query the arcpy.env.rastStatistics property.

arcpy.env.rasterStatistics
u'STATISTICS 1 1'


Any hints? Or, is this the wrong forum
Clarence
0 Kudos
3 Replies
ChrisSnyder
Regular Contributor III
What if your coworker runs the CalculateStatistics_management() tool prior to running the script?

Is the raster stored somewhere where both of you lack write access? If so, are your rasterproxy directories set to the same location? If not, perhaps it works for you since you calced stats on it (maybe a long time ago) and have that data in the raster's .aux file in your rasterproxy directory, where your coworker hasn't ever calced stats, and can't read the .aux from your rasterproxy directory.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t00000024000000
0 Kudos
ClarenceRobison
New Contributor II
What if your coworker runs the CalculateStatistics_management() tool prior to running the script?

Is the raster stored somewhere where both of you lack write access? If so, are your rasterproxy directories set to the same location? If not, perhaps it works for you since you calced stats on it (maybe a long time ago) and have that data in the raster's .aux file in your rasterproxy directory, where your coworker hasn't ever calced stats, and can't read the .aux from your rasterproxy directory.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009t00000024000000


No, it is a temporary raster store in the current workspace. The raster is created and the .aux.xml file is available. If you notice, I calculate the statistics a few line prior to the request. And, the request for the minimum value does not throw an exception (three lines prior to the one throwing the exception.

I am looking the differences in my script test data package and my user's test data package.

Will advise ....
0 Kudos
ChrisSnyder
Regular Contributor III
Could it be that you and your coworked have your "maximum number of unique values allowed in a raster attribute table" values set differently?

http://support.esri.com/en/knowledgebase/techarticles/detail/35053

Maybe that would cause some discrepency?

I notice that if I have a largerish .tif image (75 MB) and I delete the .aux file (it still has a .tfw file), and I run GetRasterProperties, I get:

Executing: GetRasterProperties 18400_clp.tif MINIMUM
Start Time: Tue Jan 31 16:00:04 2012
ERROR 001100: Failed because no statistics is available.
Failed to execute (GetRasterProperties).
Failed at Tue Jan 31 16:00:04 2012 (Elapsed Time: 0.00 seconds)

When I build statistics 1st though, the tool runs fine...

Seems like for whatever reason your coworker's computer is forgetting about the .aux file and/or the stat calculations contained in it.

Is the 'Above_Freezing_Large_Non_Tss' variable pointing to an actual raster dataset (i.e. r"C:\temp\test.gdb\my_raster"), or a "raster layer", or some weird thing like a "layer package".
0 Kudos