ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Raster to NetCDF

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Converts a raster dataset to a netCDF file.

Usage

  • The input can be any valid raster dataset or raster catalog.

  • The default variable name is the same as the input raster name.

  • The output netCDF variable type is either float or integer based on the input raster dataset type.

  • The default x dimension and y dimension names are x and y, respectively.

  • The Band Dimension parameter is only applicable to a multiband input raster.

  • Fields-to-dimensions mapping is only applicable to a raster catalog.

  • String fields may not be used to create dimensions in the netCDF file.

  • A higher compression level will reduce the output file size and may improve performance of the tool. When the compressed netCDF file is used as an input for further analysis, it will generally perform better.

Syntax

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

The input raster dataset or raster catalog.

Raster Layer; Raster Catalog
out_netCDF_file

The output netCDF file. The file name 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 that will be used to specify x, or longitude, coordinates.

String
y_dimension
(Optional)

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

String
band_dimension
(Optional)

The netCDF dimension name that will be 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
compression_level
(Optional)

The level at which the output netCDF file will be compressed. The default value is 0, which implies no compression. A value of 9 represents maximum compression.

Long

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 = ""
compressionLevel = ""

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

Environments

  • Current Workspace
  • Scratch Workspace

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Multidimension toolbox
  • Exporting to netCDF data using geoprocessing tools
  • Feature to NetCDF
  • Table to NetCDF

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal