Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/test/ArcGISScripting/ArcPy"

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

# Local variables:
crcm_ccsm_cdd_mean_nc = "C:\\Data\\test\\output_files\\"
outputRaster = "C:\\Data\\test\\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\test\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\test\ArcGISScripting\ArcPy\result1_Layer3.tif"
del mxd, addLayer
#arcpy.SaveToLayerFile_management("C:\\Data\\test\\ArcGISScripting\\ArcPy\\result1_Layer3.tif", "C:\\Data\\test\\ArcGISScripting\\ArcPy\\result1_Layer3.tif", "ABSOLUTE")
share|improve this question
up vote 4 down vote accepted

If you don't need to add the netcdf layer to ArcMap, skip the add to ArcMap TOC step and convert straight to tif:

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

# Process: Make NetCDF Raster Layer
result = arcpy.MakeNetCDFRasterLayer_md(crcm_ccsm_cdd_mean_nc, "result1", "xc", "yc", nc_lyr, "", "", "BY_VALUE")
result = arcpy.CopyRaster_management(nc_lyr,outputRaster)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.