spacepy.pybats.bats.MagFile¶
- class spacepy.pybats.bats.MagFile(filename, ie_name=None, find_ie=False, *args, **kwargs)[source]¶
BATS-R-US magnetometer files are powerful tools for both research and operations.
MagFile
objects open, parse, and visualize such output.The $delta B$ calculated by the SWMF requires two components: GM (BATSRUS) and IE (Ridley_serial). The data is spread across two files: GM_mag*.dat and IE_mag*.dat. The former contains $delta B$ caused by gap-region (i.e., inside the inner boundary) FACs and the changing global field. The latter contains the $delta B$ caused by Pederson and Hall currents in the ionosphere.
MagFile
objects can open one or both of these files at a time; when both are opened, the total $delta B$ is calculated and made available to the user.Usage:
>>> # Open up the GM magnetometer file only. >>> obj = spacepy.pybats.bats.MagFile('GM_file.mag') >>> >>> # Open up both the GM and IE file [LEGACY SWMF ONLY] >>> obj = spacepy.pybats.bats.MagFile('GM_file.mag', 'IE_file.mag') >>> >>> # Open up the GM magnetometer file; search for the IE file. >>> obj = spacepy.pybats.bats.MagFile('GM_file.mag', find_ie=True)
Note that the find_ie kwarg uses a simple search assuming the data remain in a typical SWMF-output organizational tree (i.e., if the results of a simulation are in folder results, the GM magnetometer file can be found in results/GM/ or results/GM/IO2/ while the IE file can be found in results/IE/ or results/IE/ionosphere/). It will also search the present working directory. This method is not robust; the user must take care to ensure that the two files correspond to each other.
- __init__(filename, ie_name=None, find_ie=False, *args, **kwargs)[source]¶
Base class for “Data Model” representation data
Abstract method, reimplement
- Attributes:
- attrsdict
dictionary of the attributes of the SpaceData object
Methods
For each magnetometer object, calculate the horizontal component of the perturbations.
calc_h
()For each magnetometer object, calculate the horizontal component of the perturbations using the pythagorean sum of the two horizontal components (north-south and east-west components):
Read and parse GM file and IE file (if name given.)
Attributes
- calc_dbdt()[source]¶
For each magnetometer object, calculate the horizontal component of the perturbations.
$|dB/dt|_h$ is also calculated following the convention of Pulkkinen et al, 2013: $|dB/dt|_H = sqrt{(dB_N/dt)^2 + (dB_E/dt)^2}$
- calc_h()[source]¶
For each magnetometer object, calculate the horizontal component of the perturbations using the pythagorean sum of the two horizontal components (north-south and east-west components):
$Delta B_H = sqrt{Delta B_N^2 + Delta B_E^2}$
- attrs: collections.abc.Mapping¶