Collection#

The Collection class is a Pydantic model representing individual collection and its metadata.

pydantic model eodag.api.collection.Collection[source]#

A class representing a collection.

A Collection object is used to describe a group of related EOProduct objects.

Parameters:

data (Any)

Show JSON schema
{
   "title": "Collection",
   "description": "A class representing a collection.\n\nA Collection object is used to describe a group of related :class:`~eodag.api.product._product.EOProduct` objects.",
   "type": "object",
   "properties": {
      "id": {
         "title": "Id",
         "type": "string"
      },
      "title": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Title"
      },
      "description": {
         "default": "Not Available",
         "title": "Description",
         "type": "string"
      },
      "extent": {
         "$ref": "#/$defs/Extent",
         "default": {
            "spatial": {
               "bbox": [
                  [
                     -180.0,
                     -90.0,
                     180.0,
                     90.0
                  ]
               ]
            },
            "temporal": {
               "interval": [
                  [
                     null,
                     null
                  ]
               ]
            }
         },
         "description": "The temporal extent of the collection, following the STAC specification for extent definition (e.g. {\"spatial\": {\"bbox\": [[-180.0, -90.0, 180.0, 90.0]]}, \"temporal\": {\"interval\": [[\"2024-06-10T12:00:00Z\", None]]}}), with date/time strings in RFC 3339 format"
      },
      "keywords": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Keywords"
      },
      "license": {
         "default": "other",
         "title": "License",
         "type": "string"
      },
      "links": {
         "anyOf": [
            {
               "$ref": "#/$defs/Links"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "providers": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/Provider"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Providers"
      },
      "constellation": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Constellation"
      },
      "instruments": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Instruments"
      },
      "platform": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Platform"
      },
      "processing:level": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Processing:Level"
      },
      "sci:doi": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Sci:Doi"
      },
      "eodag:sensor_type": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Eodag:Sensor Type"
      },
      "alias": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "An alias given by a user to use his customized id intead of the internal id of EODAG",
         "title": "Alias"
      },
      "stacCollection": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Staccollection"
      }
   },
   "$defs": {
      "Extent": {
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/collection-spec/collection-spec.md#extent-object",
         "properties": {
            "spatial": {
               "$ref": "#/$defs/SpatialExtent"
            },
            "temporal": {
               "$ref": "#/$defs/TimeInterval"
            }
         },
         "required": [
            "spatial",
            "temporal"
         ],
         "title": "Extent",
         "type": "object"
      },
      "Link": {
         "additionalProperties": true,
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/collection-spec/collection-spec.md#link-object",
         "properties": {
            "href": {
               "minLength": 1,
               "title": "Href",
               "type": "string"
            },
            "rel": {
               "minLength": 1,
               "title": "Rel",
               "type": "string"
            },
            "type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MimeTypes"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Type"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Title"
            }
         },
         "required": [
            "href",
            "rel"
         ],
         "title": "Link",
         "type": "object"
      },
      "Links": {
         "items": {
            "$ref": "#/$defs/Link"
         },
         "title": "Links",
         "type": "array"
      },
      "MimeTypes": {
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#media-types",
         "enum": [
            "image/tiff; application=geotiff",
            "image/tiff; application=geotiff; profile=cloud-optimized",
            "image/jp2",
            "image/png",
            "image/jpeg",
            "application/geo+json",
            "application/geo+json-seq",
            "application/geopackage+sqlite3",
            "application/vnd.google-earth.kml+xml",
            "application/vnd.google-earth.kmz",
            "application/x-protobuf",
            "application/vnd.mapbox-vector-tile",
            "application/x-hdf",
            "application/x-hdf5",
            "application/xml",
            "application/json",
            "application/ndjson",
            "text/html",
            "text/plain",
            "application/vnd.oai.openapi+json;version=3.0",
            "application/vnd.oai.openapi;version=3.0",
            "application/schema+json",
            "application/pdf",
            "text/csv",
            "application/vnd.apache.parquet",
            "application/octet-stream"
         ],
         "title": "MimeTypes",
         "type": "string"
      },
      "Provider": {
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/collection-spec/collection-spec.md#provider-object",
         "properties": {
            "name": {
               "minLength": 1,
               "title": "Name",
               "type": "string"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Description"
            },
            "roles": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Roles"
            },
            "url": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Url"
            }
         },
         "required": [
            "name"
         ],
         "title": "Provider",
         "type": "object"
      },
      "SpatialExtent": {
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/collection-spec/collection-spec.md#spatial-extent-object",
         "properties": {
            "bbox": {
               "items": {
                  "anyOf": [
                     {
                        "maxItems": 4,
                        "minItems": 4,
                        "prefixItems": [
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           }
                        ],
                        "type": "array"
                     },
                     {
                        "maxItems": 6,
                        "minItems": 6,
                        "prefixItems": [
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           },
                           {
                              "anyOf": [
                                 {
                                    "type": "number"
                                 },
                                 {
                                    "type": "integer"
                                 }
                              ]
                           }
                        ],
                        "type": "array"
                     }
                  ]
               },
               "title": "Bbox",
               "type": "array"
            }
         },
         "required": [
            "bbox"
         ],
         "title": "SpatialExtent",
         "type": "object"
      },
      "TimeInterval": {
         "description": "https://github.com/radiantearth/stac-spec/blob/v1.0.0/collection-spec/collection-spec.md#temporal-extent-object",
         "properties": {
            "interval": {
               "items": {
                  "items": {
                     "anyOf": [
                        {
                           "format": "date-time",
                           "type": "string"
                        },
                        {
                           "type": "null"
                        }
                     ]
                  },
                  "maxItems": 2,
                  "minItems": 2,
                  "type": "array"
               },
               "minItems": 1,
               "title": "Interval",
               "type": "array"
            }
         },
         "required": [
            "interval"
         ],
         "title": "TimeInterval",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "id"
   ]
}

