|
SOLUTIONS
|
MATHEMATICA IMPORT/EXPORT FORMAT
NASACDF (.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 since 1985 by the National Space Science Data Center at NASA.
Binary file format.
Related to, but incompatible with, netCDF.
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 since 1985 by the National Space Science Data Center at NASA.
Binary file format.
Related to, but incompatible with, netCDF.
- Import supports the NASA CDF 3.1 and earlier versions.
- Mathematica by default exports NASA CDF 2.7 files, and can also generate 64-bit enhanced NASA CDF 3.1 files.
Import and ExportImport and Export
- 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
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", "NASACDF"] or Import["file", {"NASACDF", elem, ...}].
- Export["file.cdf", expr, elem] creates a NASA CDF file by treating expr as specifying element elem.
- Export["file.cdf", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each
as specifying the corresponding
. - 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.
- ImportString and ExportString support the NASA CDF format.
ElementsElements
- General Import elements:
-
"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
element for the CDF format. - Specifying and selecting datasets:
-
"Datasets",n
dataset"Datasets",dataset named dataset - The following values can be given for
: -
"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
can take the following values:-
None no data compression is used "AdaptiveHuffman" adaptive Huffman encoding "GZIP" GZIP compression "Huffman" Huffman encoding "RLE" run-length encoding
OptionsOptions
- Export options:
-
"Append" False whether to append to an existing file "LargeFileSupport" False whether to export a 64-bit NASA 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.
ExamplesExamplesopen allclose all
Basic Examples (7)Basic Examples (7)
| In[1]:= |
| Out[1]= |
Show the import elements available in the example file:
| In[1]:= |
| Out[1]= |
| In[1]:= |
| Out[1]= |
| In[1]:= |
| Out[1]= | ![]() |
Importing the
dataset returns a date in the form given by DateList:
| In[1]:= |
| Out[1]= |
Read a data array from the example file and render it using MatrixPlot:
| In[1]:= |
| Out[1]= | ![]() |
Rasterize the earlier graphics and export them as an array of color values to NASA CDF:
| In[2]:= |
| Out[2]= |
Export a list of integers to NASA CDF, explicitly specifying the dataset name:
| In[1]:= |
| Out[1]= |
This imports the generated NASA CDF file:
| In[2]:= |
| Out[2]= |
New in 6 | Last modified in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »


