Raster to NetCDF (Multidimension)

Summary

Converts a raster dataset to a netCDF file.

Usage

Syntax

RasterToNetCDF_md (in_raster, out_netCDF_file, {variable}, {variable_units}, {x_dimension}, {y_dimension}, {band_dimension}, {fields_to_dimensions})
ParameterExplanationData Type
in_raster

The input raster dataset or raster catalog.

Raster Layer; Raster Catalog
out_netCDF_file

The output netCDF file. The filename must have a .nc extension.

File
variable
(Optional)

The netCDF variable name that will be used in the output netCDF file. This variable will contain the values of cells in the input raster.

String
variable_units
(Optional)

The units of the data contained within the variable. The variable name is specified in the Variable parameter.

String
x_dimension
(Optional)

The netCDF dimension name used to specify x, or longitude, coordinates.

String
y_dimension
(Optional)

The netCDF dimension name used to specify y, or latitude, coordinates.

String
band_dimension
(Optional)

The netCDF dimension name used to specify bands.

String
fields_to_dimensions
[[field, {dimension}, {units}],...]
(Optional)

The field or fields used to create dimensions in the netCDF file.

  • field—A field in the input raster attribute table.
  • {dimension}—The netCDF dimension name.
  • {units}—The units of the data represented by the field.
Value Table

Code Sample

RasterToNetCDF example 1 (Python window)

Converts a raster dataset to a netCDF file.

import arcpy
arcpy.RasterToNetCDF_md("C:/data/elevation","c:/output/elev.nc","elevation",
                        "meter","x","y",)
RasterToNetCDF example 2 (stand-alone script)

Converts a raster dataset to a netCDF file.

# RasterToNetCDF_Ex_02.py
# Description: Converts a raster dataset to a netCDF file.
# Requirements: None

# Import system modules
import arcpy
from arcpy import env

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inRaster = "c:/data/elevation"
outNetCDFFile = "c:/output/elevnetcdf.nc"
variable = "elevation"
units = "meter"
XDimension = "x"
YDimension = "y"
bandDimension = ""

# Process: RasterToNetCDF
arcpy.RasterToNetCDF_md(inRaster, outNetCDFFile, variable, units, 
                        XDimension, YDimension, bandDimension)

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

6/6/2013