I use the uncompressed size method in the tool validation just as a quick way to automatically select the largest raster in a TOC which is usually the watershed wide Lidar.
To get the actual size of a raster with it's associated files such as .ovr and .aux.xml using the os library I've used this code:
import os
raster = # Path to raster file
basename = os.path.basename(raster).split(".")[0]
rootFolder = os.path.dirname(raster)
associatedFiles = [os.path.join(rootFolder,f) for f in next(os.walk(os.path.dirname(raster)))[2] if f.split(".")[0] == basename]
if len(os.path.basename(raster).split(".")) == 1:
fileList = next(os.walk(raster))[2]
dirSize = sum([os.path.getsize(os.path.join(raster,f)) for f in fileList])
rasSize = sum([os.path.getsize(f) for f in associatedFiles]) + dirSize
else:
rasSize = sum([os.path.getsize(f) for f in associatedFiles])
def convertSize(size,precision=2):
suffixes=['B','KB','MB','GB','TB']
suffixIndex = 0
while size > 1024 and suffixIndex < 4:
suffixIndex += 1 #increment the index of the suffix
size = size/1024.0 #apply the division
return "%.*f %s"%(precision,size,suffixes[suffixIndex])
print convertSize(rasSize)
The conversion part of the script was found here. The os.getsize function only returns the size of the file not the size on disk which incorporates the allocated size on the hard drive for the file metadata as seen in the properties of a file.