API Reference¶
pyspaceweather is a Python wrapper for the Australian Bureau of Meterology’s Space Weather API.
- class pyspaceweather.SpaceWeather(api_key)¶
The SpaceWeather API.
A class to interact with the Space Weather API, providing methods to retrieve various space weather data for the Australian region.
- Attributes:
- api_keystr
The API key for authenticating with the Space Weather API.
Methods
get_aurora_outlook():
Get details of any aurora outlook current for the Australian region.
get_aurora_watch():
Get details of any aurora watch current for the Australian region.
get_aurora_alert():
Get details of any aurora alert current for the Australian region.
get_mag_alert():
Get details of any magnetic alert current for the Australian region.
get_mag_warning():
Get details of any geophysical warning currently active for the Australian region.
get_a_index(start=””, end=””):
Get the most recent A index for the Australian region, or historical values.
get_k_index(start=””, end=””, location=None):
Get the most recent K index from a specific location, or historical values.
get_dst_index(start=””, end=””):
Get the most recent Dst index for the Australian region, or historical values.
- get_a_index(start='', end='')¶
Get the most recent A index for the Australian region, or historical values.
- Parameters:
- start: str or datetime, optional
The optional UTC starting time (YYYY-MM-DD HH:mm:ss) from which historical A index data is required.
- end: str or datetime, optional
The optional UTC ending valid_time (YYYY-MM-DD HH:mm:ss) before which historical A index data is required.
- Returns:
- list
A list of AIndex objects.
- get_aurora_alert()¶
Get details of any aurora alert current for the Australian region. Aurora alerts are used to report geomagnetic activity currently in progress and favourable for auroras.
- Returns:
- list
A list of AuroraAlert objects.
- get_aurora_outlook()¶
Get details of any aurora outlook current for the Australian region. Aurora outlooks are used to warn of likely auroral activity 3-7 days hence.
- Returns:
- list
A list of AuroraOutlook objects.
- get_aurora_watch()¶
Get details of any aurora watch current for the Australian region. Aurora watches are used to warn of likely auroral activity in the next 48 hours.
- Returns:
- list
A list of AuroraWatch objects.
- get_dst_index(start='', end='')¶
Get the the most recent Dst index for the Australian region, or historical values.
- Parameters:
- start: str or datetime, optional
The optional UTC starting time (YYYY-MM-DD HH:mm:ss) from which historical Dst index data is required.
- end: str or datetime, optional
The optional UTC ending time (YYYY-MM-DD HH:mm:ss) before which historical Dst index data is required.
- Returns:
- list
A list of DstIndex objects.
- get_k_index(start='', end='', location=None)¶
Get the most recent K index from a specific location, or historical values.
- Parameters:
- start: str or datetime, optional
The optional UTC starting time (YYYY-MM-DD HH:mm:ss) from which historical K index data is required.
- end: str or datetime, optional
The optional UTC ending time (YYYY-MM-DD HH:mm:ss) before which historical K index data is required.
- location: str, optional
The location for which the K index data is required. Australian region, or an Australian region observing site.
- Returns:
- list
A list of KIndex objects.
- get_mag_alert()¶
Get details of any magnetic alert current for the Australian region.
- Returns:
- list
A list of MagAlert objects.
- get_mag_warning()¶
Get details of any geophysical warning currently active for the Australian region.
- Returns:
- list
A list of MagWarning objects.
- class pyspaceweather.AuroraOutlook(issue_time, start_time, end_date, cause, k_aus, lat_band, comments)¶
Bases:
tupleAn aurora outlook current for the Australian region. Aurora outlooks are used to warn of likely auroral activity 3-7 days hence.
- Attributes:
- issue_timedatetime
The time (UTC) at which the outlook was issued.
- start_datedatetime
The first day (UTC) to which the outlook applies.
- end_datedatetime
The last day (UTC) to which the outlook applies.
- causestr
The dominant cause of the likely auroral activity. One of: coronal hole, coronal mass ejection.
- k_ausint
If available, the expected level of the auroral activity, according to the Australian region K index (0-9).
- lat_bandstr
If available, the latitude band from which auroral activity is likely to be visible, based on the value of k_aus. One of: high, mid, low, equatorial.
- commentsstr
Comments provided by the duty forecaster.
- class pyspaceweather.AuroraWatch(issue_time, start_date, end_date, cause, k_aus, lat_band, comments)¶
Bases:
tupleAn aurora watch current for the Australian region. Aurora watches are used to warn of likely auroral activity in the next 48 hours.
- Attributes:
- issue_timedatetime
The time (UTC) at which the watch was issued.
- start_datedatetime
The first day (UTC) to which the watch applies.
- end_datestr
The last day (UTC) to which the watch applies.
- causestr
The dominant cause of the likely auroral activity. One of: coronal hole, coronal mass ejection.
- k_ausint
The expected level of the auroral activity, according to the Australian region K index (0-9).
- lat_bandstr
The latitude band from which auroral activity is likely to be visible, based on the value of k_aus. One of: high, mid, low, equatorial.
- commentsstr
Comments provided by the duty forecaster.
- class pyspaceweather.AuroraAlert(start_time, valid_until, k_aus, lat_band, description)¶
Bases:
tupleA aurora alert current for the Australian region. Aurora alerts are used to report geomagnetic activity currently in progress and favourable for auroras.
- Attributes:
- start_timedatetime
The time (UTC) at which the alert became active.
- valid_untildatetime
The time (UTC) until which the alert is valid.
- k_ausint
The level of the alert, according to the Australian region K index (0-9).
- lat_bandstr
The latitude band from which auroral activity is likely to be visible, based on the value of k_aus. One of: high, mid, low, equatorial.
- descriptionstr
A description of the alert, based on the value of k_aus.
- class pyspaceweather.MagAlert(start_time, valid_until, g_scale, description)¶
Bases:
tupleA magnetic alert current for the Australian region.
- Attributes:
- start_time: datetime
The time (UTC) at which the alert became active.
- valid_until: datetime
The time (UTC) until which the alert is valid.
- g_scale: int
The level of the alert, according to the NOAA Geomagnetic Storm scale (G1-G5).
- description:
The level of the alert. One of: minor, major, severe.
- class pyspaceweather.MagWarning(issue_time, start_date, end_date, cause, activity, comments)¶
Bases:
tupleA geophysical warning currently active for the Australian region.
- Attributes:
- issue_timedatetime
The time (UTC) at which the warning was issued.
- start_datedatetime
The first day (UTC) to which the warning applies.
- end_datedatetime
The last day (UTC) to which the warning applies.
- cause: str
The cause, if known, of the expected geomagnetic activity. One of: coronal hole, coronal mass ejection, disappearing filament, flare.
- activity: list of dictionaries
Forecast geomagnetic activity levels for each day of the warning period.
- commentsstr
Comments, if any, provided by the duty forecaster.
- class pyspaceweather.AIndex(valid_time, index)¶
Bases:
tupleAn A-index.
- Attributes:
- valid_time: datetime
The start of the day (UTC) to which the A index pertains.
- index: datetime
The A index value: an integer from 0 to 400.
- class pyspaceweather.KIndex(valid_time, analysis_time, index)¶
Bases:
tupleA K-index.
- Attributes:
- valid_time: datetime
The start of the 3-hour period (UTC) to which the K index pertains
- analysis_time: datetime
The time (UTC) when the K index calculation was made.
- index: datetime
The K index value: an integer from 0 to 9.
- class pyspaceweather.DstIndex(valid_time, index)¶
Bases:
tupleA Dst-index.
- Attributes:
- valid_time: datetime
The start of the 3-hour period (UTC) to which the K index pertains.
- index: int
The Dst index value: an unbounded signed integer (likely range is -2000 to 300).