Space Weather Functions¶
Global space weather management and query functions.
Module: brahe.space_weather
Managing Global Provider¶
initialize_sw builtin ¶
initialize_sw() -> Any
Initialize the global space weather provider with recommended default settings.
This convenience function creates a CachingSpaceWeatherProvider with sensible defaults and sets it as the global provider. The provider will:
- Automatically download/update space weather files when older than 7 days
- Use the default cache location (~/.cache/brahe/sw19571001.txt)
- Hold the last known value when extrapolating beyond available data
- NOT auto-refresh on every access (manual refresh required)
This is the recommended way to initialize space weather data for most applications.
Raises:
| Type | Description |
|---|---|
Exception | If file download or loading failed |
set_global_space_weather_provider builtin ¶
set_global_space_weather_provider(provider: StaticSpaceWeatherProvider | FileSpaceWeatherProvider | CachingSpaceWeatherProvider) -> Any
Set the global space weather provider using any supported provider type.
This function accepts any of the three space weather provider types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider | StaticSpaceWeatherProvider | FileSpaceWeatherProvider | CachingSpaceWeatherProvider | Space weather provider to set globally | required |
Example
get_global_sw_mjd_last_daily_predicted builtin ¶
get_global_sw_mjd_last_daily_predicted() -> float
Get the last MJD with daily predicted data in the global provider.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Last MJD with daily predicted data |
get_global_sw_mjd_last_monthly_predicted builtin ¶
get_global_sw_mjd_last_monthly_predicted() -> float
Get the last MJD with monthly predicted data in the global provider.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Last MJD with monthly predicted data |
Querying Kp Index¶
get_global_kp builtin ¶
get_global_kp_all builtin ¶
get_global_kp_daily builtin ¶
Querying Ap Index¶
get_global_ap builtin ¶
get_global_ap_all builtin ¶
get_global_ap_daily builtin ¶
Querying F10.7 Solar Flux¶
get_global_f107_observed builtin ¶
get_global_f107_adjusted builtin ¶
get_global_f107_obs_avg81 builtin ¶
get_global_f107_adj_avg81 builtin ¶
Querying Sunspot Number¶
get_global_sunspot_number builtin ¶
Range Queries¶
get_global_last_kp builtin ¶
get_global_last_ap builtin ¶
get_global_last_daily_kp builtin ¶
Get the last N daily average Kp values from the global provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mjd | float | Modified Julian Date (end point) | required |
n | int | Number of daily values to return | required |
Returns:
| Type | Description |
|---|---|
list[float] | list[float]: List of daily average Kp indices (oldest first) |
get_global_last_daily_ap builtin ¶
Get the last N daily average Ap values from the global provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mjd | float | Modified Julian Date (end point) | required |
n | int | Number of daily values to return | required |
Returns:
| Type | Description |
|---|---|
list[float] | list[float]: List of daily average Ap indices (oldest first) |
get_global_last_f107 builtin ¶
Get the last N daily observed F10.7 values from the global provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mjd | float | Modified Julian Date (end point) | required |
n | int | Number of daily values to return | required |
Returns:
| Type | Description |
|---|---|
list[float] | list[float]: List of F10.7 values in sfu (oldest first) |