raster in TOC to geotiff on disk

Discussion created by jderekito on Mar 29, 2012
Latest reply on Mar 29, 2012 by curtvprice

I am really hoping that someone out there who knows a bit about ArcPy in ArcGIS10 can help me out.  I am attempting to automate some work w/ netcdf files.  Basically, I am able to automate the creation of the netcdf into a raster with arcpy.MakeNetCDFRasterLayer_md.  However, I would simply like to then in the same python script save this layer out to a geotiff on my disk so that I can use it later in some analysis.  Manually, I know I can go to the TOC right-click and export to geotiff, but it would be great to be able to script this.  Any help would be greatly appreciated.  I have pasted my arcpy code below for anyone???s reference which works to add the netcdf as a raster to the TOC, but I am stuck after that.


import arcpy

arcpy.env.workspace = "C:/data/NEMAC/Projects/NCA/ArcGISScripting/ArcPy"

mxd = arcpy.mapping.MapDocument("CURRENT")

# Local variables:
crcm_ccsm_cdd_mean_nc = "C:\\Data\\NEMAC\\Projects\\NCA\\NCANetcdfProcessing\\output_files\\crcm_ccsm_cdd_mean.nc"
outputRaster = "C:\\Data\\NEMAC\\Projects\\NCA\\ArcGISScripting\\ArcPy\\result1_Layer3.tif"

# Process: Make NetCDF Raster Layer
test = arcpy.MakeNetCDFRasterLayer_md(crcm_ccsm_cdd_mean_nc, "result1", "xc", "yc", outputRaster, "", "", "BY_VALUE")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
addLayer = arcpy.mapping.Layer(r"C:\Data\NEMAC\Projects\NCA\ArcGISScripting\ArcPy\result1_Layer3.tif")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
lyr = arcpy.mapping.ListLayers(mxd, "", df)[0].name
#arcpy.mapping.ExportToTIFF(lyr, r"C:\Data\NEMAC\Projects\NCA\ArcGISScripting\ArcPy\result1_Layer3.tif"
del mxd, addLayer
#arcpy.SaveToLayerFile_management("C:\\Data\\NEMAC\\Projects\\NCA\\ArcGISScripting\\ArcPy\\result1_Layer3.tif", "C:\\Data\\NEMAC\\Projects\\NCA\\ArcGISScripting\\ArcPy\\result1_Layer3.tif", "ABSOLUTE")