speasy.core.requests_scheduling.request_dispatch module

speasy.core.requests_scheduling.request_dispatch.get_data(product: CatalogIndex, **kwargs) Catalog[source]
speasy.core.requests_scheduling.request_dispatch.get_data(product: TimetableIndex, **kwargs) TimeTable
speasy.core.requests_scheduling.request_dispatch.get_data(product: str, **kwargs) TimeTable
speasy.core.requests_scheduling.request_dispatch.get_data(product: DatasetIndex, start_time: str | datetime | float | datetime64, stop_time: str | datetime | float | datetime64, **kwargs) Dataset
speasy.core.requests_scheduling.request_dispatch.get_data(product: DatasetIndex, time_range: DateTimeRange | Tuple[str | datetime | float | datetime64, str | datetime | float | datetime64], **kwargs) Dataset
speasy.core.requests_scheduling.request_dispatch.get_data(product: DatasetIndex, time_range: Iterable[DateTimeRange | Tuple[str | datetime | float | datetime64, str | datetime | float | datetime64]], **kwargs) List[Dataset | None]
speasy.core.requests_scheduling.request_dispatch.get_data(product: ParameterIndex | ComponentIndex, start_time: str | datetime | float | datetime64, stop_time: str | datetime | float | datetime64, **kwargs) SpeasyVariable
speasy.core.requests_scheduling.request_dispatch.get_data(product: ParameterIndex | ComponentIndex, time_range: DateTimeRange | Tuple[str | datetime | float | datetime64, str | datetime | float | datetime64], **kwargs) SpeasyVariable
speasy.core.requests_scheduling.request_dispatch.get_data(product: ParameterIndex | ComponentIndex, time_range: Iterable[DateTimeRange | Tuple[str | datetime | float | datetime64, str | datetime | float | datetime64]], **kwargs) List[SpeasyVariable | None]
speasy.core.requests_scheduling.request_dispatch.get_data(product: ParameterIndex | ComponentIndex, time_range: TimetableIndex | CatalogIndex | Iterable[Iterable[str | datetime | float | datetime64]], **kwargs) List[SpeasyVariable | None]
speasy.core.requests_scheduling.request_dispatch.get_data(product: Iterable[ParameterIndex | ComponentIndex], start_time: str | datetime | float | datetime64, stop_time: str | datetime | float | datetime64, **kwargs) List[SpeasyVariable | None]
speasy.core.requests_scheduling.request_dispatch.get_data(product: Iterable[ParameterIndex | ComponentIndex], time_range: TimetableIndex | CatalogIndex | Iterable[Iterable[str | datetime | float | datetime64]], **kwargs) List[List[SpeasyVariable | None]]

Retrieve requested product(s). Speasy gives access to two kind of products, time-dependent products such as physical measurements or trajectories and products such as timetables or event catalogs. So depending on which product you want to retrieve speasy.get_data() accepts different sets of arguments:

  • For time-independent products:

get_data(product_or_products, **kwargs)
  • For time-dependent products:

get_data(product_or_products, start_time, stop_time, **kwargs)
get_data(product_or_products, datetime_range_or_datetime_range, **kwargs)

Since get_data accepts both at the same time a list of products and a list of ranges, it will always iterate first on products then on datetime ranges. In other words, all products will be retrieved for all given datetime ranges.

Parameters:
args

Either a time independent or a list of time independent indexes or any combination of time dependent or list of time dependent indexes plus a datetime range or a list of datetime ranges. See examples below for more details.

kwargs

For webservice specific keyword arguments check Web services.

  • disable_proxy: bool

    ignore proxy configuration and always bypass proxy server when True (default: False).

  • disable_cache: bool

    ignore cache content when True (default: False).

  • progress: bool

    show progress bar when True (default: False).

Returns:
requested product(s) according to given parameters, either a single product or a collection of products.

Examples

  • A simple parameter request on a single tile range:

