swvo.io.solar_wind.omni#

Module handling SW data from OMNI High Resolution files.

Classes

SWOMNI([data_dir, prefer_env_var])

Class for reading SW data from OMNI High resolution files.

class swvo.io.solar_wind.omni.SWOMNI(data_dir: Path | None = None, prefer_env_var: bool = False)[source]#

Bases: OMNIHighRes

Class for reading SW data from OMNI High resolution files. Inherits the download_and_process(), other private methods and attributes from OMNIHighRes.

available_variables(cadence: int = 1) DataFrame#

Return metadata for variables available at a cadence.

Parameters:
cadenceint, optional

OMNI cadence in minutes. Must be 1 or 5.

Returns:
pandas.DataFrame

One row per variable with its canonical name, NASA request ID, description, unit, supported cadences, and accepted aliases.

Raises:
AssertionError

If cadence is not 1 or 5.

download_and_process(start_time: datetime, end_time: datetime, cadence_min: int = 1, reprocess_files: bool = False) None#

Download and process OMNI High Resolution data files.

Parameters:
start_timedatetime

Start time for data download.

end_timedatetime

End time for data download.

cadence_minint, optional

Cadence of the data in minutes, defaults to 1

reprocess_filesbool, optional

Downloads and processes the files again, defaults to False, by default False

Returns:
None
Raises:
AssertionError

Raises AssertionError if the cadence is not 1 or 5 minutes.

ValueError

If start_time is not before end_time.

read(start_time: datetime, end_time: datetime, cadence_min: int = 1, download: bool = False, variables: str | Iterable[str] | None = None) DataFrame#

Read high-resolution OMNI data for a time range.

Parameters:
start_timedatetime

Start time for reading data.

end_timedatetime

End time for reading data.

cadence_minint, optional

Cadence of the data in minutes, defaults to 1

downloadbool, optional

Download data on the go, defaults to False.

variablesstr or iterable of str or None, optional

Variables to return. None preserves the legacy nine-column schema, "all" returns every variable supported by the selected cadence, and a name or iterable selects a subset. Normalized aliases such as "sym_h" are accepted.

Returns:
pandas.DataFrame

Selected OMNI variables plus file_name provenance. The index is timezone-aware UTC.

Raises:
AssertionError

Raises AssertionError if the cadence is not 1 or 5 minutes.

ValueError

If the time range is invalid, a variable is unknown or unavailable at the selected cadence, or an existing partial or unreadable cache cannot satisfy the request.