Package: ocbpy
OverviewOCBpy 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.FulldocumentationBoundaries 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.IMAGE Auroral Boundary dataBurrell, A. G. et al. (2020): AMPERE Polar Cap Boundaries, Ann. Geophys.,
38, 481-490,doi:10.5194/angeo-38-481-2020ssj_auroral_boundaryCurrently, support is included for files from the following datasets:SuperMAG (available athttp://supermag.jhuapl.edu)SuperDARN Vorticity (contact GC atgchi@bas.ac.uk)Any pysat Instrument (available athttps://github.com/pysat/pysat)These routines may be used as a guide to write routines for other datasets.Python versionsThis module currently supports Python version 3.7 - 3.10.DependenciesThe listed dependecies were tested with the following versions:numpyaacgmv2pysat (3.0.1+)ssj_auroral_boundaryTesting is performed using the python module, unittest.  To limit dependency
issues, pysat (>=3.0.1) and ssj_auroral_boundary are optional dependencies.InstallationInstallation is now available through pypi$ pip install ocbpyYou 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".$ cd ocbpy/
    $ python setup.py installTo run the unit tests,$ python -m unittest discoverExampleIn iPython, run:import datetime as dt
import ocbpyThen 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), useocbpy.match_data_ocbtest_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:20More examples are available in the documentation.