pygeodes.utils.stac.Collection#

class pygeodes.utils.stac.Collection(id: str, description: str, extent: Extent, title: str | None = None, stac_extensions: List[str] | None = None, href: str | None = None, extra_fields: Dict[str, Any] | None = None, catalog_type: CatalogType | None = None, license: str = 'proprietary', keywords: List[str] | None = None, providers: List[Provider] | None = None, summaries: Summaries | None = None, assets: Dict[str, Asset] | None = None)[source]#

Bases: Collection

__init__(id: str, description: str, extent: Extent, title: str | None = None, stac_extensions: List[str] | None = None, href: str | None = None, extra_fields: Dict[str, Any] | None = None, catalog_type: CatalogType | None = None, license: str = 'proprietary', keywords: List[str] | None = None, providers: List[Provider] | None = None, summaries: Summaries | None = None, assets: Dict[str, Asset] | None = None)[source]#

Methods

__init__(id, description, extent[, title, ...])

add_asset(key, asset)

Adds an Asset to this collection.

add_child(child[, title, strategy, set_parent])

Adds a link to a child Catalog or Collection.

add_children(children)

Adds links to multiple Catalog or ~pystac.Collection objects.

add_item(item[, title, strategy, set_parent])

Adds a link to an Item.

add_items(items[, strategy])

Adds links to multiple Items.

add_link(link)

Add a link to this object's set of links.

add_links(links)

Add links to this object's set of links.

clear_children()

Removes all children from this catalog.

clear_items()

Removes all items from this catalog.

clear_links([rel])

Clears all Link instances associated with this object.

clone()

Clones this object.

delete_asset(key)

Deletes the asset at the given key, and removes the asset's data file from the local filesystem.

describe([include_hrefs, _indent])

Prints out information about this Catalog and all contained STACObjects.

find(key)

from_dict(dico)

Parses this STACObject from the passed in dictionary.

from_file(href[, stac_io])

Reads a STACObject implementation from a file.

from_stac_collection(collection)

full_copy([root, parent])

Create a full copy of this STAC object and any stac objects linked to by this object.

fully_resolve()

Resolves every link in this catalog.

generate_subcatalogs(template[, defaults, ...])

Walks through the catalog and generates subcatalogs for items based on the template string.

get_all_collections()

Get all collections from this catalog and all subcatalogs.

get_all_items()

DEPRECATED.

get_assets([media_type, role])

Get this collection's assets.

get_child(id[, recursive, sort_links_by_id])

Gets the child of this catalog with the given ID, if it exists.

get_child_links()

Return all child links of this catalog.

get_children()

Return all children of this catalog.

get_collections()

Return all children of this catalog that are Collection instances.

get_item(id[, recursive])

Returns an item with a given ID.

get_item_links()

Return all item links of this catalog.

get_items(*ids[, recursive])

Return all items or specific items of this catalog.

get_links([rel, media_type])

Gets the Link instances associated with this object.

get_parent()

Get the Catalog or Collection to the parent for this object.

get_root()

Get the Catalog or Collection to the root for this object.

get_root_link()

Get the Link representing the root for this object.

get_self_href()

Gets the absolute HREF that is represented by the rel == 'self' Link.

get_single_link([rel, media_type])

Get a single Link instance associated with this object.

get_stac_objects(rel[, typ, modify_links])

Gets the STACObject instances that are linked to by links with their rel property matching the passed in argument.

is_relative()

list_available_keys()

make_all_asset_hrefs_absolute()

Recursively makes all the HREFs of assets in this catalog absolute

make_all_asset_hrefs_relative()

Recursively makes all the HREFs of assets in this catalog relative

make_asset_hrefs_absolute()

Modify each asset's HREF to be absolute.

make_asset_hrefs_relative()

Modify each asset's HREF to be relative to this collection's self HREF.

map_assets(asset_mapper)

Creates a copy of a catalog, with each Asset for each Item passed through the asset_mapper function.

map_items(item_mapper)

Creates a copy of a catalog, with each item passed through the item_mapper function.

matches_object_type(d)

Returns a boolean indicating whether the given dictionary represents a valid instance of this STACObject sub-class.

normalize_and_save(root_href[, ...])

Normalizes link HREFs to the given root_href, and saves the catalog.

normalize_hrefs(root_href[, strategy, ...])

Normalize HREFs will regenerate all link HREFs based on an absolute root_href and the canonical catalog layout as specified in the STAC specification's best practices.

remove_child(child_id)

Removes an child from this catalog.

