GeoCotrans.jl

GeoCotransModule

Coordinate systems, transformations, and geomagnetic field models.

Coordinate systems

  • GEO: Geocentric Geographic (cartesian) (GEO) coordinate system (x [𝐋], y [𝐋], z [𝐋]).
  • GSM: Geocentric Solar Magnetospheric (GSM) coordinate system.
  • GSE: Geocentric Solar Ecliptic (GSE) coordinate system.
  • GEI: Geocentric Equatorial Inertial (GEI) coordinate system.
  • GDZ: Geodetic (GDZ) coordinate system (altitude [km], latitude [deg], longitude [deg]).
  • MAG: Geomagnetic (MAG) coordinate system.
  • SPH: Geocentric Geographic (spherical) (SPH) coordinate system (r [𝐋], θ [deg], φ [deg]).

Coordinate transformations

References

International Geomagnetic Reference Field (IGRF)

The International Geomagnetic Reference Field (IGRF) is a standard mathematical description of the Earth's main magnetic field. It is used widely in studies of the Earth's deep interior, crust, ionosphere, and magnetosphere.

Functions

  • igrf_B: Compute the geomagnetic field (IGRF-14, dipole model)

Examples

r, θ, φ = 6500., 30., 4.
t = Date(2021, 3, 28)
Br, Bθ, Bφ = igrf_Bd(r, θ, φ, t)

# Input position in geodetic coordinates, output magnetic field in East-North-Up (ENU) coordinates
Be, Bn, Bu = igrf_B(GDZ(0, 60.39299, 5.32415), t)

References

Elsewhere

source

Installation

using Pkg
Pkg.add("GeoCotrans")

Coordinate Systems

GeoCotrans.GDZType

Geodetic (GDZ) coordinate system (altitude [km], latitude [deg], longitude [deg]).

Defined using a reference ellipsoid. Both the altitude and latitude depend on the ellipsoid used. GeoCotrans uses the WGS84 reference ellipsoid.

source
GeoCotrans.GEOType

Geocentric Geographic (cartesian) (GEO) coordinate system (x [𝐋], y [𝐋], z [𝐋]).

source
GeoCotrans.GSMType

Geocentric Solar Magnetospheric (GSM) coordinate system.

X points sunward from Earth's center. The X-Z plane is defined to contain Earth's dipole axis (positive North).

source
GeoCotrans.SPHType

Geocentric Geographic (spherical) (SPH) coordinate system (r [𝐋], θ [deg], φ [deg]).

source

API Reference

Public

GeoCotrans.GeoCotransModule

Coordinate systems, transformations, and geomagnetic field models.

Coordinate systems

  • GEO: Geocentric Geographic (cartesian) (GEO) coordinate system (x [𝐋], y [𝐋], z [𝐋]).
  • GSM: Geocentric Solar Magnetospheric (GSM) coordinate system.
  • GSE: Geocentric Solar Ecliptic (GSE) coordinate system.
  • GEI: Geocentric Equatorial Inertial (GEI) coordinate system.
  • GDZ: Geodetic (GDZ) coordinate system (altitude [km], latitude [deg], longitude [deg]).
  • MAG: Geomagnetic (MAG) coordinate system.
  • SPH: Geocentric Geographic (spherical) (SPH) coordinate system (r [𝐋], θ [deg], φ [deg]).

Coordinate transformations

References

International Geomagnetic Reference Field (IGRF)

The International Geomagnetic Reference Field (IGRF) is a standard mathematical description of the Earth's main magnetic field. It is used widely in studies of the Earth's deep interior, crust, ionosphere, and magnetosphere.

Functions

  • igrf_B: Compute the geomagnetic field (IGRF-14, dipole model)

Examples

r, θ, φ = 6500., 30., 4.
t = Date(2021, 3, 28)
Br, Bθ, Bφ = igrf_Bd(r, θ, φ, t)

# Input position in geodetic coordinates, output magnetic field in East-North-Up (ENU) coordinates
Be, Bn, Bu = igrf_B(GDZ(0, 60.39299, 5.32415), t)

References

Elsewhere

source
GeoCotrans.GDZType

Geodetic (GDZ) coordinate system (altitude [km], latitude [deg], longitude [deg]).

Defined using a reference ellipsoid. Both the altitude and latitude depend on the ellipsoid used. GeoCotrans uses the WGS84 reference ellipsoid.

source
GeoCotrans.GEOType

Geocentric Geographic (cartesian) (GEO) coordinate system (x [𝐋], y [𝐋], z [𝐋]).

source
GeoCotrans.GSMType

Geocentric Solar Magnetospheric (GSM) coordinate system.

X points sunward from Earth's center. The X-Z plane is defined to contain Earth's dipole axis (positive North).

source
GeoCotrans.SPHType

Geocentric Geographic (spherical) (SPH) coordinate system (r [𝐋], θ [deg], φ [deg]).

source
GeoCotrans.gdz2sphMethod
gdz2sph(alt, lat, lon)

Convert (alt [km], lat [deg], lon [deg]) in Geodetic coordinate to Spherical geocentric coordinate.

source
GeoCotrans.gei2geoMethod

gei2geo(x, t)

Transforms x vector from Geocentric Equatorial Inertial (GEI) to Geographic (GEO) coordinates at time t.

source
GeoCotrans.gei2gsmMethod

gei2gsm(x, t)

