Ok, after some iterations on my script I found out, that the
gdbList = arcpy.ListWorkspaces('*','FileGDB')
for gdb in gdbList:
arcpy.env.workspace = gdb
datasetList = arcpy.ListDatasets('*','Raster')
for dataset in datasetList:
arcpy.env.workspace = dataset
part is useless because I just want the FGDBR within each file geodatabase...
I shortened my loops accordingly:
import arcpy
from arcpy import env
import os
arcpy.env.overwriteOutput = True
arcpy.env.parallelProcessingFactor = "75%"
dir = r"F:\Daten_Wolff\Topographische_Gefaehrdungsanalyse\Test_Source"
arcpy.env.workspace = dir
gdbList = arcpy.ListWorkspaces('*','FileGDB')
for gdb in gdbList:
print("processing Workspace: %s" %os.path.join("env.workspace",gdb))
arcpy.env.workspace = gdb
folder = r"F:\Daten_Wolff\Topographische_Gefaehrdungsanalyse\BlueSpot_50.gdb"+ "\\"
RasterList = arcpy.ListRasters('*_050*')
for Raster in RasterList:
print("processing raster: %s" %os.path.join("env.workspace",Raster))
outRasterdataset = folder + str(Raster.rsplit("_",0)[0])
arcpy.CopyRaster_management (Raster, outRasterdataset, "DEFAULTS", "", "-999", "NONE", "NONE" , "32_BIT_FLOAT", "NONE", "NONE" )
So technically my script should go through each file geodatabase and then check für FGDBRs ending with *_050 in the filename and copy them into my target file geodatabase named "folder".
Sadly I get this error message now:
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
= RESTART: F:/Daten_Wolff/Scripte/Zentrale_Scripte/Topostar_Copy_raster_4.py =
processing Workspace: F:\Daten_Wolff\Topographische_Gefaehrdungsanalyse\Test_Source\T2718199.gdb
processing raster: env.workspace\bluespot_T2718199_050
Traceback (most recent call last):
File "F:/Daten_Wolff/Scripte/Zentrale_Scripte/Topostar_Copy_raster_4.py", line 24, in <module>
arcpy.CopyRaster_management (Raster, outRasterdataset, "DEFAULTS", "", "-999", "NONE", "NONE" , "32_BIT_FLOAT", "NONE", "NONE" )
File "C:\Program Files\ESRI\ArcGISPro\Resources\ArcPy\arcpy\management.py", line 15289, in CopyRaster
raise e
File "C:\Program Files\ESRI\ArcGISPro\Resources\ArcPy\arcpy\management.py", line 15286, in CopyRaster
retval = convertArcObjectToPythonObject(gp.CopyRaster_management(*gp_fixargs((in_raster, out_rasterdataset, config_keyword, background_value, nodata_value, onebit_to_eightbit, colormap_to_RGB, pixel_type, scale_pixel_value, RGB_to_Colormap, format, transform), True)))
File "C:\Program Files\ESRI\ArcGISPro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
The table was not found. [VAT_bluespot_T2718199_050]
No spatial reference exists.
The table was not found. [bluespot_T2718199_050]
Failed to execute (CopyRaster).
>>>
So, where is my mistake? Any advice greatly appreciated!
Cheers
Ingo