remove_hierarchical_links([add_canonical])

Removes all hierarchical links from this object.

remove_item(item_id)

Removes an item from this catalog.

remove_links(rel)

Remove links to this object's set of links that match the given rel.

resolve_links()

Ensure all STACObjects linked to by this STACObject are resolved.

save([catalog_type, dest_href, stac_io])

Save this catalog and all it's children/item to files determined by the object's self link HREF or a specified path.

save_object([include_self_link, dest_href, ...])

Saves this STAC Object to it's 'self' HREF.

set_parent(parent)

Sets the parent Catalog or Collection for this object.

set_root(root)

Sets the root Catalog or Collection for this object.

set_self_href(href)

Sets the absolute HREF that is represented by the rel == 'self' Link.

target_in_hierarchy(target)

Determine if target is somewhere in the hierarchical link tree of a STACObject.

to_dict()

Returns this object as a dictionary.

update_extent_from_items()

Update datetime and bbox based on all items to a single bbox and time window.

validate()

Validate this STACObject.

validate_all([max_items, recursive])

Validates each catalog, collection, item contained within this catalog.

walk()

Walks through children and items of catalogs.

Attributes

DEFAULT_FILE_NAME

Default file name that will be given to this STAC object in a canonical format.

STAC_OBJECT_TYPE

self_href

Gets the absolute HREF that is represented by the rel == 'self' Link.

assets

Map of Assets

description

Detailed multi-line description to fully explain the collection.

extent

Spatial and temporal extents that describe the bounds of all items contained within this Collection.

id

Identifier for the collection.

stac_extensions

List of extensions the Collection implements.

title

Optional short descriptive one-line title for the collection.

keywords

Optional list of keywords describing the collection.

providers

Optional list of providers of this Collection.

summaries

A map of property summaries, either a set of values or statistics such as a range.

links

A list of Link objects representing all links associated with this Collection.

extra_fields

Extra fields that are part of the top-level JSON properties of the Collection.

catalog_type

The catalog type.

DEFAULT_FILE_NAME = 'collection.json'#

Default file name that will be given to this STAC object in a canonical format.

add_asset(key: str, asset: Asset) None[source]#

Adds an Asset to this collection.

Args:

key : The unique key of this asset. asset : The Asset to add.

add_child(child: 'Catalog' | Collection, title: str | None = None, strategy: HrefLayoutStrategy | None = None, set_parent: bool = True) Link#

Adds a link to a child Catalog or Collection.

This method will set the child’s parent to this object and potentially override its self_link (unless set_parent is False).

It will always set its root to this Catalog’s root.

Args:

child : The child to add. title : Optional title to give to the Link strategy : The layout strategy to use for setting the

self href of the child. If not provided, defaults to BestPracticesLayoutStrategy.

set_parentWhether to set the parent on the child as well.

Defaults to True.

Returns:

Link: The link created for the child

add_children(children: Iterable['Catalog' | Collection]) List[Link]#

Adds links to multiple Catalog or ~pystac.Collection objects. This method will set each child’s parent to this object, and their root to this Catalog’s root.

Args:

children : The children to add.

Returns:

List[Link]: An array of links created for the children

add_item(item: Item, title: str | None = None, strategy: HrefLayoutStrategy | None = None, set_parent: bool = True) Link[source]#

Adds a link to an Item.

This method will set the item’s parent to this object and potentially override its self_link (unless set_parent is False)

It will always set its root to this Catalog’s root.

Args:

item : The item to add. title : Optional title to give to the Link strategy : The layout strategy to use for setting the

self href of the item. If not provided, defaults to BestPracticesLayoutStrategy.

set_parentWhether to set the parent on the item as well.

Defaults to True.

Returns:

Link: The link created for the item

add_items(items: Iterable[Item], strategy: HrefLayoutStrategy | None = None) List[Link]#

Adds links to multiple Items.

This method will set each item’s parent to this object, and their root to this Catalog’s root.

Args:

items : The items to add. strategy : The layout strategy to use for setting the

self href of the items. If not provided, defaults to BestPracticesLayoutStrategy.

Returns:

List[Link]: A list of links created for the item

Add a link to this object’s set of links.

Args:

link : The link to add.

Add links to this object’s set of links.

Args:

links : The links to add.

assets: Dict[str, Asset]#

Map of Assets

catalog_type: CatalogType#

The catalog type. Defaults to CatalogType.ABSOLUTE_PUBLISHED.

clear_children() None#

Removes all children from this catalog.