Config:
  • extra: str = forbid

  • validate_by_name: bool = True

  • serialize_by_alias: bool = True

Validators:
field alias: Optional[str]#

An alias given by a user to use his customized id intead of the internal id of EODAG

field constellation: Optional[str]#
field description: str#
field eodag_sensor_type: Optional[str] (alias 'eodag:sensor_type')#
field eodag_stac_collection: Optional[str] (alias 'stacCollection')#
field extent: Extent#

The temporal extent of the collection, following the STAC specification for extent definition (e.g. {“spatial”: {“bbox”: [[-180.0, -90.0, 180.0, 90.0]]}, “temporal”: {“interval”: [[“2024-06-10T12:00:00Z”, None]]}}), with date/time strings in RFC 3339 format

field id: str [Required]#
field instruments: Optional[list[str]]#
field keywords: Optional[list[str]]#
field license: str#
field platform: Optional[str]#
field processing_level: Optional[str] (alias 'processing:level')#
field providers: Optional[list[Provider]]#
field sci_doi: Optional[str] (alias 'sci:doi')#
field title: Optional[str]#
classmethod create_with_dag(dag, **kwargs)[source]#

Create a Collection with a EODataAccessGateway instance.

Parameters:
  • dag (EODataAccessGateway) – The gateway instance to use to search products and to list queryables of the collection instance

  • kwargs – The collection attributes

Return type:

Collection

classmethod get_collection_mtd_from_alias(value)[source]#

Get collection metadata from alias

>>> Collection.get_collection_mtd_from_alias('processing:level')
'processing_level'
Parameters:

value (str)

Return type:

str

validator validate_collection  »  all fields[source]#

Allow to create a collection instance with bad formatted attributes (except id). Set incorrectly formatted attributes to None and ignore extra attributes. Log a warning about validation errors if EODAG_VALIDATE_COLLECTIONS environment variable is set to True.

Parameters:
Return type:

Self

list_queryables(**kwargs)[source]#

Fetch the queryable properties for this collection using the dag attribute of the instance.

Parameters:

kwargs (Any) – additional filters for queryables

Return type:

QueryablesDict

Returns:

A QuerybalesDict containing the EODAG queryable properties, associating parameters to their annotated type, and an additional_properties attribute

Raises:

ValidationError: If the collection argument is set in kwargs, since it is already defined by the instance

model_post_init(context)[source]#

Post-initialization method to set internal attributes.

Parameters:

context (Any)

Return type:

None

search(**kwargs)[source]#

Look for products of this collection matching criteria using the dag attribute of the instance.

Parameters:

kwargs (Any) – Some other criteria that will be used to do the search, using parameters compatible with the provider

Return type:

SearchResult

Returns:

A collection of EO products matching the criteria.

Raises:

ValidationError: If the collection argument is set in kwargs, since it is already defined by the instance

serialize()[source]#

Serialize the Collection instance to a STAC dictionary.

Return type:

dict[str, Any]

Returns:

A STAC dictionary representation of the Collection instance.

validator set_id_from_alias  »  all fields[source]#

If an alias exists, use it to update id attribute

Return type:

Self

class eodag.api.collection.CollectionsDict(collections)[source]#

A UserDict object which values are Collection objects, keyed by provider id.

Parameters:

collections (list[Collection]) – A list of collections

Variables:

data – List of collections

class eodag.api.collection.CollectionsList(collections)[source]#

An object representing a collection of Collection.

Parameters:

collections (list[Collection]) – A list of collections

Variables:

data – List of collections