swvo.io.hp.gfz#

Classes

Hp30GFZ([data_dir, prefer_env_var])

A class to handle Hp30 data from GFZ.

Hp60GFZ([data_dir, prefer_env_var])

A class to handle Hp30 data from GFZ.

HpGFZ(index[, data_dir, prefer_env_var])

This is a base class for HpGFZ data.

class swvo.io.hp.gfz.HpGFZ(index: str, data_dir: Path | None = None, prefer_env_var: bool = False)[source]#

Bases: BaseIO

This is a base class for HpGFZ data.

Parameters:
indexstr

Hp index. Possible options are: hp30, hp60.

data_dirPath | None

Data directory for the Hp 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 HpGFZ data.

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

Read HpGFZ data for the given time range.

Raises:
ValueError

Returns ValueError if necessary environment variable is not set.

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

Download and process HpGFZ data.

Parameters:
start_timedatetime

Start time of the data to be downloaded.

end_timedatetime

End time of the data to be downloaded.

reprocess_filesbool, optional

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

Returns:
None
read(start_time: datetime, end_time: datetime, *, download: bool = False) DataFrame[source]#

Read HpGFZ data for the 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 data on the go, defaults to False.

Returns:
pandas.DataFrame

HpGFZ data for the given time range.

class swvo.io.hp.gfz.Hp30GFZ(data_dir: Path | None = None, prefer_env_var: bool = False)[source]#

Bases: HpGFZ

A class to handle Hp30 data from GFZ.

Parameters:
data_dirstr | Path, optional

Data directory for the Hp30 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.

download_and_process(start_time: datetime, end_time: datetime, *, reprocess_files: bool = False) None#

Download and process HpGFZ data.

Parameters:
start_timedatetime

Start time of the data to be downloaded.

end_timedatetime

End time of the data to be downloaded.

reprocess_filesbool, optional

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

Returns:
None
read(start_time: datetime, end_time: datetime, *, download: bool = False) DataFrame#

Read HpGFZ data for the 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 data on the go, defaults to False.

Returns:
pandas.DataFrame

HpGFZ data for the given time range.

class swvo.io.hp.gfz.Hp60GFZ(data_dir: Path | None = None, prefer_env_var: bool = False)[source]#

Bases: HpGFZ

A class to handle Hp30 data from GFZ.

Parameters:
data_dirstr | Path, optional

Data directory for the Hp30 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.

download_and_process(start_time: datetime, end_time: datetime, *, reprocess_files: bool = False) None#

Download and process HpGFZ data.

Parameters:
start_timedatetime

Start time of the data to be downloaded.

end_timedatetime

End time of the data to be downloaded.

reprocess_filesbool, optional

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

Returns:
None
read(start_time: datetime, end_time: datetime, *, download: bool = False) DataFrame#

Read HpGFZ data for the 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 data on the go, defaults to False.

Returns:
pandas.DataFrame

HpGFZ data for the given time range.