spacepy.pycdf.concatCDF(cdfs, varnames=None, raw=False)[source]

Concatenate data from multiple CDFs

Reads data from all specified CDFs in order and returns as if they were from a single CDF. The assumption is that the CDFs all have the same structure (same variables, each with the same dimensions and variance.)

cdfslist of Var

Open CDFs, will be read from in order. Must be a list (cannot be an iterable, as all files need to be open).

varnameslist of str

Names of variables to read (default: all variables in first CDF)


If True, read variables as raw (don’t convert epochs, etc.) Default False.


data concatenated from each CDF, with all attributes from first. Non-record-varying data is also only from first, and record variance is only checked on the first!


Read all data from all CDFs in the current directory. Note that CDFs are closed when their variable goes out of scope.

>>> import glob
>>> import spacepy.pycdf
>>> data = spacepy.pycdf.concatCDF([
...     spacepy.pycdf.CDF(f) for f in glob.glob('*.cdf')])