swvo.io.omni.omni_high_res#

Module for handling OMNI high resolution data.

Classes

OMNIHighRes([data_dir, prefer_env_var])

This is a class for the OMNI High Resolution data.

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

Bases: BaseIO

This is a class for the OMNI High Resolution data.

Parameters:
data_dirPath | None

Data directory for the OMNI High Resolution data. If not provided, it will be read from the environment variable

Methods

download_and_process(start_time, end_time[, ...])

Download and process OMNI High Resolution data files.

read(start_time, end_time[, cadence_min, ...])

Read high-resolution OMNI data for a time range.

Raises:
ValueError

Returns ValueError if necessary environment variable is not set.

available_variables(cadence: int = 1) DataFrame[source]#

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[source]#

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[source]#

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.