0

When running the following script, this error appears:

Traceback (most recent call last): File "E:\Python_scripts\Indices_to_platform_indicesgdb_V01.py", line 41, in arcpy.CopyRaster_management(latest_raster,out_loc + "/" + latest_raster,"DEFAULTS","","","","","") File "F:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\management.py", line 12737, in CopyRaster raise e ExecuteError: ERROR 999999: Error executing function. The table name is invalid. No spatial reference exists. The table was not found. [aqi_19_q4_i.tif] Failed to execute (CopyRaster).

Code is as follows:

# Import system modules
import arcpy
import os

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

from arcpy.sa import *


#Set input and output locations
in_loc = "S://gisdata/maintained/software_versions"
print in_loc
out_loc = "S://gisdata/maintained/current/Platform_indices_test.gdb"
print out_loc

#Set workspace location
arcpy.env.workspace = in_loc

index_list =['aqi', 'css']
#define latest_edition
latest_edition = 0

for ind in index_list:
  search_string = ind + "*_i.tif"
  print search_string
  raster_list = arcpy.ListRasters(search_string,"ALL")

  for i, obj in enumerate(raster_list):
    edition = int(obj[4:6] + obj[8:9])
    if edition > latest_edition:
      latest_edition = edition
      print latest_edition
      latest_raster = obj
  arcpy.CopyRaster_management(latest_raster,out_loc + "/" + latest_raster,"DEFAULTS","","","","","")


enter code here

1 Answer 1

0

.tif cannot be saved in a file geodatabase (.gdb). Also, a raster cannot have a dot in its name when saving to a gdb. You should either save the output in a folder or remove the extension .tif from the name.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.