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

Note: The conda-forge package for v0.1.5 is temporarily unavailable due to CI infrastructure issues (see issue #8). Install from PyPI to get the latest version. The conda-forge package will be updated once the issue is resolved.

Development

  1. Fork the repository and clone your fork.

  2. Create a Conda environment using the provided YAML file (Python 3.11+):

    conda env create -f solarwindpy.yml  # Python 3.11+
    conda activate solarwindpy
    pip install -e .

    Alternatively generate the environment from requirements-dev.txt:

    python scripts/requirements_to_conda_env.py --name solarwindpy
    conda env create -f solarwindpy.yml
    conda activate solarwindpy
    pip install -e .
  3. Run the test suite with pytest:

    pytest -q
  4. Regenerate the Conda recipe if the version or dependencies change:

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

    pre-commit install

    This will run black and flake8 automatically when committing.

  6. 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.2.0.tar.gz (1.5 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.2.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for solarwindpy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b39f818a3e9d0473f0796f408b017d42d8edf5a475955491a0204a046b82f7d5
MD5 4027eb37a1a47d98612dfcf16d445de7
BLAKE2b-256 285ff57231c00a9a7516f62665ea34e3d21bcb45574437eeb2c71b9a035c8765

See more details on using hashes here.

File details

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

File metadata

  • Download URL: solarwindpy-0.2.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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22668f699f5469cad15db8970ee89711a3269c3cc81a4e00d6bb0501f0029a0f
MD5 c398d3e86a45ea7fd77886c752ee414e
BLAKE2b-256 b2fe695db7701389d87122e8ec550000ecc032f635ee494ceb0856deb91faf53

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