Table to NetCDF (Multidimension)

Summary

Converts a table to a netCDF file.

Usage

  • The default variable name is the same as the field name specified in the Fields to Variables (fields_to_variables in Python) parameter.

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

  • The default dimension name is the same as the field name specified in the Fields to Dimensions (fields_to_dimensions in Python) parameter.

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

  • If no field is specified as dimension, then a dimension named RecordID is created in the output netCDF file.

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

  • The tool writes variables either as Discrete Sample Geometry (DSG) such as points, or as gridded data following the CF conventionsLink to CF Conventions website, depending on the fields specified in the Fields to Dimensions parameter.

    • If the default, non-geometry type fields are specified in Fields to Dimensions parameter, the tool writes variables as Discrete Sample Geometry (DSG) such as points or trajectory following the CF-convention. Since, these data are not gridded, the variables in the output netCDF file is not suitable for creating a voxel layer.
    • If the geometry type fields such as Shape.X and Shape.Y are specified as coordinate dimensions in Fields to Dimensions parameter, the tool writes variable as regularly spaced gridded data following the CF-convention. Therefore, the variable in the output netCDF file is suitable for creating a voxel layer.

Parameters

LabelExplanationData Type
Input Table

The input table.

Table View
Fields to Variables

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

  • 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
Output netCDF File

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

File
Fields to Dimensions
(Optional)

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

  • Field—A field in the input table.
  • Dimension—The netCDF dimension name
  • Units—The units of the data represented by the field
Value Table

arcpy.md.TableToNetCDF(in_table, fields_to_variables, out_netCDF_file, {fields_to_dimensions})
NameExplanationData Type
in_table

The input table.

Table View
fields_to_variables
[[field, {variable}, {units}],...]

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

  • 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 that will be used to create dimensions in the netCDF file.

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

Code sample

TableToNetCDF example 1 (Python window)

Converts a table to a netCDF file.

import arcpy
arcpy.TableToNetCDF_md("c:/data/netcdfgisdata/rainfall.dbf",
                       "longitude longitude degree_east;latitude latitude degree_north",
                       "c:/output/rain.nc","station station")
TableToNetCDF example 2 (stand-alone script)

Converts a table to a netCDF file.

# Name: TableToNetCDF_Ex_02.py
# Description: 
# Requirements: none

# Import system modules
import arcpy

# Set local variables
inTable = "c:/data/netcdfgisdata/rainfall.dbf"
fieldVariableUnits = "longitude longitude degree_east;latitude latitude degree_north"
outNetCDFFile = "c:/output/rain.nc"
fieldDimensionUnits = "station station"

# Execute SelectByDimension
import arcpy
arcpy.TableToNetCDF_md(inTable, fieldVariableUnits, outNetCDFFile, fieldDimensionUnits)

Licensing information

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

Related topics