geodesic.boson.dataset.Dataset.union#

Dataset.union(name, others=[], feature_limit=None, project=None, ignore_duplicate_fields=False, band_map=None, middleware={}, cache={}, tile_options={}, domain='*', category='*', type='*', **kwargs)[source]#

Creates a union of this dataset with a list of others.

Creates a new Dataset that is the union of this Dataset with a list of others. If others is an empty list, this creates a union of a dataset with itself, which is essentially a virtual copy of the original endowed with any capabilities’ Boson adds.

See: geodesic.boson.dataset.new_union_dataset()

Parameters:
  • name (str) – the name of the new Dataset

  • others (List[Dataset]) – a list of Datasets to union

  • feature_limit (int | None) – the max size of a results page from a query/search

  • project (Project | str | None) – the name of the project this will be assigned to

  • ignore_duplicate_fields (bool) – if True, duplicate fields across providers will be ignored

  • band_map (Dict[str, List[Dict]] | None) – a dictionary of new band names to the ‘image’ asset that will be mapped to existing asset/band combinations. See example for more details

  • middleware (MiddlewareConfig | list) – configure any boson middleware to be applied to the new dataset.

  • cache (CacheConfig) – configure caching for this dataset

  • tile_options (TileOptions) – configure tile options for this dataset

  • domain (str) – domain of the resulting Object

  • category (str) – category of the resulting Object

  • type (str) – the type of the resulting Object

  • **kwargs – additional properties to set on the new Dataset

Returns:

a new Dataset that is a union of this dataset with the others

Return type:

Dataset

Examples

>>> # create a union of two datasets
>>> ds1 = geodesic.get_dataset('cdc-places-2023')
>>> ds2 = geodesic.get_dataset('cdc-places-2022')
>>> ds_union = ds1.union(name='cdc-places-2022-2023', others=[ds2])
>>> ds_union.save()
>>> # create a union of a dataset with a list of other datasets
>>> cdc_ds_23 = geodesic.get_dataset('cdc-places-2023')
>>> cdc_ds_22 = geodesic.get_dataset('cdc-places-2022')
>>> cdc_ds_21 = geodesic.get_dataset('cdc-places-2021')
>>> cdc_ds_20 = geodesic.get_dataset('cdc-places-2020')
>>> ds_union = cdc_ds_23.union(name='cdc-places-2020-2023',
...                                 others=[cdc_ds_22, cdc_ds_21, cdc_ds_20])
>>> ds_union.save()
>>> # create a union of two datasets, but map the "image/b01" and "B1/0"
>>> asset/bands to "red"
>>> ds1 = ...
>>> ds2 = ...
>>> ds_union = ds1.union(
...     name="red-union",
...     others=[ds2],
...     band_map={
...         "red": [
...             {"asset": "image", "band": 'b01'},
...             {"asset": "B1", "band": 0}
... ]})