Is This Content Helpful?
We're glad to know this article was helpful.
The instructions provided describe how to export each time slice from a NetCDF layer as a single raster (*.tif).
A NetCDF layer must be created in the ArcMap table of contents before NetCDF raster bands can be exported. The needed toolbox and sample data can be downloaded here: NetCDF_time_slice_to_Raster.zip
Code: # Import modules import arcpy, os #Inputs Input_NetCDF_layer = arcpy.GetParameterAsText(0) Output_Folder = arcpy.GetParameterAsText(1) Input_Name = Input_NetCDF_layer Output_Raster = Output_Folder + os.sep + "NetCDF_Raster.tif" #Copy the NetCDF layer as a TIF file. arcpy.CopyRaster_management(Input_Name, Output_Raster) arcpy.AddMessage(Output_Raster + " " + "created from NetCDF layer") #Reading number of band information from saved TIF bandcount = arcpy.GetRasterProperties_management (Output_Raster, "BANDCOUNT") resultValue = bandcount.getOutput(0) count = 1 arcpy.AddMessage("Exporting individual bands from" + Output_Raster) #Loop through the bands and copy bands as a seperate TIF file. while count <= int(resultValue): Input_Raster_Name = Output_Raster + os.sep+ "Band_" + str(count) Output_Band = Output_Folder + os.sep + "Band_" + str(count) +".tif" arcpy.CopyRaster_management(Input_Raster_Name, Output_Band) arcpy.AddMessage("Band_" + str(count) +".tif" + " " "exported" + " " + "successfully") count +=1 # The following will delete the TIF file that was created by CopyRaster tool. arcpy.Delete_management(Output_Raster,"#") arcpy.AddMessage("Tool Executed Successfully")