>>> import speasy as spz
>>> spz.get_data("amda/imf_gsm", "2016-10-10", "2016-10-11")
<speasy.products.variable.SpeasyVariable object at ...>
  • Same with a catalog using Speasy dynamic inventory:

>>> import speasy as spz
>>> amda_catalogs = spz.inventories.tree.amda.Catalogs
>>> spz.get_data(amda_catalogs.SharedCatalogs.EARTH.model_regions_plasmas_cluster_2005)
<Catalog: model_regions_plasmas_cluster_2005>
  • You can also request a collection of catalogs:

>>> import speasy as spz
>>> amda_catalogs = spz.inventories.tree.amda.Catalogs
>>> spz.get_data([amda_catalogs.SharedCatalogs.EARTH.model_regions_plasmas_cluster_2005,
...               amda_catalogs.SharedCatalogs.EARTH.model_regions_plasmas_mms_2019])
[<Catalog: model_regions_plasmas_cluster_2005>, <Catalog: model_regions_plasmas_mms_2019>]
  • You can also request a parameter for several intervals:

>>> import speasy as spz
>>> spz.get_data("amda/imf_gsm", [["2016-10-10", "2016-10-11"],
...                               ["2017-10-10", "2017-10-11"]])
[<speasy.products.variable.SpeasyVariable object at ...>, <speasy.products.variable.SpeasyVariable object at ...>]
  • Several products on a single interval:

>>> import speasy as spz
>>> spz.get_data(["amda/imf_gsm", spz.inventories.tree.ssc.Trajectories.wind],
...              "2016-10-10", "2016-10-11")
[<speasy.products.variable.SpeasyVariable object at ...>, <speasy.products.variable.SpeasyVariable object at ...>]
  • Several products for several time ranges:

>>> import speasy as spz
>>> data= spz.get_data(["amda/imf_gsm",
...                  spz.inventories.tree.ssc.Trajectories.wind],
...              [["2016-10-10", "2016-10-11"],
...               ["2017-10-10", "2017-10-11"]])
>>> len(data), len(data[0])
(2, 2)
  • A catalog or a timetable can also be used as time ranges collection to download a product:

>>> import speasy as spz
>>> amda_shared_tt = spz.inventories.tree.amda.TimeTables.SharedTimeTables
>>> mex_inventory = spz.inventories.tree.amda.Parameters.MEX
>>> mgs_inventory = spz.inventories.tree.amda.Parameters.MGS
>>> conj_mex_mgs = spz.get_data(amda_shared_tt.MARS.conjonctions_mex_mgs_2004_0)
>>> data = spz.get_data(
...                     [mex_inventory.ELS.mex_els_all.mex_els_spec,
...                      mgs_inventory.MAG.mgs_mag_mso.b_mgs_mso],
...                     conj_mex_mgs)
>>> len(data), len(data[0])
(2, 28)
  • Can even pass a CatalogIndex or a TimeTableIndex directly:

>>> import speasy as spz
>>> amda_shared_tt = spz.inventories.tree.amda.TimeTables.SharedTimeTables
>>> mex_inventory = spz.inventories.tree.amda.Parameters.MEX
>>> mgs_inventory = spz.inventories.tree.amda.Parameters.MGS
>>> data = spz.get_data(
...                     [mex_inventory.ELS.mex_els_all.mex_els_spec,
...                      mgs_inventory.MAG.mgs_mag_mso.b_mgs_mso],
...                     amda_shared_tt.MARS.conjonctions_mex_mgs_2004_0)
>>> len(data), len(data[0])
(2, 28)
speasy.core.requests_scheduling.request_dispatch.list_providers() List[str][source]
speasy.core.requests_scheduling.request_dispatch.provider_and_product(path_or_product: str) -> (<class 'str'>, <class 'str'>)[source]

Breaks given product in two parts: provider and product UID

Parameters:
path_or_productstr or SpeasyIndex

The product as SpeasyIndex or path as string you want to split

Returns
——-
(str, str)

the provider UID and the product UID