3

Is it possible to access the "Export Raster Data" tool in arcpy?

Some background on the steps I am trying to process: I have a raster loaded into an mxd. I have converted the raster to a temporary layer ("make raster layer" tool) file so that tabular data (in the form of a .csv file) can be joined (via Add Join tool) based on a common field. I then export the raster layer with the joined tabular data to a new raster. My issue is with the last step: export to new raster.

The "Export Raster Data" tool that is accessed by right clicking on the raster layer to bring up the Data/Export Data menus produces a new raster in about 30mins. The file is exported to a file geodatabase with the same spatial reference and non compression type.

The "Copy Raster" tool provides the same output as "Export Raster Data" tool but takes 14hours to run on the same dataset. The file is exported to a file geodatabase and optional values are left blank.

I have hundreds of rasters that I need to export so I have been building a python script to do the process for me (convert to raster layer, join tabular data, and export to new raster). But since the "Copy Raster" tool is taking too long to run, I want to find a way to use the "Export Raster Data" tool in the script.

I have also tried the "Copy" tool and the "Raster to Other Format Conversion" tool but they do not handle raster layer files.

I am running ArcGIS 10.2 Basic with Spatial Analyst Extension. Below are the python snippets extracted from ArcMap once the tools were run in the mxd. The last tool (copy raster) took 14hrs to run in arcmap so I'm looking for an alternative (such as the export raster data tool).

print "     make raster layer"
arcpy.MakeRasterLayer_management("D:/Alces_Projects/AO_Alberta_NEW/Data/Indicators/Climate/ClimateChange_Processing_CAAB_20160411.gdb/blank_canvas_Tier3Tile5_v1f_20160411","blank_canvas_Tier3Tile5_v1f_20160411_layer","#","D:/Alces_Projects/AO_Alberta_NEW/Data/Indicators/Climate/ClimateChange_Processing_CAAB_20160411.gdb/blank_canvas_Tier3Tile5_v1f_20160411","#")
print "     add join to csv data"
arcpy.AddJoin_management("blank_canvas_Tier3Tile5_v1f_20160411_layer","Value","D:/Alces_Projects/AO_Alberta_NEW/Data/Indicators/Climate/ClimateChange_Software_Output_Files/DecadeScenarios/Tier3Tile5_Decade_1921_1930.csv","ID1","KEEP_ALL")
print "     copy joined raster to new raster"
arcpy.CopyRaster_management("blank_canvas_Tier3Tile5_v1f_20160411_layer","Tier3Tile5_Decade_1921_1930","#","#","2147483647","NONE","NONE","#","NONE","NONE")

I thought I would edit this post to include the solution that I found to the problem. Turns out the issue was with the join to the csv file. I converted the csv to DBASE file and the copy raster process ran in minutes instead of hours.

closed as off-topic by PolyGeo Sep 17 '16 at 23:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you include a code snippet to illustrate the process that takes 14 hours instead of your expected 30 mins, please? And a more detailed description of the steps you perform in ArcMap which starts from a Blank Map and adds the raster. I suspect that your script must be doing something more than a straight copy of your data in the same coordinate system. Your mention of "joined attribute data" makes me think there may be more to this than you have detailed so far. – PolyGeo Apr 19 '16 at 21:48
  • Hi PolyGeo - I have reworded my question in hopes of reopening it. All of the processes that I outline are done in an mxd and I am trying to find a time efficient process that can be replicated in a python script. If it would be helpful to provide the python snippets of the tools used in the mxd I can provide those. – BorealGIS Apr 19 '16 at 23:00
  • I'm still struggling to distinguish in your question where you are describing things that you have in an existing code snippet, and tools that you are running one at a time using their tool dialogs or perhaps via the Python window. – PolyGeo Apr 19 '16 at 23:11
  • All tools are currently being run one at a time in an mxd but as I run the tool I extract the python snippet to a new arcpy script. My issue is that I cannot find a snippet to run the "Export Raster Data" tool and I'm hoping someone has that code that they could share. Here are the python snippets that I currently have copied from running the tools in ArcMap mxd: – BorealGIS Apr 19 '16 at 23:53
  • 'print " make raster layer" arcpy.MakeRasterLayer_management("D:/Alces_Projects/AO_Alberta_NEW/Data/Indicators/Climate/ClimateChange_Processing_CAAB_20160411.gdb/blank_canvas_Tier3Tile5_v1f_20160411","blank_canvas_Tier3Tile5_v1f_20160411_layer","#","D:/Alces_Projects/AO_Alberta_NEW/Data/Indicators/Climate/ClimateChange_Processing_CAAB_20160411.gdb/blank_canvas_Tier3Tile5_v1f_20160411","#")' – BorealGIS Apr 19 '16 at 23:59