Return:

Catalog: Returns self

clear_items() None#

Removes all items from this catalog.

Return:

Catalog: Returns self

Clears all Link instances associated with this object.

Args:

rel : If set, only clear links that match this relationship.

clone() Collection[source]#

Clones this object.

Cloning an object will make a copy of all properties and links of the object; however, it will not make copies of the targets of links (i.e. it is not a deep copy). To copy a STACObject fully, with all linked elements also copied, use STACObject.full_copy.

Returns:

STACObject: The clone of this object.

delete_asset(key: str) None[source]#

Deletes the asset at the given key, and removes the asset’s data file from the local filesystem.

It is an error to attempt to delete an asset’s file if it is on a remote filesystem.

To delete the asset without removing the file, use del collection.assets[“key”].

Args:

key: The unique key of this asset.

describe(include_hrefs: bool = False, _indent: int = 0) None#

Prints out information about this Catalog and all contained STACObjects.

Args:
include_hrefs (bool) - If True, print out each object’s self link

HREF along with the object ID.

description: str#

Detailed multi-line description to fully explain the collection.

extent: Extent#

Spatial and temporal extents that describe the bounds of all items contained within this Collection.

extra_fields: Dict[str, Any]#

Extra fields that are part of the top-level JSON properties of the Collection.

classmethod from_dict(dico: dict)[source]#

Parses this STACObject from the passed in dictionary.

Args:

d : The dict to parse. href : Optional href that is the file location of the object being

parsed.

rootOptional root catalog for this object.

If provided, the root of the returned STACObject will be set to this parameter.

migrate: Use True if this dict represents JSON from an older STAC object,

so that migrations are run against it.

preserve_dict: If False, the dict parameter d may be modified

during this method call. Otherwise the dict is not mutated. Defaults to True, which results results in a deepcopy of the parameter. Set to False when possible to avoid the performance hit of a deepcopy.

Returns:

STACObject: The STACObject parsed from this dict.

classmethod from_file(href: str, stac_io: StacIO | None = None) C#

Reads a STACObject implementation from a file.

Args:

href : The HREF to read the object from. stac_io: Optional instance of StacIO to use. If not provided, will use the

default instance.

Returns:

The specific STACObject implementation class that is represented by the JSON read from the file located at HREF.

full_copy(root: Catalog | None = None, parent: Catalog | None = None) Collection[source]#

Create a full copy of this STAC object and any stac objects linked to by this object.

Args:
rootOptional root to set as the root of the copied object,

and any other copies that are contained by this object.

parentOptional parent to set as the parent of the copy

of this object.

Returns:

STACObject: A full copy of this object, as well as any objects this object links to.

fully_resolve() None#

Resolves every link in this catalog.

Useful if, e.g., you’d like to read a catalog from a filesystem, upgrade every object in the catalog to the latest STAC version, and save it back to the filesystem. By default, save() skips unresolved links.

generate_subcatalogs(template: str, defaults: Dict[str, Any] | None = None, parent_ids: List[str] | None = None) List[Catalog]#

Walks through the catalog and generates subcatalogs for items based on the template string.

See LayoutTemplate for details on the construction of template strings. This template string will be applied to the items, and subcatalogs will be created that separate and organize the items based on template values.

Args:
templateA template string that

can be consumed by a LayoutTemplate

defaultsDefault values for the template variables

that will be used if the property cannot be found on the item.

parent_idsOptional list of the parent catalogs’

identifiers. If the bottom-most subcatalogs already match the template, no subcatalog is added.

Returns:

[catalog]: List of new catalogs created

get_all_collections() Iterable[Collection]#

Get all collections from this catalog and all subcatalogs. Will traverse any subcatalogs recursively.

get_all_items() Iterator[Item]#

DEPRECATED.

Deprecated since version 1.8: Use pystac.Catalog.get_items(recursive=True)() instead.

Get all items from this catalog and all subcatalogs. Will traverse any subcatalogs recursively.

Returns:
Generator[Item]: All items that belong to this catalog, and all

catalogs or collections connected to this catalog through child links.

get_assets(media_type: str | MediaType | None = None, role: str | None = None) Dict[str, Asset][source]#

Get this collection’s assets.

Args:
media_type: If set, filter the assets such that only those with a

matching media_type are returned.

role: If set, filter the assets such that only those with a matching

role are returned.

Returns:

Dict[str, Asset]: A dictionary of assets that match media_type and/or role if set or else all of this collection’s assets.

