Drift shells describe the toroidal surface swept out by a charged particle as it simultaneously bounces between mirror points and drifts azimuthally around the Earth under gradient and curvature forces. These routines trace that surface, compute the resulting magnetic coordinates (Lm, L*, Bmin, XJ, MLT), and provide Python helpers for derived quantities such as the bounce period and mirror point altitude.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PRBEM/IRBEM/llms.txt
Use this file to discover all available pages before exploring further.
DRIFT_SHELL
DRIFT_SHELL traces a complete drift shell for locally mirroring particles (pitch angle = 90°) whose mirror point is at the input location. The routine samples 48 azimuths and returns up to 1000 field-line points per azimuth, providing full three-dimensional geometry of the shell for visualization or further analysis.
To retrieve only positions between the mirror points (the drift-bounce orbit), use DRIFT_BOUNCE_ORBIT, which samples 25 azimuths and supports arbitrary pitch angles.
Parameters
Position and time dictionary with keys
x1, x2, x3 (coordinates in sysaxes) and dateTime (ISO 8601 string, datetime.datetime, or pd.Timestamp). This is the starting mirror point.Outputs
McIlwain L parameter for the drift shell.
Roederer L* or Φ = 2π B₀/L* (nT Re²), depending on
options[0].Magnetic field magnitude at each traced point along the shell (nT). Rows correspond to the 48 azimuthal field lines; unused trailing elements are set to
NaN.Minimum magnetic field magnitude along the drift shell (nT).
Second adiabatic invariant I (Re).
GEO Cartesian coordinates [x, y, z] of each point on the drift shell (Re). Unused trailing points per field line are set to
NaN.Number of valid field-line points for each of the 48 traced azimuths.
Calling sequences
DRIFT_BOUNCE_ORBIT
DRIFT_BOUNCE_ORBIT traces the drift-bounce orbit — the portion of the drift shell between mirror points — for a particle with a specified pitch angle at the input location. Compared to DRIFT_SHELL, it samples 25 azimuths (rather than 48), returns only points between the mirror points, and provides additional outputs describing the minimum-altitude point along the drift path.
Parameters
Position and time dictionary. Keys:
x1, x2, x3, dateTime.Local pitch angle at the input position (degrees). Default is 90° (locally mirroring).
Minimum allowed radial distance along the drift path (Re). Use
R0 = 1 for standard trapped particles. Set R0 < 1 when working in the drift loss cone.Outputs
McIlwain L parameter.
Roederer L* or Φ, depending on
options[0].Magnetic field magnitude at each traced point (nT). Unused trailing elements per azimuth are set to
NaN.Minimum magnetic field magnitude along the orbit (nT).
Magnetic field magnitude at the mirror point (nT).
Second adiabatic invariant I (Re).
GEO Cartesian coordinates [x, y, z] of each point on the drift-bounce orbit (Re). Unused trailing points are set to
NaN.Number of valid field-line points for each of the 25 traced azimuths.
Altitude (km, GDZ) of the minimum-altitude point along the drift path among all traced azimuths.
Longitude (°, GDZ) of the minimum-altitude point.
Calling sequences
MagFields.bounce_period (Python only)
bounce_period computes the bounce period of a particle travelling along a magnetic field line in the configured field model. It traces the field line with trace_field_line, interpolates the field profile, and numerically integrates ds / v‖ between the two mirror points to obtain the period. The default particle type is electrons; change Erest for other species.
This is a Python-only helper method. It is not part of the underlying Fortran IRBEM library and has no FORTRAN, MATLAB, or IDL equivalent.
Parameters
Position and time dictionary. Keys:
x1, x2, x3, dateTime.Particle kinetic energy (keV). A single value returns a scalar period; an array returns an array of periods.
Particle rest-mass energy (keV). Default is 511 keV for electrons. Use 938272 keV for protons, etc.
Reference surface radius (Re) at which field-line tracing stops.
Local pitch angle at the input position (degrees).
Number of interpolation samples along the field line used in the numerical integration. Higher values improve accuracy at the cost of speed; 100,000 is a good balance.
Outputs
Bounce period(s) in seconds. Shape matches the input
E.Example
MagFields.mirror_point_altitude (Python only)
mirror_point_altitude calculates the altitude of the mirror point in the opposite hemisphere for a locally mirroring particle. It traces the field line and identifies the mirror point on the far side by locating the intersection of the interpolated field profile with the mirror-field value.
This is a Python-only helper method with no Fortran, MATLAB, or IDL equivalent. For the mirror point in the same or an arbitrary hemisphere, use
find_mirror_point() instead.Parameters
Position and time dictionary. Keys:
x1, x2, x3, dateTime.Reference surface radius (Re) used during field-line tracing.
Outputs
Altitude of the mirror point in the opposite magnetic hemisphere (km above Earth’s surface).