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_dev.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

converter = Converter("http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/catalog.html",
                     stac=True, stac_dir="/path/to/save/stac/catalogs/",
                     stac_id = "sample",
                     stac_description = "sample",
                     web_service = "iso" or "ncml",
                     datetime_filter=["2020-02-18T00:00:00.000Z","2020-02-22T00:00:00.000Z"],
                     stac_catalog_dynamic = True)

output:

     Start Scanning datasets of http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/catalog.xml
     |__ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/catalog.xml |  Number of branches:  5
     |_______ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/static/catalog.xml |  Number of data:  1
     |_______ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/monthly/catalog.xml |  Number of data:  246
     |_______ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/daily/catalog.xml |  Number of data:  360
     |_______ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/climatology/catalog.xml |  Number of data:  7
     |_______ http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/aggregated/catalog.xml |  Number of data:  1
     615 data are going to be set as items
     5 data are going to be set as items
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/static/catalog.xml
     5 / 5 STAC catalogs are created
     1 / 615 STAC items are connected to the related catalog
     100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 12.70it/s]
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/monthly/catalog.xml
     5 / 5 STAC catalogs are created
     247 / 615 STAC items are connected to the related catalog
     100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 246/246 [00:47<00:00,  5.17it/s]
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/daily/catalog.xml
     5 / 5 STAC catalogs are created
     607 / 615 STAC items are connected to the related catalog
     100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 360/360 [01:12<00:00,  4.95it/s]
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/climatology/catalog.xml
     5 / 5 STAC catalogs are created
     614 / 615 STAC items are connected to the related catalog
     100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:00<00:00,  7.52it/s]
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/aggregated/catalog.xml
     5 / 5 STAC catalogs are created
     615 / 615 STAC items are connected to the related catalog
     100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:23<00:00, 23.93s/it]
     Start processing:  http://172.27.80.119:8088/thredds/catalog/regclim/raster/global/era5/sfc/catalog.xml
     5 / 5 STAC catalogs are created
     615 / 615 STAC items are connected to the related catalog
     0it [00:00, ?it/s]
     ./catalog_regclim_raster_global_era5_sfc_static/collection.json
     |____ ./era5_sfc_0.25_static_ERA5_Landsea_mask.nc/era5_sfc_0.25_static_ERA5_Landsea_mask.nc.json
     ./catalog_regclim_raster_global_era5_sfc_monthly/collection.json
     |____ ./era5_sfc_0.25_monthly_ERA5_monthly_ws10_2018.nc/era5_sfc_0.25_monthly_ERA5_monthly_ws10_2018.nc.json
     .
     .
     .
     |____ ./era5_sfc_0.25_daily_ERA5_daily_sp_1982.nc/era5_sfc_0.25_daily_ERA5_daily_sp_1982.nc.json
     |____ ./era5_sfc_0.25_daily_ERA5_daily_sp_1981.nc/era5_sfc_0.25_daily_ERA5_daily_sp_1981.nc.json
     ./catalog_regclim_raster_global_era5_sfc_climatology/collection.json
     |____ ./era5_sfc_0.25_climatology_ERA5_climatology_ws10_1981_2016.nc/era5_sfc_0.25_climatology_ERA5_climatology_ws10_1981_2016.nc.json
     |____ ./era5_sfc_0.25_climatology_ERA5_climatology_tp_1981_2016.nc/era5_sfc_0.25_climatology_ERA5_climatology_tp_1981_2016.nc.json
     |____ ./era5_sfc_0.25_climatology_ERA5_climatology_t2min_1981_2016.nc/era5_sfc_0.25_climatology_ERA5_climatology_t2min_1981_2016.nc.json
     ./catalog_regclim_raster_global_era5_sfc_aggregated/collection.json
     |____ ./era5_sfc_0.25_aggregated_ERA5_daily_tp_1979_2018.nc/era5_sfc_0.25_aggregated_ERA5_daily_tp_1979_2018.nc.json
     STAC Catalog has been created!

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.0.14.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TDS2STAC-2.0.14-py2.py3-none-any.whl (26.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file TDS2STAC-2.0.14.tar.gz.

File metadata

  • Download URL: TDS2STAC-2.0.14.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for TDS2STAC-2.0.14.tar.gz
Algorithm Hash digest
SHA256 23cec1cb2a622edde4d238c3ec109477c6df5e675d2de05d5e2d2b47f6d9edae
MD5 ab0a912b16aaabc6c07bb0384a8cc7ce
BLAKE2b-256 bd1825d3804fed131867555787e3d84583cbd9b7cac2faadc5e73a64eac78e8a

See more details on using hashes here.

File details

Details for the file TDS2STAC-2.0.14-py2.py3-none-any.whl.

File metadata

  • Download URL: TDS2STAC-2.0.14-py2.py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for TDS2STAC-2.0.14-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d5b5fd9fb18f2e5def0905d3abdb4f5224f96455922bed2eee5b745207a51516
MD5 2cc31826ec32ed385d3be218fde98b64
BLAKE2b-256 f867f3a4a0ce4c1838c5c7fef9281c1eb84493e50d1a62032a356e82323c4e42

See more details on using hashes here.

Supported by

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