swvo.io.sme.supermag#
Module for handling SuperMAG SME data.
Classes
|
Class for SuperMAG SME data. |
- class swvo.io.sme.supermag.SMESuperMAG(username: str, data_dir: Path | None = None, prefer_env_var: bool = False)[source]#
Bases:
BaseIOClass for SuperMAG SME data.
- Parameters:
- usernamestr
SuperMAG username used for authenticated data access (register at the SuperMAG website to obtain one)
- data_dirPath | None
Data directory for the SuperMAG SME data. If not provided, it will be read from the environment variable
- prefer_env_varbool, optional
If True, the environment variable takes precedence over the passed data_dir argument. If False (default), the passed data_dir is used if provided, otherwise the environment variable is used.
Methods
download_and_process(start_time, end_time[, ...])Download and process SuperMAG SME data files.
read(start_time, end_time[, download])Read SuperMAG SME data for a given time range.
- Raises:
- ValueError
Raised if the required environment variable is not set.
- download_and_process(start_time: datetime, end_time: datetime, reprocess_files: bool = False) None[source]#
Download and process SuperMAG SME data files.
- Parameters:
- start_timedatetime
Start time of the data to download. Must be timezone-aware.
- end_timedatetime
End time of the data to download. Must be timezone-aware.
- reprocess_filesbool, optional
Download and process files again. Defaults to False.
- Returns:
- None
- read(start_time: datetime, end_time: datetime, download: bool = False) DataFrame[source]#
Read SuperMAG SME data for a given time range.
- Parameters:
- start_timedatetime
Start time of the data to read. Must be timezone-aware.
- end_timedatetime
End time of the data to read. Must be timezone-aware.
- downloadbool, optional
Download missing data files on demand. Defaults to False.
- Returns:
pandas.DataFrameSuperMAG SME data.