1.2.5. tds2stac.tds2stac module#
- class tds2stac.tds2stac.TDS2STACIntegrator(TDS_catalog: str, stac_dir: str = '/home/docs/checkouts/readthedocs.org/user_builds/tds2stac/checkouts/latest/docs', stac_id: str = 'TDS2STAC', stac_title: str | None = 'TDS2STAC', stac_description: str | None = None, stac_existence: bool = False, stac_existence_collection: bool = False, collection_tuples: list[tuple] | None = None, datetime_filter: list | None = None, aggregated_dataset_url: str | None = None, depth_number: int | None = None, limited_number: int | None = None, spatial_information: list | None = None, temporal_format_by_dataname: str | None = None, item_geometry_linestring: bool = False, webservice_properties: dict | None = {}, asset_properties: dict | None = {}, extension_properties: dict | None = {}, logger_properties: dict = {}, requests_properties: dict = {}, extra_metadata: dict = {})[source]#
Bases:
objectThis class is the central component of the TDS2STAC. It harvests the TDS catalog and then generates the STAC-Catalog, -Collections, and -Items through the TDS catalogs, based on the user’s input. This class mainly defines all configurations related to harvesting and STAC creation. In the first step, it recognizes the scenario of the TDS catalog using
Recognizer. If it is recognized as a nested collection,NestedCollectionInspectoris responsible for determining the nested collection’sID,Title, andurlof subdirectories. Other procedures follow in succession. For example,CollectionHarvesterharvests the collection’s information andSTACCreatorcreates the STAC-Catalog and -Collection. Then,ItemHarvesterharvests the item’s information andSTACCreatorcreates the STAC-Item and connect them to the related STAC-Collections. At the end each STAC-Collection will be connected to the main STAC-Catalog.- Parameters:
TDS_catalog (str) – The URL address of the TDS catalog that will be harvested.
stac_dir (str, Optional) – Directory of saving created STAC catalogs.
stac_id (str, Optional) – STAC catalog ID. default value is ‘TDS2STAC’.
stac_title (str, optional) – STAC catalog Title. default value is ‘TDS2STAC’.
stac_description (str, optional) – STAC catalog description.
stac_existence (bool, optional) – Verifying the presence of the STAC catalog in order to update an existing catalog; if not, a new catalog will be generated.
stac_existence_collection (bool, optional) – Verifying the presence of the STAC Collection in order to update an existing catalog; if not, a new collection will be generated.
collection_tuples (list, optional) – The elements of this tuple comprise the auto-TDS2STAC-generated ID , the user-defined ID, title, and description of the STAC-Collection respectively. (auto-ID, user-ID, user-title, user-description).
datetime_filter (list, optional) – Datetime-based filtering of harvesting. It works based on the
modifiedtag in each dataset at TDS.aggregated_dataset_url (str, optional) – Dataset’s URL of each data entry in the Aggregated datasets of TDS.
depth_number (int, optional) – depth number of nested datasets if it is a nested collection. default value is 0.
limited_number (int, optional) – The objective is to reduce the quantity of harvested items in each collection. It is beneficial for developing and testing purposes.
spatial_information (list, optional) – Spatial information of 2D datasets e.g. [minx, maxx, miny, maxy] or 1D dataset e.g. [x,y]. default value is None.
temporal_format_by_dataname (str, optional) – A preferred datetime format for datasets that include the time period in their names. e.g “e%y%m%d%H.%M%S%f”
item_geometry_linestring (bool, optional) – Set True to make a LineString geometry for STAC-Items from wms service. Otherwise it makes Polygon geometry for the given Item. default value is False.
extension_properties (dict, optional) – A dictionary of properties for extensions. default is None. For more information about the keys, please refer to the
extension_properties.webservice_properties (dict, optional) – A dictionary of properties for web_service. default is None (optional) For more information about the keys, please refer to the
webservice_properties.asset_properties (dict, optional) – A dictionary of properties for assets. default is None (optional) For more information about the keys, please refer to the
asset_properties.logger_properties (dict, optional) – A dictionary of properties for logger. default is
None.requests_properties – A dictionary that modify the requests to URLs. To obtain additional information on this topic, refer to the
requests_properties. The default value is an empty dictionary.
- TDS_catalog: str#
TDS catalog URL address. Initial point of harvesting e.g. https://thredds.atmohub.kit.edu/thredds/catalog/caribic/IAGOS-CARIBIC_MS_files_collection_20231017/catalog.html
- aggregated_dataset_url: str | None#
Dataset’s URL of each data entry in the Aggregated datasets of TDS.. default value
None. TheHTTPServeris not functional in the aggregated dataset. Therefore, in order to utilize this service as an asset in our STAC-Item, we should employ theaggregated_dataset_url, which links the individual datasets to theHTTPServerasset of the relevant Item.
- asset_properties: dict | None#
A dictionary of properties for assets. default is
None. When it’s None, keys look like the following example:- collection_thumbnail (str, optional):
A
thumbnailasset for STAC-collection sourced from the Web Map Service (WMS) of the TDS. It can be chosen fromwms,link, orNone. The default value is set to None.- collection_overview (str, optional):
A
overviewasset for STAC-collection sourced from the Web Map Service (WMS) of the TDS. It can be chosen fromwms,link, orNone. The default value is set to None.- collection_thumbnail_link (str, optional):
This property is reliant upon the values of
collection_thumbnailandcollection_overview. When the value of either of these attributes is set tolink, it allows for the inclusion of a hyperlink to an image forcollection_thumbnailorcollection_overview.- collection_overview_link (str, optional):
This property is reliant upon the values of
collection_thumbnailandcollection_overview. When the value of either of these attributes is set tolink, it allows for the inclusion of a hyperlink to an image forcollection_thumbnailorcollection_overview.- collection_custom_assets (list, optional):
This is a list of asset dictionaris that includes the
key,href, andtitle,role(as a list), andmedia_typeof the asset. The default value is set to None. For more information, refer to the How to make a custom asset for STAC-Collection and STAC-Item:.- item_thumbnail (bool, optional):
A
thumbnailasset for STAC-Items sourced from the Web Map Service (WMS) of the TDS. The default value is set to False.- item_overview (bool, optional):
A
overviewasset for STAC-Items sourced from the Web Map Service (WMS) of the TDS. The default value is set to False.- item_getminmax_thumbnail (bool, optional):
The TDS offers a function that allows users to obtain the minimum and maximum values of the colorbar associated with an image through the use of
metadata. The aforementioned attribute is contingent upon both theitem_thumbnailanditem_overview. The default value is set to False.- assets_list_allowed (list, optional):
This is a list of permissible web services that will be incorporated as assets in the STAC-Item. The
WebServiceScraperclass provides access to the list of available web services. Default value is None.- assets_list_avoided (list, optional):
This is a list of web services that will be excluded from the STAC-Item asset list. The
WebServiceScraperclass provides access to the list of available webservices. Default value is None.- explore_data (bool, optional):
By enabling the
Truesetting, the inclusion of Godiva3 as an exploration asset will be implemented.- verify_explore_data (bool, optional):
This argument verifies the availability of the
GetMetadatafunction. The provided function facilitates the retrieval of data necessary for generating maps using the Web Map Service (WMS) protocol. However, an error occurs when attempting to openGodiva3when this function doesn’t work. In order to mitigate such errors, it would be advisable to establish this argument.- jupyter_notebook (bool, optional):
This argument posits the inclusion of the Jupyter Notebook as an asset.
- collection_tuples: list[tuple] | None#
STAC collection auto-generated ID, user-ID, user-Title and user-Description defined by user. It is worth mentioning that in order to obtain the list of automatically generated collection IDs, one can employ the
NestedCollectionInspectorfor the given TDS Catalog and subsequently utilize this argument. Warning - Identifiers should consist of only lowercase characters, numbers, ‘_’, and ‘-‘. Default valueNone. e.g. (ID, Title, Description)
- datetime_filter: list | None#
Datetime-based filtering. e.g.
['2010-02-18T00:00:00.000Z','2020-02-22T00:00:00.000Z']Default valueNone. It should be noted it works based on themodifiedtag in each dataset at TDS.
- depth_number: int | None#
The depth refers to the number of layered datasets. If the collection is nested, this argument is applicable; otherwise, employing this argument would be futile. default value
None(optional)
- extension_properties: dict | None#
A dictionary of properties for extensions. default is
None.- item_extensions (list[str, tuple], optional):
The argument can consist of either a list of extension names (string) or a list of tuples containing three elements: the extension name, the function name or class name associated with the extension, and the Python script required for execution. For more explanation, refer to the Adding and Configuring Custom Extensions for STAC-Items and STAC-Collections.
- collection_extensions (Union[list, tuple], optional):
It works as same as
item_extensionsargument. For more explanation, refer to the Adding and Configuring Custom Extensions for STAC-Items and STAC-Collections.
- extra_metadata: dict#
A dictionary of extra metadata that you want to add to the STAC-Collection and STAC-Items. It has two main keys,
extra_metadatathat is boolean andextra_metadata_filethat is the address ofextra_metadata.jsonJSON file. For getting more information about making theextra_metadata.jsonfile, please refer to How to create extra_metadata.json file. By default, if ‘extra_metadata’ is set to True, the ‘extra_metadata.json’ file is utilised for the ‘extra_metadata_file’ key, which is situated in the’sta2stac’ main directory.
- item_geometry_linestring: Literal[False]#
The default value for the LineString geometry in the STAC Items from the WMS service is set to False and the default geometry type for the STAC-Item is Polygon. However, in instances where the item has a POINT geometry, it can be automatically detected. However, in order to obtain the LineString geometry, it is necessary to set this argument to True.
- limited_number: int | None#
The objective is to reduce the quantity of harvested items in each collection. It is beneficial for developing and testing purposes.. default value
None(optional)
- logger_properties: dict#
A dictionary of properties for logger. default is
None. You can look at keys inLoggerclass.
- requests_properties: dict#
A dictionary of properties that adjust the requests to URLs. It contains the following keys:
- verify (bool, optional):
It is a boolean that if it is True, it verifies the SSL certificate. By default it is False.
- timeout (int, optional):
It is an integer that sets the timeout of the requests. By default it is 10 seconds.
- auth (tuple, optional):
It is a tuple that contains the username and password for the authentication. By default it is None.
- spatial_information: list | None#
Spatial information of 2D datasets e.g. [minx, maxx, miny, maxy] or 1D dataset e.g. [x,y]. Default value `None`(optional)
- stac_existence: Literal[False]#
Verifying the existence of STAC catalog. If the catalog exists in the directory, it updates a existed catalog, otherwise it creates new catalog. default value
False
- stac_existence_collection: Literal[False]#
Verifying the existence of STAC Collections. If the collection exists in the directory, it updates a existed collection, otherwise it creates new collection. default value
False
- temporal_format_by_dataname: str | None#
A preferred datetime format for datasets that include the time period in their names e.g “e%y%m%d%H.%M%S%f”. Default value
None(optional)
- webservice_properties: dict | None#
A dictionary of properties for web_service. default is
None.- It has the following keys.
- web_service_config_file(str, opntional):
The primary
tag_config.jsonfile is situated in the primary directory of the installed TDS2STAC. However, the user has the ability to declare an alternativetag_config.jsonfile, which allows for customization of the settings. The user can specify the location of their own JSON file in this section. To obtain further details on the creation of atag_config.jsonfile, refer: Creating the tag_config.json Configuration File: A Step-by-Step Guide. The default value is set totag_config.jsonin the root directory of the installed app.