Collections are a way of grouping together data points from the same dataset. They are useful for representing a logical grouping of data points that are commonly queried together. For example, if you have a dataset that contains data from a specific instrument which is onboard different satellites, you may want to group the data points from each satellite together into a collection.

Overview

Here is a quick overview of the API for listing and accessing collections which is covered in this page. Some usage examples for different use-cases are provided below.

MethodAPI ReferenceDescription
dataset.collectionsListing collectionsList all available collections for a dataset.
dataset.collectionAccessing a collectionAccess an individual collection by its name.
collection.infoCollection informationRequest data information for a collection.

Check out the examples below for some common use-cases when working with collections. The examples assume that you have already created a client and listed the available datasets.

Listing collections

Each dataset has a list of collections associated with it. You can list the collections for a dataset using the collections method on the dataset object.

Output
{'L1GT': Collection L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC],
 'L1T': Collection L1T: [2013-03-26T09:33:19.763 UTC, 2020-08-24T03:21:50.000 UTC],
 'L1TP': Collection L1TP: [2013-03-24T00:25:55.457 UTC, 2024-08-19T12:58:20.229 UTC],
 'L2SP': Collection L2SP: [2015-01-01T07:53:35.391 UTC, 2024-08-12T12:52:03.243 UTC]}

The collections variable is a dictionary, where the keys are the names of the collections and the values are the collection objects themselves. Each collection within a dataset has a unique name. When listing collections, you can optionally also request the availability of each collection. This returns the time range for which data points are available in the collection. This is useful for determining which collections contain data points for a specific time range. You can request the availability by passing availability=True to the collections method (which is set by default).

Additionally you can also request the number of data points in each collection by passing count=True to the collections method.

Output
{'L1GT': Collection L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points),
 'L1T': Collection L1T: [2013-03-26T09:33:19.763 UTC, 2020-08-24T03:21:50.000 UTC] (87958 data points),
 'L1TP': Collection L1TP: [2013-03-24T00:25:55.457 UTC, 2024-08-19T12:58:20.229 UTC] (322041 data points),
 'L2SP': Collection L2SP: [2015-01-01T07:53:35.391 UTC, 2024-08-12T12:52:03.243 UTC] (191110 data points)}

Accessing individual collections

If you have already listed the collections for a dataset using dataset.collections(), you can access a specific collection by accessing the resulting dictionary of collections() with the name of an individual collection. You can then use the info() method on the collection object to get information (name, availability, and count) about the collection.

Output
L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points)

You can also access a specific collection by using the collection method on the dataset object as well. This has the advantage that you can directly access the collection without having to list all collections first.

Output
L1GT: [2013-03-25T12:08:43.699 UTC, 2024-08-19T12:57:32.456 UTC] (154288 data points)

Errors you may encounter

NotFoundError

If you try to access a collection with a name that does not exist, a NotFoundError error is raised. For example:

Next steps