How To: Export each time slice from a NetCDF layer as a single raster (*.tif)
Summary
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
Procedure
- Start ArcMap and create a NetCDF raster layer from the NetCDF file.
- Navigate to ArcToolbox > Multidimension Tools > Make NetCDF Raster Layer.
- Select a file for Input netCDF File, and set all the other parameters.

- Click OK. The tool creates a NetCDF raster layer and adds it to the table of contents.

- Right-click the NetCDF layer, and navigate to Layer Properties > NetCDF. Select a Band Dimension if one has not already been selected.

- In ArcMap Catalog, browse to the downloaded data (NetCDF_time_slice_to_Raster.zip) which contains a toolbox inside a geodatabase.

- Open the NetCDF_time_slice_export script tool.
- Select the Input_NetCDF_layer and an Output Folder. Click OK to run the tool.

The tool exports all the time slices (bands) from the NetCDF raster layer as TIFs. The following shows the Python code used for this script tool. This code can be modified to meet various needs.
# 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")
Related Information
Last Published: 7/6/2020
Article ID: 000011318
Software: ArcMap 10.5.1, 10.5, 10.4.1, 10.4, 10.3.1, 10.3, 10.2.2, 10.2.1, 10.2, 10.1, 10