Skip to main content

The core library for building geomag model.

Project description

geomaglib

PyPI - Version PyPI - License PyPI - Downloads PyPI Downloads

geomaglib Python API includes the core functions for building geomag model like WMM, WMMHR, HDGM-crust, HDGM-core and IGRF. The API is developed by by the Cooperative Institute For Research in Environmental Sciences (CIRES), University of Colorado.

Installation

Install the geomaglib deployed to PyPI

Install the geomaglib from PyPI

pip install geomaglib

Install the Public Git repository to your virtual environment

1. Install specific branch

pip install git+https://github.com/CIRES-Geomagnetism/geomaglib.git@<branch_name>

2. Install specific tag

pip install git+https://github.com/CIRES-Geomagnetism/geomaglib.git@<tag_number>

API Reference

geomaglib.legendre

  • Compute the Legendre polynomials
See the detail of functions

Flattened_Chaos_Legendre1(): Outputs a 2 dimensional numpy array which contains the associated legendre polynomials (Pnm) and the respective derivatives (dPnm).

get_index(): Get the index of Flattened_Chaos_Legendre1

geomaglib.magmath

  • Compute the Geomagnetic elements in geodetic: Bx, By, Bz, Bh(horizontal), Bf(total intensity), declination, inclination and the delta Bx, By, Bz, Bh(horizontal), Bf(total intensity), declination, inclination
  • Radius and degree conversion
  • Convert magnetic vector from spherical to geodetic
See the detail of functions

rad2deg(): Convert radius to degree

deg2rad(): Convert degree to radius

calc_Bp_Pole(): Calculate the B_phi magnetic elements at pole

mag_SPH_summation(): Compute the sperical magnetic vectors (B_theta, B_phi, B_radius)

rotate_magvec(): Convert magnetic vector from spherical to geodetic

GeomagElements(): The Python class for computing magnetic elements in geodetic coordinates

  • Get all of the magnetic elements: get_all()
  • Get the specific magnetic element:
    • get_Bx()
    • get_By()
    • get_Bz()
    • get_Bh()
    • get_Bf()
    • get_Bdec()
    • get_Binc()
    • get_dBx()
    • get_dBy()
    • get_dBz()
    • get_dBh()
    • get_dBf()
    • get_dBdec()
    • get_dBinc()

geomaglib.util

  • Compute decimal year
  • Converting the coordinates based on gedetic to geocentric
  • Converting the mean sea level altitude to ellipsoid height
See the detail of functions

geod_to_geoc_lat(): Conversion of locations in geodetic (geodetic latitude, altitude in kilometers) to geocentric (radius in kilometers , geocentric latitude)

alt_to_ellipsoid_height(): This function converts mean sea level (MSL) altitude in kilometers to ellipsoid height in kilometers

calc_dec_year(): Takes year, month, and day and calculates the decimal year from those inputs

calc_dec_year_array():Takes the array of year, month, and day and outputs the decimal year from those inputs

decimalYearToDateTime(): Covert the decimal year to year, month, day, hour and minute

geomaglib.sh_vars

  • Computes Spherical Variabale
See the detail of functions

comp_sh_vars(): Computes spherical variabale and put the results in a dictionary variable computed are (a/r) ^ (n+2), cos_m(lon), and sin_m(lon)

geomaglib.sh_loader

  • Estimate the total elements from end degree ofr the model coefficients
  • Funtions for loading WMM2025.COF, IGRF14.COF
  • Compute time change the Model coefficients from the base year of the model(epoch) using secular variation coefficients.
See the detail of functions

calc_sh_degrees_to_num_elems(): Gives you the number of elements from the number of sphereical harmonic degree

calc_num_elems_to_sh_degrees(): Gives you the number of spherical harmonic degrees from the total number of elements

load_wmm_coef()

load_igrf_coef()

timely_modify_magnetic_model_wmm()

timely_modify_magnetic_model_HDGM()

geomaglib.dipole

  • Geomagnetic dipole location for a set of geomagnetic main field coefficients (default is IGRF14)
  • Geomagnetic dipole to geocentric spherical coordinate (and back) coordinate rotation
  • Follows approach of Laundal & Richmond
See details of functions

geomaglib.dipole.Dipole

  • Class representing geomagnetic dipole location for a particular epoch (decimal year)
    • Example: dp=Dipole(2024.1)
  • Method coords, transform from geomagnetic dipole coordinates (lat,lon) to geocentric spherical coordinates (lat,lon)
    • Input and output types: scalar float or list of float
    • Geocentric to dipole: mlat,mlon = dp.coords(gclat,glon)
    • Dipole to geocentric: gclat,glon = dp.coords(mlat,mlon,inverse=True)

Contacts and contributing to geomaglib:

If you have any questions, please email geomag.models@noaa.gov, submit issue or pull request at https://github.com/CIRES-Geomagnetism/geomaglib.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geomaglib-1.2.2.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geomaglib-1.2.2-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file geomaglib-1.2.2.tar.gz.

File metadata

  • Download URL: geomaglib-1.2.2.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for geomaglib-1.2.2.tar.gz
Algorithm Hash digest
SHA256 3ecd321454e486ef55522af9183050b05d7a9062b38d8ee17cddcfc02cb15ba8
MD5 9a6533c7608919af5e0576ab366f7979
BLAKE2b-256 1bfabd3f856cc9e1e2c49a197f286f82d1d8d0fcf7bf5bc9a4a756a7e2b1f298

See more details on using hashes here.

File details

Details for the file geomaglib-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: geomaglib-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for geomaglib-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e0c3135f886defcf428cdd5aff404b6489d04551a28b79545daea19c24cf4ad2
MD5 be626fdce85307d7fa6ae7f3c75bcc9e
BLAKE2b-256 793a20fdba756ec731c199b7726f92b37af5b57e1300fa9866d1c903159de226

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page