spacepy.pybats.IdlFile

class spacepy.pybats.IdlFile(filename, iframe=0, header='units', keep_case=True, *args, **kwargs)[source]
Parameters:
filenamestring

A *.out or *.outs SWMF output file name.

Other Parameters:
headerstr or None

Determine how to interpret the additional header information. Defaults to ‘units’.

keep_casebool

If set to True, the case of variable names will be preserved. If set to False, variable names will be set to all lower case.

Notes

PyBats assumes little endian byte ordering because this is what most machines use. However, there is an autodetect feature such that, if PyBats doesn’t make sense of the first read (a record length entry, or RecLen), it will proceed using big endian ordering. If this doesn’t work, the error will manifest itself through the “struct” package as an “unpack requires a string of argument length ‘X’”.

Changed in version 0.5.0: Unstructured data are presented as in the files. When reading 3D magnetosphere files, this preserves the 3D block structure, as required for the BATSRUS interpolator in the Kamodo Heliophysics model readers package. Before 0.5.0, binary unstructured data were sorted in an attempt to put nearby positions close to each other in the data arrays. This sorting was nondeterministic and has been removed; see extract() and QTree for processing adjacent cells. (ASCII data were never sorted.)