swvo.io.kp.bgs#
Module for handling BGS Kp data.
Classes
|
A class to handle BGS Kp data. |
- class swvo.io.kp.bgs.KpBGS(data_dir: Path | None = None, prefer_env_var: bool = False)[source]#
Bases:
BaseIOA class to handle BGS Kp data.
- Parameters:
- data_dirPath | None
Data directory for the BGS Kp data. If not provided, it will be read from the environment variable
Methods
download_and_process([request_time, ...])Download and process BGS Kp data file for a specific month.
read([start_time, end_time, download])Read BGS Kp data for the specified time range.
- Raises:
- ValueError
Returns ValueError if necessary environment variable is not set.
- download_and_process(request_time: datetime | None = None, reprocess_files: bool = False) None[source]#
Download and process BGS Kp data file for a specific month.
- Parameters:
- request_timeOptional[datetime]
Time for which to download and process data (month and year are extracted).
- reprocess_filesbool, optional
Downloads and processes the files again, defaults to False, by default False
- Raises:
- FileNotFoundError
Raise FileNotFoundError if the file is not downloaded successfully.
- read(start_time: datetime | None = None, end_time: datetime | None = None, download: bool = False) DataFrame[source]#
Read BGS Kp data for the specified time range.
- Parameters:
- start_timeOptional[datetime]
Start time of the data to read.
- end_timeOptional[datetime]
End time of the data to read.
- downloadbool, optional
Download data on the go, defaults to False.
- Returns:
pandas.DataFrameBGS Kp dataframe.