Skip to main content

Python package for solar wind data analysis.

Project description

Build Status Docs Status Black Code

PyPI Conda

Python License Zenodo

Python data analysis tools for solar wind measurements.

Quick Start

After installation, import the package and create a plasma object with sample data:

import solarwindpy as swp
import pandas as pd

# Create sample solar wind data (3 time points)
epoch = pd.date_range('2023-01-01', periods=3, freq='1h')
columns = pd.MultiIndex.from_tuples([
    ('n', '', 'p1'), ('n', '', 'a'),           # Number density
    ('v', 'x', 'p1'), ('v', 'x', 'a'),         # Velocity components
    ('v', 'y', 'p1'), ('v', 'y', 'a'),
    ('v', 'z', 'p1'), ('v', 'z', 'a'),
    ('w', 'par', 'p1'), ('w', 'par', 'a'),     # Thermal speeds
    ('w', 'per', 'p1'), ('w', 'per', 'a'),
    ('b', 'x', ''), ('b', 'y', ''), ('b', 'z', '')  # Magnetic field
], names=['M', 'C', 'S'])

# Realistic solar wind values
data = pd.DataFrame([
    [5.0, 0.25, 400, 380, 10, 5, -20, -15, 30, 15, 25, 12, 3.5, -1.2, 0.8],
    [8.0, 0.40, 450, 420, 15, 8, -25, -18, 35, 18, 28, 14, 4.1, -1.5, 1.2],
    [6.5, 0.30, 420, 400, 12, 6, -22, -16, 32, 16, 26, 13, 3.8, -1.3, 0.9],
], index=epoch, columns=columns)

# Create plasma object with protons and alphas
plasma = swp.Plasma(data, 'p1', 'a')

# Access ion species
print(plasma.species)  # ['p1', 'a']
print(f"Proton density: {plasma.p1.n.mean():.1f} cm⁻³")

See the documentation for detailed usage examples and API reference.

Installation

SolarWindPy requires Python 3.11 or later.

SolarWindPy is available via PyPI and conda-forge:

User

Install from PyPI:

pip install solarwindpy  # Requires Python 3.11+

Or install from conda-forge:

conda install -c conda-forge solarwindpy

Development

  1. Fork the repository and clone your fork.

  2. Install development dependencies:

    git clone https://github.com/YOUR-USERNAME/SolarWindPy.git
    cd SolarWindPy
    pip install -r requirements-dev.lock  # Includes all dev tools
    pip install -e .

    Alternative (Conda environment):

    conda env create -f solarwindpy.yml  # Python 3.11+
    conda activate solarwindpy
    pip install -r requirements-dev.lock
    pip install -e .
  3. Run the test suite with pytest:

    pytest -q

Note: As of v0.3.0, dependency management uses pip-tools lockfiles. See docs/MIGRATION-DEPENDENCY-OVERHAUL.md for migration details

  1. Regenerate the Conda recipe if the version or dependencies change:

    python scripts/update_conda_recipe.py
  2. Optionally install the pre-commit hooks:

    pre-commit install

    This will run black and flake8 automatically when committing.

  3. Build the documentation and fail on warnings:

    cd docs
    make html SPHINXOPTS=-W

License

SolarWindPy is licensed under a standard 3-clause BSD license. See LICENSE.

Acknowledging and Citing SolarWindPy

See CITATION.rst for instructions on citing SolarWindPy.

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

solarwindpy-0.3.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

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

solarwindpy-0.3.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file solarwindpy-0.3.0.tar.gz.

File metadata

  • Download URL: solarwindpy-0.3.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for solarwindpy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e390144401b3541536930643a7fc4b992e72de83c1733c3f830a77693c496b12
MD5 0d9f2875db1cdebf9f117c75906262a4
BLAKE2b-256 fb9277c5e6ef244186589883c6aed6e59a6eae2cc685e8dfef854ea1fec77926

See more details on using hashes here.

File details

Details for the file solarwindpy-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: solarwindpy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for solarwindpy-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d46557239a95c30abd541f52b1bbcd5dddd875646c60d7315bb6bfcfb76c0d1
MD5 07856bf6cc370c9280cbe0eab0e1f036
BLAKE2b-256 311ceab76b4dbf2bbbfc475fa01185cfd6fd44b123008b4c10997f6e6eb6b0f5

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