1. tds2stac package#
TDS2STAC
TDS2STAC
- class tds2stac.CollectionHarvester(url: str, recognizer: str | None, subdirs: list | None = [], collection_tuples: list[tuple] | None = None, auth: Tuple[str, str] | None = None, logger_properties: dict = {})[source]#
Bases:
objectThis class harvests data pertaining to Collections from TDS catalogs. Depending on the sort of dataset scenario, it returns one of the five variables below.
collection_id,collection_title,collection_description,collection_url, andcollection_subdirs.- Parameters:
url (str) – TDS catalog URL address
recognizer (str) –
statussenario number ofRecognizersubdirs (list) – subdirs is a list of url, id, title, and subdirs of a nested dataset
collection_tuples (list) – a tuple of STAC collection’s auto-generated ID, user-ID, user-Title and user-Description defined by user.
auth (tuple) – Authentication tuple for TDS catalog e.g.(‘user’, ‘password’) (optional)
logger_properties (dict) – dictionary of logger properties
- auth: Tuple[str, str] | None#
Authentication tuple for TDS catalog e.g.(‘user’, ‘password’) (optional)
- collection_id_desc_maker(url: str, collection_tuples: list[tuple] | None = None, recognizer_output: str | None = None)[source]#
A function for getting collection id and description from the TDS catalog urls and pre-defined
collection_tuplesfor scenarios number 4, 5, 6, 7 ,and 9
- collection_tuples: list[tuple] | None#
a tuple of STAC collection’s auto-generated ID, user-ID, user-Title and user-Description defined by user.
- url: 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 (*)
- class tds2stac.ExistenceValidator(stac_dir: str, logger_properties: dict | None = {})[source]#
Bases:
objectA class for verifying the main STAC catalog’s existence. This class is implemented in
STACCreator.- Parameters:
- class tds2stac.ItemHarvester(url: str, elem: Element, harvesting_vars: dict, web_service_dict: dict | None, datetime_after: datetime | None = None, datetime_before: datetime | None = None, spatial_information: list | None = None, temporal_format_by_dataname: str | None = None, extension_properties: dict | None = None, linestring: bool = False, logger_properties: dict = {})[source]#
Bases:
objectThis class harvests information about an Item from TDS data catalogs. It ultimately returns a dictionary of harvesting variables, based on the type of dataset scenario and activated extensions.
- Parameters:
url (str) – TDS catalog URL address
elem (str) – xml element of the data in dataset
harvesting_vars (dict) – dictionary of harvesting variables that is going to be filled
web_service_dict (dict) – web service that the user wants to harvest from
datetime_after (str) – datetime that the user wants to harvest data after that
datetime_before (str) – datetime that the user wants to harvest data before that
spatial_information (list) – Spatial information of 2D datasets e.g. [minx, maxx, miny, maxy] or 1D dataset e.g. [x,y]
temporal_format_by_dataname (str) – datetime format for datasets that have datetime in their name e.g `e%y%m%d%H.%M%S%f`(optional),
extension_properties (dict) – dictionary of extension properties (optional)
linestring (bool) – using this attribute, user activate making LineString instead of Polygon (True and False) (optional)
logger_properties (dict) – dictionary of logger properties
- elem: Element#
xml element of the data in dataset. It’s an element of the xml file that is going to be harvested
- linestring: bool#
using this attribute, user activate making LineString instead of Polygon (True and False) (optional)
- spatial_information: list | None#
Spatial information of 2D datasets e.g. [minx, maxx, miny, maxy] or 1D dataset e.g. [x,y] (optional)
- temporal_format_by_dataname: str | None#
datetime format for datasets that have datetime in their name e.g `e%y%m%d%H.%M%S%f`(optional)
- usl: 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 (*)
- class tds2stac.Logger(logger_properties: dict[str, Any] | None = {})[source]#
Bases:
objectA class-based logger for TDS2STAC. It supports all the handlers from the standard python logging library.
- Parameters:
logger_properties (dict, optional) –
Logger properties. Defaults to
dict(). It’s optional and has the following keys:logger_msg (str, optional)
logger_handler (str, optional)
logger_name (str, optional)
logger_id (str, optional)
logger_level (str, optional)
logger_formatter (str, optional)
logger_handler_host (str, optional)
logger_handler_port (str, optional)
logger_handler_url (str, optional)
logger_handler_method (str, optional)
logger_handler_secure (bool, optional)
logger_handler_credentials (tuple, optional)
logger_handler_context (tuple, optional)
logger_handler_filename (str, optional)
logger_handler_mode (str, optional)
logger_handler_encoding (str, optional)
logger_handler_delay (bool, optional)
logger_handler_errors (str, optional)
logger_handler_mailhost (str, optional)
logger_handler_fromaddr (str, optional)
logger_handler_toaddrs (str, optional)
logger_handler_subject (str, optional)
logger_handler_timeout (str, optional)
- logger_properties: dict[str, Any] | None#
A dictionary that contains all the logger properties.
It is optional and it is set to
Noneby default. The following keys are supported:- logger_msg (str, optional):
Logger message. Defaults to
None. But it is required when you want to log a message.- logger_handler (str, optional):
Logger handler. Defaults to
NullHandler. Check the following website for more information: https://docs.python.org/3/library/logging.handlers.html#module-logging.handlers- logger_name (str, optional):
Logger name. Defaults to
TDS2STAC. It’s required when you chooseHTTPHandleras logger_handler.- logger_id (str, optional):
Logger id. Defaults to
1. It’s required when you chooseHTTPHandleras logger_handler.- logger_level (str, optional):
Logger level. Defaults to
DEBUG. It’s optional. For more information check the following website: https://docs.python.org/3/library/logging.html#levels- logger_formatter (str, optional):
Logger format. Defaults to
%(levelname)-8s %(asctime)s t %(filename)s @function %(funcName)s line %(lineno)s - %(message)s. For more information check the following website: https://docs.python.org/3/library/logging.html#formatter-objects- logger_handler_host (str, optional):
Logger host. Sets the value to ‘None’ by default. It is required when
HTTPHandlerorSocketHandlerare selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifHTTPHandlerorSocketHandleris selected as thelogger_handlervalue and neitherlogger_handler_hostnorlogger_handler_portnor are specified.- logger_handler_port (str, optional):
Logger port. Sets the value to ‘None’ by default. It is required when
HTTPHandlerorSocketHandlerare selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifHTTPHandlerorSocketHandleris selected as thelogger_handlervalue and neitherlogger_handler_hostnorlogger_handler_portare specified.- logger_handler_url (str, optional):
Logger url. Sets the value to ‘None’ by default. It is required when
HTTPHandleris selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifHTTPHandleris selected as thelogger_handlervalue and neitherlogger_handler_urlis specified.- logger_handler_method (str, optional):
HTTP methods. It supports sending logging messages to a web server, using either GET or POST semantics. Sets the value to ‘None’ by default. It is required when
HTTPHandleris selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifHTTPHandleris selected as thelogger_handlervalue andlogger_handler_methodis not specified.- logger_handler_secure (bool, optional):
HTTP secure. Sets the value to ‘False’ by default. It is utilized when
HTTPHandlerorSMTPHandlerare selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_credentials (tuple, optional):
HTTP credentials. Sets the value to ‘None’ by default. It is utilized when
HTTPHandlerorSMTPHandlerare selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_context (tuple, optional):
HTTP context. Sets the value to ‘None’ by default. It is utilized when
HTTPHandleris selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_filename (str, optional):
File name. Sets the value to ‘None’ by default. It is required when
FileHandlerorWatchedFileHandlerare selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifFileHandlerorWatchedFileHandleris selected as thelogger_handlervalue andlogger_handler_filenameis not specified.- logger_handler_mode (str, optional):
File mode. Sets the value to ‘None’ by default. It is required when
FileHandlerorWatchedFileHandlerare selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifFileHandlerorWatchedFileHandleris selected as thelogger_handlervalue andlogger_handler_modeis not specified.- logger_handler_encoding (str, optional):
File encoding. Sets the value to ‘None’ by default. It is utilized when
FileHandlerorWatchedFileHandlerare selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_delay (bool, optional):
File delay. Sets the value to ‘False’ by default. It is utilized when
FileHandlerorWatchedFileHandlerare selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_errors (str, optional):
File errors. Sets the value to ‘None’ by default. It is utilized when
FileHandlerorWatchedFileHandlerare selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_mailhost (str, optional):
Mail host. Sets the value to ‘None’ by default. It is required when
SMTPHandleris selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifSMTPHandleris selected as thelogger_handlervalue andlogger_handler_mailhostis not specified.- logger_handler_fromaddr (str, optional):
Mail from address. Sets the value to ‘None’ by default. It is required when
SMTPHandleris selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifSMTPHandleris selected as thelogger_handlervalue andlogger_handler_fromaddris not specified.- logger_handler_toaddrs (str, optional):
Mail to address. Sets the value to ‘None’ by default. It is required when
SMTPHandleris selected as thelogger_handler. Thelogger_handlerwill be set to ‘NullHandler’ ifSMTPHandleris selected as thelogger_handlervalue andlogger_handler_toaddrsis not specified.- logger_handler_subject (str, optional):
Mail subject. Sets the value to ‘None’ by default. It is utilized when
SMTPHandleris selected as thelogger_handler. But it is optional in both logger handlers.- logger_handler_timeout (str, optional):
Mail timeout. Sets the value to ‘None’ by default. It is utilized when
SMTPHandleris selected as thelogger_handler. But it is optional in both logger handlers.
- class tds2stac.NestedCollectionInspector(main_catalog_url: str, nested_number: int | None = None, auth: tuple | None = None, logger_properties: dict = {})[source]#
Bases:
objectThis class will generate Collection IDs, Titles and their corresponding URLs for a presumed nested number originating from the Recognizer class in TDS. Only works for nested scenarios number 1,2,3,8 nd 9 in Recognizer class. The output will be a list of the tuples: (Root collection URL, Collection ID, Collectin Title, corresponding subset URLs)
- Parameters:
- end_point_url_extracter_dict(d: dict)[source]#
A function for extracting the end point URLs of a nested dictionary.
- Parameters:
d (dict) – A nested dictionary
- end_point_url_extracter_list(list_: list)[source]#
A function for extracting the end point URLs of a nested list.
- Parameters:
list (list) – A nested list
- final_collections_details_returner(url: str)[source]#
A function for returning the URLs of input URL in First and Third cases in TDS
- Parameters:
url (str) – The URL of the TDS catalog
- n_level(d: dict, layer: int)[source]#
For decoding the generator object of
to_levelfunction. https://stackoverflow.com/a/68228562
- class tds2stac.Recognizer(main_catalog_url: str, nested_check: bool = False, auth: tuple | None = None, logger_properties: dict = {})[source]#
Bases:
objectA class for recognizing nine different and possible scenarios in management of TDS datasets. We will explain each scenario in the following.
- First senario: Just
catalogReftags are located directly under the dataset element tag. tag
https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/era5/sfc/single/catalog.xml(nested)- Second senarion:
CatalogRefsare not under a dataset element tag and directly come below thecatalog. https://thredds.imk-ifu.kit.edu/thredds/catalog/catalogues/sensor_catalog_ext.xml(nested)- Third senario: One single
datasettag is located next toCatalogReftags. All are under adatasettag. https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/catalog.xml(nested)- Fourth senario: An empty datasets.
https://thredds.imk-ifu.kit.edu/thredds/catalog/catalogues/bio_geo_chem_catalog_ext.xmlorhttps://thredds.atmohub.kit.edu/thredds/catalog/snowfogs/catalog.xml- Fifth senario: There is no
CatalogReftag and all aredatasettag. All of them are under adatasettag. https://thredds.imk-ifu.kit.edu/thredds/catalog/climate/raster/global/chelsa/v1.2/catalog.html- Sixth senario: A single dataset
https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/era5/sfc/single/catalog.xml?dataset=regclim/raster/global/era5/sfc/single/era5_sfc_20210101.nc- Seventh senario: An aggregated dataset
https://thredds.imk-ifu.kit.edu/thredds/catalog/catalogues/swabian_moses_2021.xml?dataset=swabian_moses_aggregation- Eigth senario: A combination of
caralogRefanddatasettags that is not under adatasettag.It’s similar to second senario but with datasets https://thredds.imk-ifu.kit.edu/thredds/catalog/catalogues/transfer.xml- Nineth senario: When we have a bunch of single
datasettags next to catalogref. It’s similar to third senario but with more datasets. https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/hydrogfd/v3.0/catalog.xml(nested)
- Parameters:
main_catalog_url – TDS Catalog url to start harvesting
nested_check – An option for checking nested datasets in TDS (True or False)
auth – Authentication for TDS catalog e.g.(‘user’, ‘password’)
logger_properties – A dictionary for logger properties.
- nested_checker(url: str)[source]#
A function for returning the depth of nested datasets in TDS for senarios 1, 3, ,and 9
- First senario: Just
- class tds2stac.STACCreator[source]#
Bases:
objectA class for creating STAC catalog, -Collections and its -Items from TDS datasets catalogs.
- STACCatalog(url: str, stac_id: str, stac_title: str | None, stac_desc: str | None, stac_dir: str, stac_existance: bool = False, auth: tuple | None = None, logger_properties: dict = {})[source]#
A function for creating STAC catalog from TDS dataset catalog.
- Parameters:
url – The URL of the TDS catalog.
stac_id – The ID of the STAC catalog.
stac_title – The title of the STAC catalog.
stac_desc – The description of the STAC catalog.
stac_dir – The directory of saving the STAC catalog.
stac_existance – If it is True, it means that the STAC catalog already exists in the directory and for the harvesting, there is no need to create a new STAC-Catalog and import new collections In the existed STAC-Catalog. False by default.
auth – The authentication of the TDS catalog.
logger_properties – The properties of the logger. For more information please check the
Loggerclass.
- STACCollection(catalog: Catalog, collection_id: str, collection_title: str, collection_description: str, stac_existance_collection: bool = False, logger_properties: dict = {})[source]#
This is a function for creating STAC collection from harvested information from TDS dataset catalog. This functin returns a dictionary with two keys:
collection: The STAC collection
2. existed_items_id_list: The list of the items that already exist in the STAC collection and it is going to be used for the harvesting process.
- Parameters:
catalog – The STAC catalog.
collection_id – The ID of the STAC collection.
collection_title – The title of the STAC collection.
collection_description – The description of the STAC collection.
collection_scientific – The scientific extension of the STAC collection.
stac_existance_collection – If it is True, it means that the STAC collection already exists in the catalog and for the harvesting, there is no need to create a new STAC-Collection and import new items In the existed STAC-Collection. False by default.
logger_properties – The properties of the logger. For more information please check the
Loggerclass.
- STACItem(url: str, catalog: Catalog, harvesting_vars: dict, Recognizer_output: str | None, collection_id: str, aggregated_dataset_url: str | None = None, extension_properties: dict | None = None, asset_properties: dict | None = {}, logger_properties: dict = {})[source]#
This is a function for creating STAC item from harvested data in TDS dataset catalog.
- Parameters:
url – The URL of the TDS catalog.
catalog – The STAC catalog.
harvesting_vars – The harvested data from TDS catalog.
Recognizer_output – The output of the Recognizer class.
collection_id – The ID of the STAC collection.
aggregated_dataset_url – The URL of the aggregated dataset that whole of data is located there.
extension_properties – The properties of the extensions.
asset_properties – The properties of the assets.
logger_properties – The properties of the logger. For more information please check the
Loggerclass.
- class tds2stac.TDS2STACIntegrator(TDS_catalog: str, stac_dir: str, stac_id: str = 'TDS2STAC', stac_title: str | None = 'TDS2STAC', stac_description: str | None = None, auth: Tuple[str, str] | None = None, stac_existance: bool = False, stac_existance_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 = {})[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) – Directory of saving created STAC catalogs.
stac_id (str) – 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.
auth (tuple, optional) – Authentication tuple for TDS catalog e.g.(‘user’, ‘password’).
stac_existance (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_existance_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.
- 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:- 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.- 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_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.- item_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.- item_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.- collection_assets_list_allowed (list, optional):
This is a list of permissible web services that will be incorporated as assets in the STAC-Collection. The
WebServiceScraperclass provides access to the list of available web services. Default value is None.- collection_assets_list_avoided (list, optional):
This is a list of web services that will be excluded from the STAC-Collection 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.
- 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.
- 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_existance: 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_existance_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.
- class tds2stac.Thumbnails[source]#
Bases:
objectThis class is used to create thumbnail images for STAC-Collections and STAC-Items.
- collection(collection_thumbnail: str, collection_overview: str, services: Element, dataset: dict, harvesting_vars: dict, collection_id: str, url: str, catalog: Catalog, collection_link: str, logger_properties: dict = {})[source]#
A function to create thumbnail images for STAC-Collections.
- Parameters:
collection_thumbnail (str) – The type of thumbnail image for STAC-Collections. It can be
wmsorlink.collection_overview (str) – The type of overview image for STAC-Collections. It can be
wmsorlink.services (list) – A list of services for STAC-Collections.
dataset (dict) – A dictionary of dataset information.
harvesting_vars (dict) – A dictionary of harvesting variables.
collection_id (str) – The ID of STAC-Collections.
url (str) – The URL of STAC-Catalog.
catalog (pystac.Catalog) – A STAC-Catalog.
collection_link (str) – The link of thumbnail image for STAC-Collections when
collection_thumbnailorcollection_overviewset aslink.logger_properties (dict) – A dictionary of logger properties. For more information, please see
Loggerclass.
- item(service: Element, dataset: dict, harvesting_vars: dict, url: str, item: Item, item_thumbnail: bool, item_overview: bool, item_getminmax_thumbnail: bool, logger_properties: dict = {})[source]#
A function to create thumbnail images for STAC-Items.
- Parameters:
service (list) – A list of services for STAC-Items.
dataset (dict) – A dictionary of dataset information.
harvesting_vars (dict) – A dictionary of harvesting variables.
url (str) – The URL of STAC-Catalog.
item (pystac.Item) – A STAC-Item.
item_thumbnail (bool) – A boolean to create thumbnail image for STAC-Items.
item_overview (bool) – A boolean to create overview image for STAC-Items.
item_getminmax_thumbnail (bool) – A boolean to create thumbnail image for STAC-Items based on minmax.
logger_properties (dict) – A dictionary of logger properties. For more information, please see
Loggerclass.
- class tds2stac.WebServiceContentScraper(root: _Element, json_file: str, extensions_list: list, harvesting_vars: dict | None = None)[source]#
Bases:
objectThe functionality of the existing class is dependent on the settings specified in the
tag_config.jsonfile in order to harvest targeted information from a selected web service. For comprehensive instructions on configuring thetag_config.jsonfile, refer to the following link: Creating the tag_config.json Configuration File: A Step-by-Step Guide.- Args:
root (etree._Element): The root of the XML-based web service json_file (str): The path to the
tag_config.jsonfile extensions_list (list): The list of extensions to be harvestedfrom the web service (main keys in the
tag_config.jsonfile)harvesting_vars (dict, optional): The dictionary of harvesting variables
- extensions_list: list#
The list of extensions to be harvested from the web service. Main keys in the
tag_config.jsonfile. For exampleitem_datacube_extensionand so on.
- harvesting_vars: dict | None#
It’s a dictionary that keys are variable names and values are the result of harvesting.
- root: _Element#
Etree root object of the XML-based web service
- class tds2stac.WebServiceListScraper(url: str, auth: tuple | None = None)[source]#
Bases:
objectA class for getting the list of available web services of a TDS catalogs.
- Args:
url (str): The catalog URL from TDS to provide its web services auth (tuple, optional): Information for authentication of the TDS catalog
1.1. Subpackages#
1.2. Submodules#
- 1.2.1. tds2stac.assets module
- 1.2.2. tds2stac.creator module
- 1.2.3. tds2stac.harvester module
CollectionHarvesterCollectionHarvester.authCollectionHarvester.colleciton_descriptionCollectionHarvester.collection_idCollectionHarvester.collection_id_desc_maker()CollectionHarvester.collection_subdirsCollectionHarvester.collection_titleCollectionHarvester.collection_tuplesCollectionHarvester.collection_urlCollectionHarvester.logger_propertiesCollectionHarvester.recognizerCollectionHarvester.subdirsCollectionHarvester.url
ItemHarvesterItemHarvester.datetime_afterItemHarvester.datetime_beforeItemHarvester.elemItemHarvester.extension_propertiesItemHarvester.harvesting_varsItemHarvester.linestringItemHarvester.logger_propertiesItemHarvester.spatial_informationItemHarvester.temporal_format_by_datanameItemHarvester.uslItemHarvester.web_service_dict
- 1.2.4. tds2stac.logger module
- 1.2.5. tds2stac.tds2stac module
ExistenceValidatorTDS2STACIntegratorTDS2STACIntegrator.TDS_catalogTDS2STACIntegrator.aggregated_dataset_urlTDS2STACIntegrator.asset_propertiesTDS2STACIntegrator.authTDS2STACIntegrator.collection_tuplesTDS2STACIntegrator.datetime_filterTDS2STACIntegrator.depth_numberTDS2STACIntegrator.extension_propertiesTDS2STACIntegrator.item_geometry_linestringTDS2STACIntegrator.limited_numberTDS2STACIntegrator.logger_propertiesTDS2STACIntegrator.spatial_informationTDS2STACIntegrator.stac_descriptionTDS2STACIntegrator.stac_dirTDS2STACIntegrator.stac_existanceTDS2STACIntegrator.stac_existance_collectionTDS2STACIntegrator.stac_idTDS2STACIntegrator.stac_titleTDS2STACIntegrator.temporal_format_by_datanameTDS2STACIntegrator.webservice_properties
- 1.2.6. tds2stac.thumbnails module
- 1.2.7. tds2stac.utils module