Transforms x vector from Geocentric Equatorial Inertial (GEI) to Geocentric Solar Magnetic (GSM) coordinates at time t.

source
GeoCotrans.geo2geiMethod

geo2gei(x, t)

Transforms x vector from Geographic (GEO) to Geocentric Equatorial Inertial (GEI) coordinates at time t.

source
GeoCotrans.geo2gsmMethod

geo2gsm(x, t)

Transforms x vector from Geographic (GEO) to Geocentric Solar Magnetic (GSM) coordinates at time t.

source
GeoCotrans.get_igrf_coeffsMethod
get_igrf_coeffs(time)

Get IGRF-14 coefficients for a given time.

Similar to IRBEM implementation, but with higher precision (IRBEM uses year as the time unit).

source
GeoCotrans.gse2gsmMethod

gse2gsm(x, t)

Transforms x vector from Geocentric Solar Ecliptic (GSE) to Geocentric Solar Magnetic (GSM) coordinates at time t.

source
GeoCotrans.gsm2geiMethod

gsm2gei(x, t)

Transforms x vector from Geocentric Solar Magnetic (GSM) to Geocentric Equatorial Inertial (GEI) coordinates at time t.

source
GeoCotrans.gsm2geoMethod

gsm2geo(x, t)

Transforms x vector from Geocentric Solar Magnetic (GSM) to Geographic (GEO) coordinates at time t.

source
GeoCotrans.gsm2gseMethod

gsm2gse(x, t)

Transforms x vector from Geocentric Solar Magnetic (GSM) to Geocentric Solar Ecliptic (GSE) coordinates at time t.

source
GeoCotrans.igrf_BMethod
igrf_B(r, θ, φ, t; max_degree=IGRF_degree) -> (Br, Bθ, Bφ)

Calculate IGRF model components in geocentric coordinates (r [km], θ [rad], φ [rad]) at time t.

Parameters

  • r: radius [km]
  • θ: colatitude [rad]
  • φ: longitude [rad], positive east
  • maxdegree: highest degree of expansion (1 <= maxdegree <= 13)
source
GeoCotrans.igrf_BMethod
igrf_B(𝐫::CoordinateVector{GDZ}, t; max_degree=IGRF_degree) -> (Be, Bn, Bu)

Calculate IGRF model components in east, north, up (ENU) coordinates for geodetic coordinates 𝐫 at time t.

source
GeoCotrans.igrf_BdMethod
igrf_Bd(r, θ, φ, t; max_degree=IGRF_degree) -> (Br, Bθ, Bφ)

Calculate IGRF model components in geocentric coordinates (r [km], θ [deg], φ [deg]) at time t.

Parameters

  • r: radius [km]
  • θ: colatitude [deg]
  • φ: longitude [deg]
  • maxdegree: highest degree of expansion (1 <= maxdegree <= 13)
source

Private

GeoCotrans.calc_dipole_angleMethod
calc_dipole_angle(g10, g11, h11)

Calculate dipole angle (θ, φ) and dipole strength (b0) from spherical harmonic coefficients g10, g11, h11.

θ: dipole tilt angle (radians) φ: dipole longitude/phase (radians) b0: dipole strength (nT)

source
GeoCotrans.calculate_gstMethod
calculate_gst(time)

Calculate Greenwich sidereal time (GST) in radians from the given time.

Reference: https://aa.usno.navy.mil/faq/GAST, https://github.com/JuliaAstro/AstroLib.jl/blob/main/src/ct2lst.jl

source
GeoCotrans.calculate_gst_altMethod
calculate_gst_alt(time)

Alternative implementation of Greenwich sidereal time calculation based on the reference algorithm from pyspedas.cotrans_tools.csundir_vect.

source
GeoCotrans.car2sphMethod
car2sph(x, y, z)

Convert (x, y, z) in Cartesian coordinate to (r, colat [deg], lon [deg]) in spherical coordinate.

source
GeoCotrans.cdipdirMethod
cdipdir(time)

Compute dipole direction in GEO coordinates. [PySPEDAS]

References

  • https://pyspedas.readthedocs.io/en/latest/coords.html#pyspedas.cotranstools.cotranslib.cdipdir
source
GeoCotrans.csundirMethod
csundir(time) -> (gst, ra, dec, elong, obliq)

Calculate the direction of the sun, returns a tuple of (gst, ra, dec, elong, obliq) in radians.

  • gst: Greenwich mean sidereal time
  • ra: Right ascension
  • dec: Declination of the sun
  • elong: ecliptic longitude
  • obliq: Inclination of Earth's axis

See also AstroLib.sunpos.

source
GeoCotrans.gei2gsm_matMethod
gei2gsm_mat(time)

Compute the GEI to GSM transformation matrix.

First axis: sun direction (xS, yS, zS) Second axis: y-axis (cross product of dipole and sun, normalized) Third axis: z-axis (cross product of sun and y-axis, normalized)

source
GeoCotrans.get_dipole_termsMethod
get_dipole_terms(g, h)

Compute dipole parameters (θ, φ, x0, y0, z0, b0) from IGRF coefficients.

Returns a named tuple: (θ, φ, x0, y0, z0, b0)

source
GeoCotrans.gse2gsm_matMethod
gse2gsm_mat(time)

Compute the GSE to GSM transformation matrix T3 = <- psi,X>, where the rotation angle psi is the GSE-GSM angle.

This transformation is a rotation in the GSE YZ plane from the GSE Z axis to the GSM Z axis.

source