Skip to main content

A STAC catalog creator from Thredds data server

Project description

https://codebase.helmholtz.cloud/cat4kit/tds2stac/-/raw/main/tds2stac-logo.png
https://img.shields.io/pypi/v/tds2stac.svg Documentation Status

STAC specification is a method of exposing spatial and temporal data collections in a standardized manner. Specifically, the SpatioTemporal Asset Catalog (STAC) specification describes and catalogs spatiotemporal assets using a common structure. This package creates STAC metadata by harvesting dataset details from the Thredds data server. After creating STAC Catalogs, Collections, and Items, it imports them into pgSTAC and STAC-FastAPI.

Installation from PyPi

pip install tds2stac

Installation for development

git clone https://codebase.helmholtz.cloud/cat4kit/tds2stac.git
cd tds2stac
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Installing using Docker

For runnig by docker use this repository.

Usage

Use case:

You can use the following template for creating STAC catalog from the TDS web service for your project.

You can change configuration of PgSTAC in config_pgstac

from tds2stac.tds2stac import Converter

     from tds2stac import app

     app.Harvester("https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/catalog.html",
             stac = True,
             stac_id = "id",
             stac_description = "description",
             stac_dir = "/Users/hadizadeh-m/stac/",
             )

output:

     INFO     2023-08-15 10:13:49,031         app.py @function __init__ line 123 - Start Scanning datasets
     Start Scanning datasets of https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/catalog.xml
     |__ https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/catalog.xml |  Number of branches:  2
     |_______ https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/0.05/catalog.xml |  Number of data:  1
     |_______ https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/0.1/catalog.xml |  Number of data:  1
     2 data are going to be set as items
     2 datasets are going to be set as collction
     INFO     2023-08-15 10:13:49,110         app.py @function __init__ line 196 - Harvesting datasets is started
     Start processing:  https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/0.05/catalog.xml
     2 / 2 STAC catalogs are created
     1 / 2 STAC items are connected to the related catalog
     100%|████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.82s/it]
     Start processing:  https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/0.1/catalog.xml
     2 / 2 STAC catalogs are created
     2 / 2 STAC items are connected to the related catalog
     100%|████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.40it/s]
     Start processing:  https://thredds.imk-ifu.kit.edu/thredds/catalog/regclim/raster/global/chirps/climatology/catalog.xml
     2 / 2 STAC catalogs are created
     2 / 2 STAC items are connected to the related catalog
     0it [00:00, ?it/s]
     INFO     2023-08-15 10:13:52,002         app.py @function __init__ line 247 - Harvesting datasets is finished

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TDS2STAC-2.1.5.tar.gz (50.4 kB view hashes)

Uploaded Source

Built Distribution

TDS2STAC-2.1.5-py2.py3-none-any.whl (26.8 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page