Feature to NetCDF (Multidimension)

Summary

Converts a point feature class to a netCDF file.

Usage

  • The default variable name is the same as the input feature field name specified in the Fields to Variables parameter.

  • The type of variable is the same as the type of field.

  • Special fields Shape.X and Shape.Y are always available in the Fields to Variables drop-down list. They can be used for specifying variable names for x-coordinates and y-coordinates, respectively. If variable names are not specified or Shape.X and Shape.Y are not added to the list, the x- and y-coordinates are exported with default variable names. The default Variable names for Shape.X and Shape.Y are lon and lat, respectively, when the feature is in a geographic coordinate system. In all other cases, the default Variable names for Shape.X and Shape.Y are x and y, respectively.

  • Special fields Shape.Z and Shape.M are available in the Fields to Variables drop-down list for features with Z and M values. To export Z and M values, you must add Shape.Z and Shape.M to the list. The default Variable names for Shape.Z and Shape.M are z and m, respectively.

  • The default dimension name is the same as the input feature field name specified in the Fields to Dimensions parameter.

  • The size of a dimension is equal to the number of unique values in the respective field.

  • If no field is specified as a row dimension, then a dimension RecordID is created in the output netCDF file with a size equal to the number of features.

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

Syntax

FeatureToNetCDF(in_features, fields_to_variables, out_netCDF_file, {fields_to_dimensions})
ParameterExplanationData Type
in_features

The input point feature class.

Feature Layer
fields_to_variables
[[field, {variable}, {units}],...]

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

Four special fields—Shape.X, Shape.Y, Shape.Z, and Shape.M—can be used for exporting x-coordinates or longitude, y-coordinates or latitude, Z values, and M values of input features, respectively.

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

The output netCDF file. The file name must have an .nc extension.

File
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 feature attribute table.
  • {dimension}—The netCDF dimension name
  • {units}—The units of the data represented by the field
Value Table

Code sample

FeatureToNetCDF example 1 (Python window)

Converts a feature class to a netCDF file.

import arcpy
arcpy.FeatureToNetCDF_md("c:/data/spotelev.shp", [["Shape.X", "lon"],
                         "degree_east", ["Shape.Y", "lat", "degree_north"],
                         ["elevation", "elevation", "meter"]],
                         "c:/output/pointelev01.nc", "id")
FeatureToNetCDF example 2 (stand-alone script)

Converts a feature class to a netCDF file.

# FeatureToNetCDF_Ex_02.py
# Description: Converts a feature class to a netCDF file.
# Requirements: None

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
inFeatures = "spotelev.shp"
fieldToVariable = [["Shape.Y", "lat", "degree_north"],
                   ["elevation", "elevation", "meter"]]
outNetCDFFile = "c:/output/pointelev02.nc"
fieldToDimension = "id"

# Execute FeatureToNetCDF
arcpy.FeatureToNetCDF_md(inFeatures, fieldToVariable, outNetCDFFile, 
                         fieldToDimension)

Licensing information

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

Related topics