Skip to content

Space Weather

Daily geomagnetic (\(K_p\), \(a_p\)) and solar-flux (\(F_{10.7}\)) indices — the inputs NRLMSISE-00 consumes when use_spaceweather is enabled. The table is assembled from three primary sources: the GFZ Potsdam observed record (CC BY 4.0), the NOAA/SWPC 45-day forecast and the NASA MSFC MSAFE monthly forecast (both public domain).

Only the first block is measurement. Use coverage and status to find out where an epoch falls before relying on the result; see Data coverage for what each regime does and does not know. init_from_path loads a GFZ table of your own.

spaceweather

Space weather data access

Daily space-weather records (Kp/Ap geomagnetic indices, F10.7 solar flux and 81-day averages) assembled from three primary sources: the GFZ Potsdam observed record (CC BY 4.0), the NOAA/SWPC 45-day forecast and the NASA MSFC MSAFE monthly forecast (both public domain). These are the inputs the NRLMSISE-00 density model consumes when use_spaceweather is enabled.

get(time)

Space-weather record for the given time

Returns the daily record closest to and not after the given time.

Parameters:

Name Type Description Default
time time | datetime

Time for which to return the record

required

Returns:

Name Type Description
dict dict

Space-weather record with keys:

  • date (satkit.time) — date of the record
  • kp (list[int]) — eight 3-hourly Kp indices (x10)
  • kp_sum (int) — daily Kp sum
  • ap (list[int]) — eight 3-hourly Ap indices
  • ap_avg (int) — daily average Ap
  • f10p7_obs (float) — observed F10.7 solar flux, sfu (10^-22 W m^-2 Hz^-1)
  • f10p7_adj (float) — F10.7 adjusted to 1 AU, sfu
  • f10p7_obs_c81 / f10p7_obs_l81 (float) — 81-day centered / last-81-day observed averages, sfu
  • f10p7_adj_c81 / f10p7_adj_l81 (float) — 81-day centered / last-81-day adjusted averages, sfu
  • isn (int) — international sunspot number; -1 throughout the default table (GFZ's sunspot number is CC BY-NC and not ingested)
  • cp (float) — planetary daily character figure
  • c9 (int) — Cp scaled to [0, 9]
  • bsrn (int) — Bartels solar rotation number
  • nd (int) — day within the Bartels rotation
  • data_type (str) — provenance: "OBS" measured and definitive, "OBS-P" measured but still preliminary, "INT" interpolated, "PRD" daily prediction, "PRM" monthly prediction, "" unknown
dict

Fields not yet published for predicted (future) rows are -1.

dict

MSAFE "PRM" rows carry a climatological daily Ap in every ap

dict

slot and -1 for kp. Use :func:coverage / :func:status to

dict

check which regime an epoch is in before propagating.

Raises:

Type Description
RuntimeError

If no space-weather record is available for the date

update()

Refresh the space-weather files and reload the in-memory table

The GFZ observed record (every 3 h), the SWPC 45-day forecast (daily) and the MSAFE monthly forecast are each re-fetched only when older than their publication cadence. Run this (or satkit.utils.update_datafiles) periodically for current values.

init_from_path(path)

Load the space-weather table from a file, replacing whatever is loaded

Accepts the GFZ Kp_ap_Ap_SN_F107_since_1932.txt table (observed only). This is how to pin satkit to one fixed input file when a comparison must not move with the daily refresh.

Parameters:

Name Type Description Default
path str | PathLike

File to load

required

init_from_bytes(data)

Load the space-weather table from bytes, replacing whatever is loaded

Same formats as :func:init_from_path.

Parameters:

Name Type Description Default
data bytes

File contents

required

coverage()

Time bounds of the loaded space-weather table

last_daily is the boundary that matters for atmospheric drag: past it the table holds only monthly MSAFE rows — a 13-month-smoothed F10.7 and a climatological daily Ap, with no 3-hourly structure and no storm timing.

Returns:

Type Description
tuple[time, time, time, time] | None

tuple[satkit.time, satkit.time, satkit.time, satkit.time] | None:

tuple[time, time, time, time] | None

(first, last_observed, last_daily, last), or None if no

tuple[time, time, time, time] | None

space-weather table is loaded.

Example

first, last_obs, last_daily, last = satkit.spaceweather.coverage()

status(time)

Where a time falls relative to the loaded space-weather table

Parameters:

Name Type Description Default
time time | datetime

Time to classify

required

Returns:

Name Type Description
str str

One of "observed", "predicted_daily" (inside the

str

NOAA/SWPC 45-day forecast), "predicted_monthly" (the MSAFE monthly

forecast str

smoothed F10.7 and a climatological Ap, no storm timing),

str

"extrapolated" (past the table; the last row is returned

str

unchanged), "before_table", or "not_loaded".

disable_space_weather_time_warning()

Disable the warnings about out-of-range or missing space-weather data

Four one-time warnings exist: an epoch past the daily predictions, an epoch past the end of the table, no table loaded at all, and an index NRLMSISE-00 has to take its default for (an epoch before the table starts, or F10.7 before 1947). Each is shown at most once per process; this suppresses all of them. They are logged to the satkit.spaceweather logger; silencing that logger (or satkit) with :mod:logging works too.