Metadata-Version: 2.4
Name: geomagdata
Version: 2.0.0
Summary: Download and parse geomagnetic indices
Author: Michael Hirsch, Ph.D.
Author-email: "Sunip K. Mukherjee" <sunipkmukherjee@gmail.com>
License: MIT License
        
        Copyright (c) 2019 Michael Hirsch, Ph.D., (c) 2023 Sunip K. Mukherjee
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/sunipkm/geomagdata
Keywords: aeronomy,aurora,ionosphere
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: python-dateutil
Requires-Dist: requests
Requires-Dist: numpy
Requires-Dist: pandas>=3.0.0
Requires-Dist: pytz
Requires-Dist: platformdirs
Requires-Dist: whenever<0.11,>=0.10.5
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Provides-Extra: lint
Requires-Dist: flake8; extra == "lint"
Requires-Dist: flake8-bugbear; extra == "lint"
Requires-Dist: flake8-builtins; extra == "lint"
Requires-Dist: flake8-blind-except; extra == "lint"
Requires-Dist: mypy; extra == "lint"
Provides-Extra: plot
Requires-Dist: matplotlib; extra == "plot"
Dynamic: license-file

# Geomagnetic Data Indices

Geomagnetic indices downloader and parser, returns Ap, F10.7 (raw and averaged) and Kp.

This is derived from [geomagindices](https://pypi.org/project/geomagindices/), and has been modified to:

- Correctly return averaged F10.7 values centered around the requested time.
- Support the new [post-SWPC data sources for all data dating back to 1932](ftp://ftp.gfz-potsdam.de/pub/home/obs/Kp_ap_Ap_SN_F107/).
- Fix a bug where averaging would not cross year boundaries.
- Handle timezone-aware inputs correctly.
- Return storm-time Ap indices for MSIS-xx models.

It is a drop-in replacement for [geomagindices](https://pypi.org/project/geomagindices/).

Output datatype is
[pandas.DataFrame](http://pandas.pydata.org/pandas-docs/stable/reference/frame.html)
(for multiple times)

internally, uses
[pandas.Index.get_loc](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.get_loc.html)
to find nearest time to request.

Missing data is returned as `NaN` (Not a Number floating point value).

## Installation
Direct installation:
```sh
$ pip install geomagdata
```

Indirect installation:
```sh
$ git clone https://github.com/sunipkm/geomagdata
$ cd geomagdata
$ pip install .
```

## Examples

Use from other programs like

```python
import geomagdata as gi

inds = gi.get_indices(date)
```

`date` can be a single value, or a sequence/array/`pandas.DatetimeIndex`.
A single value can be an ISO date/time string; Python's
[`datetime.date`/`datetime.datetime`](https://docs.python.org/3/library/datetime.html);
[`numpy.datetime64`](https://numpy.org/doc/stable/reference/arrays.datetime.html); or a
[`whenever`](https://whenever.readthedocs.io/) `Instant`/`ZonedDateTime`/`OffsetDateTime`/`PlainDateTime`/`Date`.

A `whenever` exact-instant type (`Instant`, `ZonedDateTime`, `OffsetDateTime`) is always
resolved to true UTC. A plain `datetime`/`PlainDateTime` is treated as naive UTC by
default; pass `tzaware=True` if it carries its own timezone/offset that should be
converted to UTC first.

---

```sh
python examples/plotindices.py 2015-01-01 2016-01-01
```

![2015 Ap F10.7](./examples/2015.png)