get_child(id: str, recursive: bool = False, sort_links_by_id: bool = True) 'Catalog' | Collection | None#

Gets the child of this catalog with the given ID, if it exists.

Args:

id : The ID of the child to find. recursive : If True, search this catalog and all children for the

item; otherwise, only search the children of this catalog. Defaults to False.

sort_links_by_idIf True, links containing the ID will be checked

first. If links do not contain the ID then setting this to False will improve performance. Defaults to True.

Return:

Optional Catalog or Collection: The child with the given ID, or None if not found.

Return all child links of this catalog.

Return:

List[Link]: List of links of this catalog with rel == 'child'

get_children() Iterable['Catalog' | Collection]#

Return all children of this catalog.

Return:

Iterable[Catalog or Collection]: Iterable of children who’s parent is this catalog.

get_collections() Iterable[Collection]#

Return all children of this catalog that are Collection instances.

get_item(id: str, recursive: bool = False) Item | None[source]#

Returns an item with a given ID.

Args:

id : The ID of the item to find. recursive : If True, search this collection and all children for the

item; otherwise, only search the items of this collection. Defaults to False.

Return:

Item or None: The item with the given ID, or None if not found.

Return all item links of this catalog.

Return:

List[Link]: List of links of this catalog with rel == 'item'

get_items(*ids: str, recursive: bool = False) Iterator[Item]#

Return all items or specific items of this catalog.

Args:

*ids : The IDs of the items to include. recursive : If True, search this catalog and all children for the

item; otherwise, only search the items of this catalog. Defaults to False.

Return:
Iterator[Item]: Generator of items whose parent is this catalog, and

(if recursive) all catalogs or collections connected to this catalog through child links.

Gets the Link instances associated with this object.

Args:
relIf set, filter links such that only those

matching this relationship are returned.

media_type: If set, filter the links such that only

those matching media_type are returned

Returns:

List[Link]: A list of links that match rel and/ or media_type if set, or else all links associated with this object.

get_parent() Catalog | None#

Get the Catalog or Collection to the parent for this object. The root is represented by a Link with rel == 'parent'.

Returns:
Catalog, Collection, or None:

The parent object for this object, or None if no root link is set.

get_root() Catalog | None#

Get the Catalog or Collection to the root for this object. The root is represented by a Link with rel == 'root'.

Returns:

Catalog, Collection, or None: The root object for this object, or None if no root link is set.

Get the Link representing the root for this object.

Returns:

Link or None: The root link for this object, or None if no root link is set.

get_self_href() str | None#

Gets the absolute HREF that is represented by the rel == 'self' Link.

Returns:

str or None: The absolute HREF of this object, or None if there is no self link defined.

Note:

A self link can exist for objects, even if the link is not read or written to the JSON-serialized version of the object. Any object read from STACObject.from_file will have the HREF the file was read from set as it’s self HREF. All self links have absolute (as opposed to relative) HREFs.

Get a single Link instance associated with this object.

Args:
relIf set, filter links such that only those

matching this relationship are returned.

media_type: If set, filter the links such that only

those matching media_type are returned

Returns:

Optional[Link]: First link that matches rel and/or media_type, or else the first link associated with this object.

get_stac_objects(rel: str | RelType, typ: Type[STACObject] | None = None, modify_links: Callable[[List[Link]], List[Link]] | None = None) Iterable[STACObject]#

Gets the STACObject instances that are linked to by links with their rel property matching the passed in argument.

Args:
relThe relation to match each Link’s

rel property against.

typIf not None, objects will only be yielded if they are instances of

typ.

modify_linksA function that modifies the list of links before they are

iterated over. For instance, this option can be used to sort the list so that links matching a particular pattern are earlier in the iterator.

Returns:

Iterable[STACObjects]: A possibly empty iterable of STACObjects that are connected to this object through links with the given rel and are of type typ (if given).

id: str#

Identifier for the collection.

keywords: List[str] | None#

Optional list of keywords describing the collection.

A list of Link objects representing all links associated with this Collection.

make_all_asset_hrefs_absolute() None#

Recursively makes all the HREFs of assets in this catalog absolute

make_all_asset_hrefs_relative() None#

Recursively makes all the HREFs of assets in this catalog relative

make_asset_hrefs_absolute() Collection[source]#

Modify each asset’s HREF to be absolute.

Any asset HREFs that are relative will be modified to absolute based on this collection’s self HREF.

Returns:

Collection: self

make_asset_hrefs_relative() Collection[source]#

Modify each asset’s HREF to be relative to this collection’s self HREF.

