hi, I'm simply trying to take a bunch of rasters in a directory and process each of them in my "for" loop. The first thing I need to do is project it. For some mysterious reason, the code goes through the loop the first time and processes the first raster fine, but I get an exception on the second raster (second loop iteration) on the ProjectRaster line (line 22) with the error "Undefined coordinate system for input dataset". All the rasters have the same defined coordinate system, and this happens no matter what rasters are in the list. It does the first one just fine, but when it loops back again to do the second one, I get the error. I can see it is reading the file list properly by looking at the string values it is using so no idea what the problem is. Here's the relevant code, thanks for any help!
# Import necessary modules
import glob, os
from arcpy.sa import *
arcpy.env.workspace = "I:/SCHISM_project/HPC/output"
arcpy.env.overwriteOutput = True
for originalElevationRasterString in glob.glob("*.tif"):
rasterTimeString = originalElevationRasterString[8:23]
originalElevationRasterBaseString = originalElevationRasterString[0:23]
# Project surface water elevation from Geographic to UTM
UTMProjection = arcpy.SpatialReference(26918)
originalElevationRasterUTMString = originalElevationRasterBaseString + "_UTM.tif"
print "Projecting water elevation to UTM..."
arcpy.ProjectRaster_management(originalElevationRasterString, originalElevationRasterUTMString, UTMProjection)