SpaceWeather

version

SpaceWeather.jl provides easy access to space weather indices and data, with automatic downloading and caching from various sources.

Installation

using Pkg
Pkg.add("SpaceWeather")

Quickstart

Basic Usage

using SpaceWeather
using Dates

# Fetch all available space weather data from Celestrak
data = celestrak()

# Access Kp index (3-hourly planetary K-index)
kp_values = data.Kp                              # All Kp values as KeyedArray
kp_at_time = data.Kp(DateTime(2023, 1, 1, 1, 30))  # Query specific time

# Access Ap index (3-hourly planetary A-index)
ap_values = data.Ap

# Get data for a specific time range
data_2023 = celestrak(Date(2023, 1, 1), Date(2023, 12, 31))
kp_2023 = data_2023.Kp
ap_2023 = data_2023.Ap

# High-level accessor functions
kp = Kp(Date(2023, 1, 1), Date(2023, 12, 31))
ap = Ap(Date(2023, 1, 1), Date(2023, 12, 31))
1-dimensional KeyedArray(NamedDimsArray(...)) with keys:
↓   time ∈ 2920-element StepRange{Dates.DateTime,...}
And data, 2920-element reshape(adjoint(::Matrix{Float64}), 2920) with eltype Float64:
  Dates.DateTime("2023-01-01T01:30:00")    9.0
  Dates.DateTime("2023-01-01T04:30:00")   15.0
  Dates.DateTime("2023-01-01T07:30:00")    7.0
  Dates.DateTime("2023-01-01T10:30:00")   12.0
  Dates.DateTime("2023-01-01T13:30:00")    6.0
  Dates.DateTime("2023-01-01T16:30:00")   12.0
  Dates.DateTime("2023-01-01T19:30:00")   22.0
  Dates.DateTime("2023-01-01T22:30:00")   27.0
  ⋮                                       
  Dates.DateTime("2023-12-31T04:30:00")    3.0
  Dates.DateTime("2023-12-31T07:30:00")    2.0
  Dates.DateTime("2023-12-31T10:30:00")    2.0
  Dates.DateTime("2023-12-31T13:30:00")    2.0
  Dates.DateTime("2023-12-31T16:30:00")    3.0
  Dates.DateTime("2023-12-31T19:30:00")    4.0
  Dates.DateTime("2023-12-31T22:30:00")    5.0

Data is automatically cached and can be refreshed with celestrak(update=true). Cache is automatically refreshed if older than 30 days.

API Reference

SpaceWeather.CelestrakType

Celestrak space weather data.

  • Source: https://celestrak.com/SpaceData/
  • Documentation: https://celestrak.org/SpaceData/SpaceWx-format.php

Provides:

  • data.Kp: KeyedArray vector of 3-hourly Kp values indexed by timestamps
  • data.Ap: KeyedArray vector of 3-hourly Ap values indexed by timestamps
  • All CSV columns: data.DATE, data.ISN, data.F10_7_OBS, etc.
source
SpaceWeather.KpMethod
Kp(t0, t1; source=:celestrak, kwargs...)

Get Planetary K-index data from source.

https://www.swpc.noaa.gov/products/planetary-k-index

source
SpaceWeather.celestrakMethod
celestrak(t0, t1; update=false) :: Celestrak

Load and filter Celestrak data between dates t0 and t1 (inclusive).

Example

# Get data for year 2023
data_2023 = celestrak(Date(2023,1,1), Date(2023,12,31))
source
SpaceWeather.celestrakMethod
celestrak(; update=false) :: Celestrak

Load daily space weather data from Celestrak.

Set update=true to refresh data from the server.

Example

data = celestrak()
data.Kp                           # KeyedArray with 3h timestamps
data.Kp(DateTime(2023,1,1,1,30))  # Access by timestamp
data.KP1                          # First 3h interval (daily)
data.ISN                          # Sunspot numbers
source
SpaceWeather.xrsaMethod
xrsa(id, args...; kwargs...) :: KeyedArray

Get GOES-R XRS-A (0.05-0.4 nm) X-ray flux data.

source
SpaceWeather.xrsbMethod
xrsb(id, args...; kwargs...) :: KeyedArray

Get GOES-R XRS-B (0.1-0.8 nm) X-ray flux data.

source
SpaceWeather.GOESModule
Geostationary Operational Environmental Satellites
  • R Series | NOAA/NASA: https://www.goes-r.gov/
  • Data Source: https://data.ngdc.noaa.gov/platforms/solar-space-observing-satellites/goes/
  • Documentation: https://www.ngdc.noaa.gov/stp/satellite/goes-r.html
  • Catalog: https://catalog.data.gov/dataset/geostationary-operational-environmental-satellite-r-series-goes-r-space-environment-in-situ-sui2
  • SEISS Documentation: https://www.ncei.noaa.gov/products/goes-r-space-environment-in-situ
source
SpaceWeather.GOES.XRSConstant
XRS(id, t0, t1; update=false)

Load GOES-R EXIS X-Ray Sensor (XRS) data for a date range, combining multiple daily files.

Example

dataset = XRS(16, Date(2020, 6, 1), Date(2020, 6, 2))
dataset.xrsa_flux  # Combined X-ray flux data
source