Returns:

Collection: self

map_assets(asset_mapper: Callable[[str, Asset], Asset | Tuple[str, Asset] | Dict[str, Asset]]) Catalog#

Creates a copy of a catalog, with each Asset for each Item passed through the asset_mapper function.

Args:
asset_mapperA function that takes in an key and an Asset, and

returns either an Asset, a (key, Asset), or a dictionary of Assets with unique keys. The Asset that is passed into the item_mapper is a copy, so the method can mutate it safely.

Returns:

Catalog: A full copy of this catalog, with assets manipulated according to the asset_mapper function.

map_items(item_mapper: Callable[[Item], Item | List[Item]]) Catalog#

Creates a copy of a catalog, with each item passed through the item_mapper function.

Args:
item_mapperA function that takes in an item, and returns

either an item or list of items. The item that is passed into the item_mapper is a copy, so the method can mutate it safely.

Returns:

Catalog: A full copy of this catalog, with items manipulated according to the item_mapper function.

classmethod matches_object_type(d: Dict[str, Any]) bool[source]#

Returns a boolean indicating whether the given dictionary represents a valid instance of this STACObject sub-class.

Args:

d : A dictionary to identify

normalize_and_save(root_href: str, catalog_type: CatalogType | None = None, strategy: HrefLayoutStrategy | None = None, stac_io: StacIO | None = None, skip_unresolved: bool = False) None#

Normalizes link HREFs to the given root_href, and saves the catalog.

This is a convenience method that simply calls Catalog.normalize_hrefs and Catalog.save in sequence.

Args:
root_hrefThe absolute HREF that all links will be normalized

against.

catalog_typeThe catalog type that dictates the structure of

the catalog to save. Use a member of CatalogType. Defaults to the root catalog.catalog_type or the current catalog catalog_type if there is no root catalog.

strategyThe layout strategy to use in setting the

HREFS for this catalog. If not provided, defaults to BestPracticesLayoutStrategy

stac_ioOptional instance of StacIO to use. If not

provided, will use the instance set while reading in the catalog, or the default instance if this is not available.

skip_unresolvedSkip unresolved links when normalizing the tree.

Defaults to False. Because unresolved links are not saved, this argument can be used to normalize and save only newly-added objects.

normalize_hrefs(root_href: str, strategy: HrefLayoutStrategy | None = None, skip_unresolved: bool = False) None#

Normalize HREFs will regenerate all link HREFs based on an absolute root_href and the canonical catalog layout as specified in the STAC specification’s best practices.

This method mutates the entire catalog tree, unless skip_unresolved is True, in which case only resolved links are modified. This is useful in the case when you have loaded a large catalog and you’ve added a few items/children, and you only want to update those newly-added objects, not the whole tree.

Args:

root_href : The absolute HREF that all links will be normalized against. strategy : The layout strategy to use in setting the HREFS

for this catalog. If not provided, defaults to BestPracticesLayoutStrategy

skip_unresolvedSkip unresolved links when normalizing the tree.

Defaults to False.

See:

:stac-spec:`STAC best practices document <best-practices.md#catalog-layout>` for the canonical layout of a STAC.

providers: List[Provider] | None#

Optional list of providers of this Collection.

remove_child(child_id: str) None#

Removes an child from this catalog.

Args:

child_id : The ID of the child to remove.

Removes all hierarchical links from this object.

See pystac.link.HIERARCHICAL_LINKS for a list of all hierarchical links. If the object has a self href and add_canonical is True, a link with rel="canonical" is added.

Args:
add_canonicalIf true, and this item has a self href, that

href is used to build a canonical link.

Returns:

List[Link]: All removed links

remove_item(item_id: str) None#

Removes an item from this catalog.

Args:

item_id : The ID of the item to remove.

Remove links to this object’s set of links that match the given rel.

Args:

rel : The Link rel to match on.

Ensure all STACObjects linked to by this STACObject are resolved. This is important for operations such as changing HREFs.

This method mutates the entire catalog tree.

save(catalog_type: CatalogType | None = None, dest_href: str | None = None, stac_io: StacIO | None = None) None#

Save this catalog and all it’s children/item to files determined by the object’s self link HREF or a specified path.

Args:
catalog_typeThe catalog type that dictates the structure of

the catalog to save. Use a member of CatalogType. If not supplied, the catalog_type of this catalog will be used. If that attribute is not set, an exception will be raised.

dest_hrefThe location where the catalog is to be saved.

