hi, I'm just trying to copy TIF rasters into a file geodatabase that I create. But the copied rasters in the new file geodatabase are corrupted. The corrupted rasters have no cell size in the properties and no statistics and they show that default range of -3.4e+038 to 3.4e+038. Calculating statistics on them gives an error.
At first I thought the input list to the RasterToGeodatabase tool might be the problem but it looked looked fine (raster names separated by semicolons). But even when I try to copy a single raster, it gets corrupted.
This seems pretty straightforward, can't imagine what I'm doing wrong. Thanks for any help...
import arcpy
from arcpy.sa import *
import datetime
arcpy.CheckOutExtension("Spatial")
todaysDateString = datetime.date.today().strftime("%Y%m%d")
out_folder_path = "Y:\\SCHISM_Data"
out_name = "SCHISM_Data_" + todaysDateString + "_test_FGDB_extractCode.gdb"
arcpy.CreateFileGDB_management(out_folder_path, out_name)
arcpy.env.workspace = "C:\\SCHISM_project\\output_test_FGDB"
rasterList = arcpy.ListRasters("*Con*")
rasterPathList = []
for eachRaster in rasterList:
rasterPathList.append(eachRaster)
finalRasterPathList = (";".join((i for i in rasterPathList)))
arcpy.RasterToGeodatabase_conversion(finalRasterPathList, out_folder_path + "\\" + out_name)
Solved! Go to Solution.
Well try resetting your application profile on that machine
https://community.esri.com/docs/DOC-2121-resetting-your-arcgis-application-profile
And to be on the safe side... go to Control Panel, Add/Remove programs and do a 'Repair' when asked.
Also go clean out all the cobwebs from your machine.... (temp folders etc etc especially any remnants of 3rd party applications in your c:\users... path
could you throw some print statements in to capture the file paths and filenames to verify what is going in is what is intended and where it is going is as designed.
Thanks Dan, I've crystallized the problem much more. Now, as a test, I'm simply trying to get a floating point TIF raster into a file geodatabase :
import arcpy
arcpy.RasterToGeodatabase_conversion("C:/SCHISM_project/output_test_FGDB/test_Manual.tif", "C:/test.gdb")
The resulting flie geodatabase raster is corrupted as described above. But I can import it manually just fine. I'm stumped.
http://pro.arcgis.com/en/pro-app/tool-reference/conversion/raster-to-geodatabase-multiple-.htm
shows nothing out of the ordinary given your inputs.... which leads me to ask the nature of the tif? singleband? multiband, type?
and finally have you tried to use another *.tif.?
I am just trying to get the obvious checks ruled out.
I also noticed they prefer destinations like this, might be worth a try ..... "ToGDB.gdb\\catalog"
Single band, just tried to copy another TIF, same bad result. I'll try the different path notation and get back to you. Thanks!
Do it manually and copy the code snippet from the Results window.
All the python examples I see have set arcpy.env.workspace ahead of time for some reason.
I am beginning to think that might be an issue. So go the manual route, get the code snippet and post it
I tried it on another machine and it works. So there's something peculiar going on with this particular machine.
Well try resetting your application profile on that machine
https://community.esri.com/docs/DOC-2121-resetting-your-arcgis-application-profile
And to be on the safe side... go to Control Panel, Add/Remove programs and do a 'Repair' when asked.
Also go clean out all the cobwebs from your machine.... (temp folders etc etc especially any remnants of 3rd party applications in your c:\users... path
will do, thanks again
glad you got it working Dan