This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

CDF (.cdf)

MIME type: application/x-cdf
CDF data file format.
General-purpose, self-describing format for storing multidimensional datasets.
Used for storage, management, and exchange of scientific data and images.
CDF is an acronym for Common Data Format.
Developed in 1985 by the National Space Science Data Center at NASA.
Binary file format.
Related to, but incompatible with, netCDF.
  • Import supports CDF 3.1 and earlier versions.
  • Mathematica by default exports CDF 2.7 files, and can also generate 64-bit enhanced CDF 3.1 files.
  • Import["file.cdf"] imports a CDF file, returning the names of the datasets stored in the file.
  • Export["file.cdf", expr] exports an array or a Graphics object to a CDF file.
  • Import["file.cdf"] returns a list of strings representing the names of all datasets contained in the file.
  • Export["file.cdf", {expr1, ...}, {"Datasets", {"/dataset1", ...}}] creates a CDF file, storing the arrays or Graphics objects {expr1, ...} as separate datasets.
  • Import["file.cdf", elem] imports the specified element from a CDF file.
  • Import["file.cdf", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.cdf", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "CDF"] or Import["file", {"CDF", elem, ...}].
  • Export["file.cdf", expr, elem] creates a CDF file by treating expr as specifying element elem.
  • Export["file.cdf", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.cdf", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.cdf", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties and settings
  • Data representation elements:
"Data"all datasets imported as a list of arrays
"Datasets"names of all datasets
  • Import by default uses the "Datasets" element for the CDF format.
  • Specifying and selecting datasets:
"Datasets", nnth dataset
"Datasets", datasetnamed dataset
  • The following values can be given for "DataFormat":
"Date"dates, given as DateList specifications
"Integer8"8-bit integers
"Integer16"16-bit integers
"Integer32"32-bit integers
"UnsignedInteger8"unsigned 8-bit integers
"UnsignedInteger16"unsigned 16-bit integers
"UnsignedInteger32"unsigned 32-bit integers
"Real32"IEEE single-precision numbers
"Real64"IEEE double-precision numbers
"String"strings of ASCII characters
  • Meta-information elements:
"Annotations"meta-information for each dataset
"DataEncoding"specifies how each dataset is compressed
"DataFormat"type used to represent each dataset
"Dimensions"data dimensions of each dataset
"Metadata"general meta-information as a list of rules
  • "DataEncoding" can take the following values:
Noneno data compression is used
"AdaptiveHuffman"adaptive Huffman encoding
"GZIP"GZIP compression
"Huffman"Huffman encoding
"RLE"run-length encoding
"Append"Falsewhether to append to an existing file
"LargeFileSupport"Falsewhether to export a 64-bit CDF file
  • With the default setting "LargeFileSupport"->False, the exported file uses a 32-bit data representation conforming to Version 2.7 of the CDF format.
  • 64-bit enhanced CDF 3.1 files can be created with "LargeFileSupport"->True.