swarmpal.io._datafetchers#

Tools to connect to the outside world and get/create xarray Datasets

Classes#

Parameters

Control which dataset is accessed, and how the fetcher behaves

ViresParameters

Control which dataset is accessed, and how the fetcher behaves

HapiParameters

Control which dataset is accessed, and how the fetcher behaves

FileParameters

Control which dataset is accessed, and how the fetcher behaves

CDFFileParameters

Control which dataset is accessed, and how the fetcher behaves

NetCDFFileParameters

Control which dataset is accessed, and how the fetcher behaves

ManualParameters

Control which dataset is accessed, and how the fetcher behaves

DataFetcherBase

Interface with an external data source

ViresDataFetcher

Connects to and retrieves data from VirES through viresclient

HapiDataFetcher

Connects to and retrieves data from a HAPI server through hapiclient

NetCDFfileDataFetcher

Interface with an external data source

CDFfileDataFetcher

Interface with an external data source

ManualDataFetcher

Interface with an external data source

Functions#

get_fetcher(→ DataFetcherBase)

Module Contents#

class swarmpal.io._datafetchers.Parameters[source]#

Control which dataset is accessed, and how the fetcher behaves

pad_times: tuple[datetime.timedelta] = ()#
class swarmpal.io._datafetchers.ViresParameters[source]#

Bases: Parameters

Control which dataset is accessed, and how the fetcher behaves

collection: str = ''#
measurements: list[str] = []#
start_time: str | datetime.datetime = ''#
end_time: str | datetime.datetime = ''#
server_url: str = 'https://vires.services/ows'#
models: list[str] = []#
auxiliaries: list[str] = []#
sampling_step: str | None = None#
filters: list[str] = []#
options: dict#
class swarmpal.io._datafetchers.HapiParameters[source]#

Bases: Parameters

Control which dataset is accessed, and how the fetcher behaves

server: str = ''#
dataset: str = ''#
parameters: str = ''#
start: str = ''#
stop: str = ''#
options: dict#
class swarmpal.io._datafetchers.FileParameters[source]#

Bases: Parameters

Control which dataset is accessed, and how the fetcher behaves

filename: os.PathLike | None = None#
class swarmpal.io._datafetchers.CDFFileParameters[source]#

Bases: FileParameters

Control which dataset is accessed, and how the fetcher behaves

class swarmpal.io._datafetchers.NetCDFFileParameters[source]#

Bases: FileParameters

Control which dataset is accessed, and how the fetcher behaves

group: str | None = None#
class swarmpal.io._datafetchers.ManualParameters[source]#

Bases: Parameters

Control which dataset is accessed, and how the fetcher behaves

class swarmpal.io._datafetchers.DataFetcherBase[source]#

Bases: abc.ABC

Interface with an external data source

property source: str#
Abstractmethod:

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: Parameters#
Abstractmethod:

Set of parameters to control how/what data is accessed

abstractmethod fetch_data() xarray.Dataset[source]#

Command to get data as an xarray Dataset

config() dict[source]#
class swarmpal.io._datafetchers.ViresDataFetcher(**parameters)[source]#

Bases: DataFetcherBase

Connects to and retrieves data from VirES through viresclient

property source: str#

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: ViresParameters#

Set of parameters to control how/what data is accessed

vires_request#
_initialise_request() viresclient.SwarmRequest[source]#

Use the set parameters to initialise the request

fetch_data() xarray.Dataset[source]#

Process the request on VirES and load an xarray Dataset

class swarmpal.io._datafetchers.HapiDataFetcher(**parameters)[source]#

Bases: DataFetcherBase

Connects to and retrieves data from a HAPI server through hapiclient

property source: str#

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: HapiParameters#

Set of parameters to control how/what data is accessed

static _hapi_to_xarray(data: numpy.typing.ArrayLike, meta: dict) xarray.Dataset[source]#
_get_hapi_info() dict[source]#
fetch_data() xarray.Dataset[source]#

Make a HAPI query and load an xarray Dataset

class swarmpal.io._datafetchers.NetCDFfileDataFetcher(filename: os.PathLike, group: str | None = None)[source]#

Bases: DataFetcherBase

Interface with an external data source

property source: str#

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: NetCDFFileParameters#

Set of parameters to control how/what data is accessed

fetch_data() xarray.Dataset[source]#

Command to get data as an xarray Dataset

class swarmpal.io._datafetchers.CDFfileDataFetcher(**parameters)[source]#

Bases: DataFetcherBase

Interface with an external data source

property source: str#

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: CDFFileParameters#

Set of parameters to control how/what data is accessed

fetch_data() xarray.Dataset[source]#

Command to get data as an xarray Dataset

class swarmpal.io._datafetchers.ManualDataFetcher(xarray_dataset: xarray.Dataset)[source]#

Bases: DataFetcherBase

Interface with an external data source

property source: str#

String to identify the data source type (e.g. ‘vires’, ‘hapi’)

property parameters: FileParameters#

Set of parameters to control how/what data is accessed

_xarray#
fetch_data() xarray.Dataset[source]#

Command to get data as an xarray Dataset

swarmpal.io._datafetchers.get_fetcher(source) DataFetcherBase[source]#