swvo.io.omni.omni_low_res#

Module for handling OMNI low resolution data.

Classes

OMNILowRes([data_dir, prefer_env_var])

This is a class for the OMNI Low Resolution data.

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

Bases: BaseIO

This is a class for the OMNI Low Resolution data.

Methods

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

Download and process OMNI Low Resolution data files.

read(start_time, end_time[, download, variables])

Read hourly OMNI2 data for a time range.

Raises:
ValueError

Returns ValueError if necessary environment variable is not set.

available_variables() DataFrame[source]#

Return metadata for every hourly OMNI2 output variable.

Returns:
pandas.DataFrame

One row per hourly variable with its canonical name, description, unit, fill value, and accepted aliases.

download_and_process(start_time: datetime, end_time: datetime, reprocess_files: bool = False) None[source]#

Download and process OMNI Low Resolution data files.

Parameters:
start_timedatetime

Start time for the data to be downloaded and processed.

end_timedatetime

End time for the data to be downloaded and processed.

reprocess_filesbool, optional

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

Returns:
None
Raises:
ValueError

If start_time is not before end_time.

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

Read hourly OMNI2 data for a time range.

Parameters:
start_timedatetime

Start time for the data to be read.

end_timedatetime

End time for the data to be read.

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 dst, kp, and f107 schema, "all" returns all 54 non-time fields, and a name or iterable selects a subset.

Returns:
pandas.DataFrame

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

Raises:
ValueError

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