Skip to main content

PyGCPM

PyGCPM is a Python 3 wrapper for the Global Core Plasma Model (Gallagher et al., 2000). This module uses version 2.4 from https://plasmasphere.nasa.gov/models/

The original code has been modified slightly such that it produces less output to the terminal and the path of the data files used is passed through a C wrapper so that the Fortran code is able to find them.

It's also worth noting that the IGRF component of the model needs updating - strange things may happen with years beyond ~2010. I will fix this.

Installation

Using pip:

python3 -m pip install PyGCPM --user

or,

pip3 install PyGCPM --user

From this repo (a C and Fortran compiler are required):

git clone https://github.com/mattkjames7/PyGCPM.git
cd PyGCPM/
python3 -m pip install . --user

Pull requests build and test wheels for Linux (x86-64 and ARM64), macOS (Intel and Apple Silicon), and Windows x86-64. Maintainers can run the release workflow to create a version tag, attach all distributions to a GitHub release, and publish them to PyPI or TestPyPI.

Usage

So far, there are only two working functions - GCPM and PlotEqSlice, the PlotMLTSlice function is doing odd things. It's worth noting that this model will take some time to run with large numbers of points.

GCPM

This function takes in position in the Solar Magnetospheric (SM) coordinate system, along with a date and a time then produces a model output for each position.

import PyGCPM
ne,nH,nHe,nO = PyGCPM.GCPM(x,y,z,Date,ut,Kp=Kp,Verbose=Verbose)

Where the inputs are:

Variable Data Type Description
x float or numpy.ndarray Scalar or array x position(s) in RE
y float or numpy.ndarray Scalar or array y position(s) in RE
z float or numpy.ndarray Scalar or array z position(s) in RE
Date int or numpy.ndarray Integer date in format yyyymmdd - if provided with a scalar then all positions will use the same date, otherwise an array can be provided for a time series
ut float or numpy.ndarray Floating point hours where ut = hh + mm/60 + ss/3600. As with Date - if provided with a scalar then all positions will use the same time, otherwise an array can be provided for a time series
Kp float or numpy.ndarray (optional) Kp index, as with Date and ut - this can be a scalar or an array
Verbose bool (optional) If True then the function will display its progress in the terminal

Function outputs:

Variable Data Type Description
ne float32 Electron density at each position (cm-3)
nH float32 Proton density at each position (cm-3)
nHe float32 Helium ion density at each position (cm-3)
nO float32 Oxygen ion density at each position (cm-3)

PlotEqSlice

This function will plot a slice through the SM equator (zSM = 0).

import PyGCPM
PyGCPM.PlotEqSlice(Date,ut,Parameter='ne',Rmax=10.0,dR=0.5,Kp=1.0,fig=None,
		maps=[1,1,0,0],zlog=True,cmap='gnuplot',scale=None,Verbose=False)
Variable Data Type Description
Date int Integer date in format yyyymmdd
ut float Floating point hours where ut = hh + mm/60 + ss/3600
Parameter str String containing the name of the parameter to plot: `'ne'
Rmax float This defines the maximum postion along x and y axes to calculate the model at - the x and y limits of the plot are (-Rmax,Rmax) and (Rmax,-Rmax), respectively
dR float The plot is a grid - this is the size of a grid box in RE
Kp float Kp index
fig object or None If None - a new plot is created; if set to an instance of matplotlib.pyplot, then the current figure is used and a new subplot is created within; if a matplotlib.pyplot.Axes instance is used then plotting is done on the current axes
maps list or tuple This defines the number of subplots and the position of the current plot: maps = [xmaps,ymaps,xmap,ymap]
zlog bool If True, the color scale is logarithmic
cmap str String containing the name of the colormap to use (alternatively provide the colormap object itself)
scale list, tuple or None If None then the limits of the color scale are detemined automatically. If list or tuple then these should contain two elements defining the minimum and maximum scale limits.
Verbose bool If True then the function will display its progress in the terminal

References

Gallagher, D. L., Craven, P. D., & Comfort, R. H. (2000, aug). Global core plasma model. J. Geophys. Res. Sp. Phys., 105(A8), 18819–18833. doi: 10.1029/1999JA000241

Download files

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

Source Distribution

pygcpm-0.2.0.tar.gz (5.4 MB view details)

Uploaded Source

Built Distributions

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

pygcpm-0.2.0-py3-none-win_amd64.whl (2.5 MB view details)

Uploaded Python 3Windows x86-64

pygcpm-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pygcpm-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (1.5 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

pygcpm-0.2.0-py3-none-macosx_15_0_x86_64.whl (2.5 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

pygcpm-0.2.0-py3-none-macosx_14_0_arm64.whl (1.8 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

Details for the file pygcpm-0.2.0.tar.gz.

File metadata

  • Download URL: pygcpm-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pygcpm-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6b28b45a4683fca92be45df04d3f672187f3b5c4ed1849728debf08a32a0e1dd
MD5 63cc491ee96dc3929d7dcd608f1ffb82
BLAKE2b-256 a6c1ceccd2d97cc24b521e8284477c34ded5689ce1cd0080e34c0aa906d8dd00

See more details on using hashes here.

File details

Details for the file pygcpm-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: pygcpm-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pygcpm-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 28050ec2315ebbddc09ddd9ad7e6c725aa407c74ea596dae4a0131e108e45374
MD5 313e386b85d6db5c05a019325cbd593b
BLAKE2b-256 cdaf8e812fd86719f694954bfe40bd011b299f60f53ee9e750a2aecd33dec1a4

See more details on using hashes here.

File details

Details for the file pygcpm-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pygcpm-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b5adca0a17847aecaccad1690447e10b553c7fb31defb9c503dbefc699d7d995
MD5 beb80be6a352ee9a54ca547d0f6cb02a
BLAKE2b-256 c01695ee1164cacd0742b537669e9330349554fbfe44e278098db1713ff0ebf3

See more details on using hashes here.

File details

Details for the file pygcpm-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pygcpm-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 daabcd94b83f070f054277d8dc622566dee752685d22e6bd0d382941f921e717
MD5 84babc7355798d55ac2a0b5d767c959b
BLAKE2b-256 55f78c69e4ac66de302c56e127086f25521683cfb3a2449842c4fd4ac44e8e42

See more details on using hashes here.

File details

Details for the file pygcpm-0.2.0-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for pygcpm-0.2.0-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 195b9575a53e4fa58304a17d65c8e59dcaade3544fd26a4281f85fdd31678519
MD5 378ab1fc7b8f02aa9ed76cbb67bdd711
BLAKE2b-256 2b34ea8d5aafbcfc058d840caef8eaf3b2c71366fadced66c8d8c224c7471a1b

See more details on using hashes here.

File details

Details for the file pygcpm-0.2.0-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pygcpm-0.2.0-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d1bf6bc91fcb4a3e4381024096bd26c6209d0a52d6d23222adc993b8127753fe
MD5 01f9c0abfd8ff375346d94ac89dac98e
BLAKE2b-256 c60b3ce8b308af0aa9c55c629036d161a7a34b76fd67d1f5def4961ede98826a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 files

0.1.0

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page