If not supplied, the catalog’s self link HREF is used to determine the location of the catalog file and children’s files.

stac_ioOptional instance of StacIO to use. If not

provided, will use the instance set while reading in the catalog, or the default instance if this is not available.

Note:

If the catalog type is CatalogType.ABSOLUTE_PUBLISHED, all self links will be included, and hierarchical links be absolute URLs. If the catalog type is CatalogType.RELATIVE_PUBLISHED, this catalog’s self link will be included, but no child catalog will have self links, and hierarchical links will be relative URLs If the catalog type is CatalogType.SELF_CONTAINED, no self links will be included and hierarchical links will be relative URLs.

save_object(include_self_link: bool = True, dest_href: str | None = None, stac_io: StacIO | None = None) None#

Saves this STAC Object to it’s ‘self’ HREF.

Args:
include_self_linkIf this is true, include the ‘self’ link with

this object. Otherwise, leave out the self link.

dest_hrefOptional HREF to save the file to. If None, the object

will be saved to the object’s self href.

stac_io: Optional instance of StacIO to use. If not provided, will use the

instance set on the object’s root if available, otherwise will use the default instance.

Raises:

STACError: If no self href is set, this error will be raised.

Note:

When to include a self link is described in the :stac-spec:`Use of Links section of the STAC best practices document <best-practices.md#use-of-links>`

property self_href: str#

Gets the absolute HREF that is represented by the rel == 'self' Link.

Raises:
ValueError: If the self_href is not set, this method will throw

a ValueError. Use get_self_href if there may not be an href set.

set_parent(parent: Catalog | None) None#

Sets the parent Catalog or Collection for this object.

Args:
parentThe parent

object to set. Passing in None will clear the parent.

set_root(root: Catalog | None) None#

Sets the root Catalog or Collection for this object.

Args:
rootThe root

object to set. Passing in None will clear the root.

set_self_href(href: str | None) None#

Sets the absolute HREF that is represented by the rel == 'self' Link.

Args:
hrefThe absolute HREF of this object. If the given HREF

is not absolute, it will be transformed to an absolute HREF based on the current working directory. If this is None the call will clear the self HREF link.

stac_extensions: List[str]#

List of extensions the Collection implements.

summaries: Summaries#

A map of property summaries, either a set of values or statistics such as a range.

target_in_hierarchy(target: str | STACObject) bool#

Determine if target is somewhere in the hierarchical link tree of a STACObject.

Args:

target: A string or STACObject to search for

Returns:
bool: Returns True if the target was found in the hierarchical link tree

for the current STACObject

title: str | None#

Optional short descriptive one-line title for the collection.

to_dict()[source]#

Returns this object as a dictionary.

Args:
include_self_linkIf True, the dict will contain a self link

to this object. If False, the self link will be omitted.

transform_hrefs: If True, transform the HREF of hierarchical links

based on the type of catalog this object belongs to (if any). I.e. if this object belongs to a root catalog that is RELATIVE_PUBLISHED or SELF_CONTAINED, hierarchical link HREFs will be transformed to be relative to the catalog root.

dict: A serialization of the object.

update_extent_from_items() None[source]#

Update datetime and bbox based on all items to a single bbox and time window.

validate() List[Any]#

Validate this STACObject.

Returns a list of validation results, which depends on the validation implementation. For JSON Schema validation, this will be a list of schema URIs that were used during validation.

Raises:

STACValidationError

validate_all(max_items: int | None = None, recursive: bool = True) int#

Validates each catalog, collection, item contained within this catalog.

Walks through the children and items of the catalog and validates each stac object.

Args:
max_itemsThe maximum number of STAC items to validate. Default

is None which means, validate them all.

recursiveWhether to validate catalog, collections, and items contained

within child objects.

Returns:

int : Number of STAC items validated.

Raises:
STACValidationError: Raises this error on any item that is invalid.

Will raise on the first invalid stac object encountered.

walk() Iterable[Tuple['Catalog', Iterable['Catalog'], Iterable[Item]]]#

Walks through children and items of catalogs.

For each catalog in the STAC’s tree rooted at this catalog (including this catalog itself), it yields a 3-tuple (root, subcatalogs, items). The root in that 3-tuple refers to the current catalog being walked, the subcatalogs are any catalogs or collections for which the root is a parent, and items represents any items that have the root as a parent.

This has similar functionality to Python’s os.walk().

Returns:

Generator[(Catalog, Generator[Catalog], Generator[Item])]: A generator that yields a 3-tuple (parent_catalog, children, items).