IRBEM.jl
Julia wrapper for the IRBEM (International Radiation Belt Environment Modeling)
IRBEM
— ModuleA wrapper for International Radiation Belt Environment Modeling (IRBEM) library
See the Documentation for more information.
Functions
Computing magnetic field coordinates
make_lstar
: Compute magnetic coordinates at a spacecraft positionget_mlt
: Get Magnetic Local Time from GEO position and date
Points of interest on the field line
find_mirror_point
: Find magnitude and location of mirror point along field linefind_foot_point
: Find footprint of field line in a given hemispherefind_magequator
: Find coordinates of magnetic equator from field line tracing
Magnetic field computation
get_field_multi
: Compute GEO vector of magnetic field at input locationget_bderivs
: Compute the magnetic field and its 1st-order derivatives at each input location
Field tracing
trace_field_line
: Trace a full field line crossing the input positiondrift_shell
: Trace a full drift shell for particles with mirror point at input locationdrift_bounce_orbit
: Trace a full bounce orbit for particles with mirror point at input location
Coordinates transformations
transform
: Transform coordinates from one system to another
Library information
get_igrf_version
: Returns the version number of the IGRF modelirbem_fortran_version
: Provides the repository version number of the fortran source codeirbem_fortran_release
: Provides the repository release tag of the fortran source code
References
API Reference
Computing magnetic field coordinates
IRBEM.make_lstar
— Functionmake_lstar(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
make_lstar(model::MagneticField, X, maginput=Dict())
Compute magnetic coordinates at a spacecraft position.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fields Lm, MLT, Blocal, Bmin, Lstar, and XJ
Examples
julia> make_lstar("2015-02-02T06:12:43", [600.0, 60.0, 50.0], "GDZ", Dict("Kp" => 40.0))
(Lm = 3.5597242229067536, Lstar = -1.0e31, Blocal = 42271.43059990003, Bmin = 626.2258295723121, XJ = 7.020585390925573, MLT = 10.170297893176182)
IRBEM.get_mlt
— Functionget_mlt(model::MagneticField, X::Dict)
Get Magnetic Local Time (MLT) from a Cartesian GEO position and date.
Arguments
model::MagneticField
: The magnetic field modelX::Dict
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in GEO system
Points of interest on the field line
IRBEM.find_mirror_point
— Functionfind_mirror_point(time, x, alpha, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_mirror_point(model::MagneticField, X, alpha, maginput=Dict())
Find the magnitude and location of the mirror point along a field line traced from any given location and local pitch-angle.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)alpha
: Local pitch angle in degrees
Outputs
- Blocal: magnitude of magnetic field at point (nT)
- Bmirr: magnitude of the magnetic field at the mirror point (nT)
- posit (array of 3 double): GEO coordinates of the mirror point (Re)
References: IRBEM API
IRBEM.find_magequator
— Functionfind_magequator(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_magequator(model::MagneticField, X, maginput=Dict())
Find the coordinates of the magnetic equator from tracing the magnetic field line from the input location. Returns a named tuple with fields Bmin and XGEO (location of magnetic equator in GEO coordinates).
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
IRBEM.find_foot_point
— Functionfind_foot_point(time, x, stop_alt, hemi_flag, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_foot_point(model::MagneticField, X, stop_alt, hemi_flag, maginput=Dict())
Find the footprint of a field line that passes through location X in a given hemisphere.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)stop_alt
: Altitude in km where to stop field line tracinghemi_flag
: Hemisphere flag (0: same as SM z, +1: northern, -1: southern)
Outputs
- XFOOT: GDZ coordinates of the foot point (Re)
- BFOOT: magnetic field vector (GEO) at the foot point (nT)
- BFOOTMAG: magnitude of the magnetic field at the foot point (nT)
References: IRBEM API
Magnetic field computation
IRBEM.get_field_multi
— Functionget_field_multi(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
get_field_multi(model::MagneticField, X, maginput=Dict())
Compute the GEO vector of the magnetic field at input location for a set of internal/external magnetic field.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fields Bgeo (GEO components of B field) and Bmag (magnitude of B field)
IRBEM.get_bderivs
— Functionget_bderivs(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
get_bderivs(model::MagneticField, X, maginput=Dict())
Compute the magnetic field and its 1st-order derivatives at each input location.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fieldsBgeo
(GEO components of B field),Bmag
(magnitude of B field),gradBmag
(gradients of Bmag in GEO), anddiffB
(derivatives of the magnetic field vector).
Examples
julia> get_bderivs("2015-02-02T06:12:43", [600.0, 60.0, 50.0], 0.1, "GDZ", Dict("Kp" => 40.0)) |> pprint
(Bgeo = [-21079.764883133903, -21504.21460705096, -29666.24532305791],
Bmag = 42271.43059990003,
gradBmag = [-49644.37271032293, -46030.37495428827, -83024.03530787815],
diffB =
[-13530.079906431165 31460.805163291334 53890.73134176735; 30427.464243221693 -16715.08632269888 50326.93737340687; 62620.43884602288 59981.93936448166 44395.53254933224;;;])
Field tracing
IRBEM.trace_field_line
— Functiontrace_field_line(model::MagneticField, X, maginput; R0=1.0)
Trace a full field line which crosses the input position.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputsR0=1.0
: Radial distance in Re units where to stop field line tracing
Outputs
- Lm: L McIlwain
- Blocal (array of 3000 double): magnitude of magnetic field at point (nT)
- Bmin: magnitude of magnetic field at equator (nT)
- XJ: I, related to second adiabatic invariant (Re)
- posit (array of (3, 3000) double): Cartesian coordinates in GEO along the field line
- Nposit: number of points in posit
IRBEM.drift_shell
— Functiondrift_shell(model::MagneticField, X, maginput)
Trace a full drift shell for particles that have their mirror point at the input location.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputs
Outputs
Lm
: L McIlwainLstar
: L Roederer or Φ=2π Bo/L* (nT Re2), depending on the options valueBlocal
(array of (1000, 48)): magnitude of magnetic field at point (nT)Bmin
: magnitude of magnetic field at equator (nT)XJ
: I, related to second adiabatic invariant (Re)posit
(array of (3, 1000, 48)): Cartesian coordinates in GEO along the drift shellNposit
(array of 48 integer): number of points in posit along each traced field line
Reference: IRBEM API
IRBEM.drift_bounce_orbit
— Functiondrift_bounce_orbit(model::MagneticField, X, maginput; alpha=90, R0=1)
Trace a full drift-bounce orbit for particles with a specified pitch angle at the input location. Returns only positions between mirror points, with 25 azimuths.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputsalpha
: Local pitch angle in degrees (default 90)R0
: Minimum radial distance allowed along the drift path (default 1.0)
Outputs:
- Lm: L McIlwain
- Lstar: L Roederer or Φ=2π Bo/L* (nT Re2), depending on the options value
- Blocal (array of (1000, 25) double): magnitude of magnetic field at point (nT)
- Bmin: magnitude of magnetic field at equator (nT)
- XJ: I, related to second adiabatic invariant (Re)
- posit (array of (3, 1000, 25) double): Cartesian coordinates in GEO along the drift shell
- Nposit (array of 25 integer): number of points in posit along each traced field line
Reference: IRBEM API
Coordinates transformations
IRBEM.transform
— Functiontransform(time, pos, in, out)
Transform coordinates from in
coordinate system to out
coordinate system.
Note: pos
must be of shape (3,) for single point or (3, n) for multiple points
Example
using Dates
using IRBEM
time = DateTime(2020, 1, 1)
pos = [6.90274, -1.63624, 1.91669]
GSM(time, GEO(pos))
transform(time, pos, "GEO", "GSM")
transform(time, pos, "GEO" => "GSM")
transform(time, pos, "geo2gsm")
Library information
IRBEM.IRBEM
— ModuleA wrapper for International Radiation Belt Environment Modeling (IRBEM) library
See the Documentation for more information.
Functions
Computing magnetic field coordinates
make_lstar
: Compute magnetic coordinates at a spacecraft positionget_mlt
: Get Magnetic Local Time from GEO position and date
Points of interest on the field line
find_mirror_point
: Find magnitude and location of mirror point along field linefind_foot_point
: Find footprint of field line in a given hemispherefind_magequator
: Find coordinates of magnetic equator from field line tracing
Magnetic field computation
get_field_multi
: Compute GEO vector of magnetic field at input locationget_bderivs
: Compute the magnetic field and its 1st-order derivatives at each input location
Field tracing
trace_field_line
: Trace a full field line crossing the input positiondrift_shell
: Trace a full drift shell for particles with mirror point at input locationdrift_bounce_orbit
: Trace a full bounce orbit for particles with mirror point at input location
Coordinates transformations
transform
: Transform coordinates from one system to another
Library information
get_igrf_version
: Returns the version number of the IGRF modelirbem_fortran_version
: Provides the repository version number of the fortran source codeirbem_fortran_release
: Provides the repository release tag of the fortran source code
References
IRBEM.GSM
— TypeGeocentric Solar Magnetospheric (GSM)
X points sunward from Earth's center. The X-Z plane is defined to contain Earth's dipole axis (positive North).
IRBEM.beta
— Functionbeta(Ek, Erest=511.0)
Calculate relativistic beta (v/c) for a particle with kinetic energy Ek. Ek and Erest must be in the same units (default is keV).
IRBEM.clean_posit!
— Methodclean_posit!(posit, Nposit)
Remove trailing NaN values from the posit array.
IRBEM.coord_sys
— Methodcoord_sys(axes)
Look up the IRBEM coordinate system integer given a string representation.
Coordinate systems:
- 0: GDZ: (altitude, latitude, east longitude - km, deg, deg)
- 1: GEO: Cartesian GEO - Re
- 2: GSM: Cartesian GSM - Re
- 3: GSE: Cartesian GSE - Re
- 4: SM: Cartesian SM - Re
- 5: GEI: Cartesian GEI - Re
- 6: MAG: Cartesian MAG - Re
- 7: SPH: Spherical GEO - (radial distance, latitude, east longitude - Re, deg, deg)
- 8: RLL: Spherical GEO - (radial distance, latitude, east longitude - Re, deg, deg)
Returns the corresponding integer code.
IRBEM.drift_bounce_orbit
— Methoddrift_bounce_orbit(model::MagneticField, X, maginput; alpha=90, R0=1)
Trace a full drift-bounce orbit for particles with a specified pitch angle at the input location. Returns only positions between mirror points, with 25 azimuths.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputsalpha
: Local pitch angle in degrees (default 90)R0
: Minimum radial distance allowed along the drift path (default 1.0)
Outputs:
- Lm: L McIlwain
- Lstar: L Roederer or Φ=2π Bo/L* (nT Re2), depending on the options value
- Blocal (array of (1000, 25) double): magnitude of magnetic field at point (nT)
- Bmin: magnitude of magnetic field at equator (nT)
- XJ: I, related to second adiabatic invariant (Re)
- posit (array of (3, 1000, 25) double): Cartesian coordinates in GEO along the drift shell
- Nposit (array of 25 integer): number of points in posit along each traced field line
Reference: IRBEM API
IRBEM.drift_shell
— Methoddrift_shell(model::MagneticField, X, maginput)
Trace a full drift shell for particles that have their mirror point at the input location.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputs
Outputs
Lm
: L McIlwainLstar
: L Roederer or Φ=2π Bo/L* (nT Re2), depending on the options valueBlocal
(array of (1000, 48)): magnitude of magnetic field at point (nT)Bmin
: magnitude of magnetic field at equator (nT)XJ
: I, related to second adiabatic invariant (Re)posit
(array of (3, 1000, 48)): Cartesian coordinates in GEO along the drift shellNposit
(array of 48 integer): number of points in posit along each traced field line
Reference: IRBEM API
IRBEM.find_foot_point
— Methodfind_foot_point(time, x, stop_alt, hemi_flag, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_foot_point(model::MagneticField, X, stop_alt, hemi_flag, maginput=Dict())
Find the footprint of a field line that passes through location X in a given hemisphere.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)stop_alt
: Altitude in km where to stop field line tracinghemi_flag
: Hemisphere flag (0: same as SM z, +1: northern, -1: southern)
Outputs
- XFOOT: GDZ coordinates of the foot point (Re)
- BFOOT: magnetic field vector (GEO) at the foot point (nT)
- BFOOTMAG: magnitude of the magnetic field at the foot point (nT)
References: IRBEM API
IRBEM.find_magequator
— Methodfind_magequator(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_magequator(model::MagneticField, X, maginput=Dict())
Find the coordinates of the magnetic equator from tracing the magnetic field line from the input location. Returns a named tuple with fields Bmin and XGEO (location of magnetic equator in GEO coordinates).
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
IRBEM.find_mirror_point
— Methodfind_mirror_point(time, x, alpha, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
find_mirror_point(model::MagneticField, X, alpha, maginput=Dict())
Find the magnitude and location of the mirror point along a field line traced from any given location and local pitch-angle.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)alpha
: Local pitch angle in degrees
Outputs
- Blocal: magnitude of magnetic field at point (nT)
- Bmirr: magnitude of the magnetic field at the mirror point (nT)
- posit (array of 3 double): GEO coordinates of the mirror point (Re)
References: IRBEM API
IRBEM.gamma
— Functiongamma(Ek, Erest=511.0)
Calculate relativistic gamma factor for a particle with kinetic energy Ek. Ek and Erest must be in the same units (default is keV).
IRBEM.get_bderivs
— Methodget_bderivs(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
get_bderivs(model::MagneticField, X, maginput=Dict())
Compute the magnetic field and its 1st-order derivatives at each input location.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fieldsBgeo
(GEO components of B field),Bmag
(magnitude of B field),gradBmag
(gradients of Bmag in GEO), anddiffB
(derivatives of the magnetic field vector).
Examples
julia> get_bderivs("2015-02-02T06:12:43", [600.0, 60.0, 50.0], 0.1, "GDZ", Dict("Kp" => 40.0)) |> pprint
(Bgeo = [-21079.764883133903, -21504.21460705096, -29666.24532305791],
Bmag = 42271.43059990003,
gradBmag = [-49644.37271032293, -46030.37495428827, -83024.03530787815],
diffB =
[-13530.079906431165 31460.805163291334 53890.73134176735; 30427.464243221693 -16715.08632269888 50326.93737340687; 62620.43884602288 59981.93936448166 44395.53254933224;;;])
IRBEM.get_datetime
— Methodget_datetime(X::Dict)
Extract datetime from input dictionary X. Supports 'dateTime' or 'Time' keys with DateTime or String values.
IRBEM.get_field_multi
— Methodget_field_multi(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
get_field_multi(model::MagneticField, X, maginput=Dict())
Compute the GEO vector of the magnetic field at input location for a set of internal/external magnetic field.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fields Bgeo (GEO components of B field) and Bmag (magnitude of B field)
IRBEM.get_igrf_version
— MethodReturns the version number of the IGRF model.
IRBEM.get_irbem_ntime_max1!
— MethodReturns the size of time dimension in inputs and/or output arrays for some of the routines.
Reference: IRBEM Documentation
IRBEM.get_mlt
— Methodget_mlt(model::MagneticField, X::Dict)
Get Magnetic Local Time (MLT) from a Cartesian GEO position and date.
Arguments
model::MagneticField
: The magnetic field modelX::Dict
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in GEO system
IRBEM.irbem_fortran_release
— MethodProvides the repository release tag of the fortran source code.
IRBEM.irbem_fortran_version
— MethodProvides the repository version number of the fortran source code.
IRBEM.make_lstar
— Methodmake_lstar(time, x, coord="GDZ", maginput=Dict(); kext=KEXT[], options=OPTIONS[])
make_lstar(model::MagneticField, X, maginput=Dict())
Compute magnetic coordinates at a spacecraft position.
Arguments
Signature 1:
time
: Date and time (DateTime, Vector{DateTime}, or String)x
: Position coordinates as a 3×n array or a tuple/vector of vectorscoord
: String specifying the coordinate system (default: "GDZ")kext
: External field model selection (optional)options
: Model options (optional)
Signature 2:
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
Common arguments:
maginput
: Dictionary with magnetic field model inputs (optional)
Returns
NamedTuple
: Contains fields Lm, MLT, Blocal, Bmin, Lstar, and XJ
Examples
julia> make_lstar("2015-02-02T06:12:43", [600.0, 60.0, 50.0], "GDZ", Dict("Kp" => 40.0))
(Lm = 3.5597242229067536, Lstar = -1.0e31, Blocal = 42271.43059990003, Bmin = 626.2258295723121, XJ = 7.020585390925573, MLT = 10.170297893176182)
IRBEM.prepare_maginput
— Functionprepare_maginput(maginput::Dict, ntime::Int)
Process magnetic field model inputs from input dictionary. Returns a properly formatted array for IRBEM functions.
IRBEM.process_coords_time
— Methodprocess_coords_time(X::Dict)
Process coordinates and time from input dictionary X. Returns ntime, iyear, idoy, ut, x1, x2, x3 arrays for IRBEM functions.
IRBEM.trace_field_line
— Methodtrace_field_line(model::MagneticField, X, maginput; R0=1.0)
Trace a full field line which crosses the input position.
Arguments
model::MagneticField
: The magnetic field modelX
: Dictionary with keys:dateTime
orTime
: Date and time (DateTime or String)x1
,x2
,x3
: Position coordinates in the system specified bysysaxes
maginput
: Dictionary with magnetic field model inputsR0=1.0
: Radial distance in Re units where to stop field line tracing
Outputs
- Lm: L McIlwain
- Blocal (array of 3000 double): magnitude of magnetic field at point (nT)
- Bmin: magnitude of magnetic field at equator (nT)
- XJ: I, related to second adiabatic invariant (Re)
- posit (array of (3, 3000) double): Cartesian coordinates in GEO along the field line
- Nposit: number of points in posit
IRBEM.transform
— Methodtransform(time, pos, in, out)
Transform coordinates from in
coordinate system to out
coordinate system.
Note: pos
must be of shape (3,) for single point or (3, n) for multiple points
Example
using Dates
using IRBEM
time = DateTime(2020, 1, 1)
pos = [6.90274, -1.63624, 1.91669]
GSM(time, GEO(pos))
transform(time, pos, "GEO", "GSM")
transform(time, pos, "GEO" => "GSM")
transform(time, pos, "geo2gsm")
IRBEM.vparallel
— Functionvparallel(Ek, Bm, B, Erest=511.0)
Calculate parallel velocity for a particle with kinetic energy Ek, at a location with magnetic field B, with mirror point field Bm. Ek and Erest must be in the same units (default is keV). Returns velocity in m/s.
IRBEM.with_case_variants
— Methodwith_case_variants(dict::Dict{S, V}) where {S <: AbstractString, V}
Creates a new dictionary with both uppercase and lowercase variants of each key. The original keys and values are preserved, and lowercase/uppercase variants are added.
Example:
original = Dict("ABC" => 1, "DEF" => 2)
result = with_case_variants(original)
# result has keys: "ABC", "abc", "DEF", "def"
IRBEM.@init_refs
— Macro@init_refs(Type, var1, var2, ...)
Creates variables var1, var2, ... each initialized as Ref{Type}()
. Example: @init_refs(Float64, 0.0, Lm, Lstar) expands to: Lm = Ref{Float64}(0.0) Lstar = Ref{Float64}(0.0)