Skip to main content

Convert between magnetic/geodetic and adaptive, polar boundary coordinates

Project description

Documentation Status DOI PyPI version

Test Status Coverage Status

Planet with auroral oval and two pythons representing closed and open magnetic field lines Overview

OCBpy is a Python module that converts between AACGM coordinates and a magnetic coordinate system that adjusts latitude and local time relative to the Open Closed field line Boundary (OCB), Equatorial Auroral Boundary (EAB), or both. This is particulary useful for statistical studies of the poles, where gridding relative to a fixed magnetic coordinate system would cause averaging of different physical regions, such as auroral and polar cap measurements. This coordinate system is described in:

  • Chisham, G. (2017), A new methodology for the development of high‐latitude ionospheric climatologies and empirical models, Journal of Geophysical Research: Space Physics, doi:10.1002/2016JA023235.

  • Full documentation

Boundaries must be obtained from observations or models for this coordinate transformation. Several boundary data sets are included within this package. These include northern hemisphere boundaries from the IMAGE satellite, northern and southern hemisphere OCBs from AMPERE, and single-point boundary locations from DMSP.

Currently, support is included for files from the following datasets:

These routines may be used as a guide to write routines for other datasets.

Python versions

This module currently supports Python version 3.10 - 3.13.

Dependencies

The listed dependecies were tested with the following versions:

  • numpy
  • aacgmv2
  • pysat (3.2.1+)
  • zenodo_get

Testing is performed using the python module, unittest. To limit dependency issues, the pysat and zenodo_get dependencies are optional.

Installation

Installation is now available through pypi

    $ pip install ocbpy

You may also checkout the repository and install it yourself:

    $ git clone git://github.com/aburrell/ocbpy.git;

Change directories into the repository folder and run the setup.py file. For a local install use the "--user" flag after "install". For development, add the "-e" flag.

    $ cd ocbpy/
    $ pip install .

To run the unit tests,

    $ python -m unittest discover

Example

In iPython, run:

import datetime as dt
import ocbpy

Then initialise an OCB class object. This uses the default IMAGE FUV file and will take a few minutes to load.

ocb = ocbpy.OCBoundary()
print(ocb)

The output should be as follows:

Open-Closed Boundary file: ~/ocbpy/ocbpy/boundaries/image_north_circle.ocb
Source instrument: IMAGE
Boundary reference latitude: 74.0 degrees

305805 records from 2000-05-04 03:03:20 to 2002-10-31 20:05:16

YYYY-MM-DD HH:MM:SS Phi_Centre R_Centre R
-----------------------------------------------------------------------------
2000-05-04 03:03:20 4.64 2.70 21.00
2000-05-04 03:07:15 147.24 2.63 7.09
...
2002-10-31 20:03:16 207.11 5.94 22.86
2002-10-31 20:05:16 335.47 6.76 11.97

Uses scaling function(s):
ocbpy.ocb_correction.circular(**{})

Get the first good OCB record, which will be record index 0.

ocb.get_next_good_ocb_ind()
print(ocb.rec_ind)

To get the good OCB record closest to a specified time (with a maximum of a 60 sec time difference, as a default), use ocbpy.match_data_ocb

test_times = [dt.datetime(otime.year, otime.month, otime.day, otime.hour,
                          otime.minute, 0) for otime in ocb.dtime[1:10]]
itest = ocbpy.match_data_ocb(ocb, test_times, idat=0)
print(itest, ocb.rec_ind, test_times[itest], ocb.dtime[ocb.rec_ind])

4 5 2000-05-05 11:39:00 2000-05-05 11:39:20

More examples are available in the documentation.

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

ocbpy-0.6.0.tar.gz (114.9 MB view details)

Uploaded Source

Built Distribution

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

ocbpy-0.6.0-py3-none-any.whl (116.0 MB view details)

Uploaded Python 3

File details

Details for the file ocbpy-0.6.0.tar.gz.

File metadata

  • Download URL: ocbpy-0.6.0.tar.gz
  • Upload date:
  • Size: 114.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ocbpy-0.6.0.tar.gz
Algorithm Hash digest
SHA256 439bae6c0d758b86943ba419e333c768f9ed5e10921cee3ac67501f7f30f320e
MD5 dd72c58ac316fdb0457c1a94bde892c7
BLAKE2b-256 05930d8add5852d74ff8916b91afcb8223a4ef91e1af37340304bf39e7d577ed

See more details on using hashes here.

File details

Details for the file ocbpy-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: ocbpy-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 116.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ocbpy-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb09ee70f8e65fb715cd2ff880bed20440e10eec591e60c08719587c899ccc53
MD5 a5a27e4a43659604f7cf645cad82f8e5
BLAKE2b-256 16f3323101ed1fcf93f5098bf3c1933b91bb59969e618227cd17ea324763991c

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