Skip to content

Commit

Permalink
Merge pull request #25 from crim-ca/arch-finalization-proposal
Browse files Browse the repository at this point in the history
Arch finalization proposal
  • Loading branch information
dchandan authored Nov 8, 2023
2 parents 0c829a1 + 3f1d284 commit 26fe4ad
Show file tree
Hide file tree
Showing 20 changed files with 938 additions and 921 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
IMP_DIR = /Users/dchandan/DACCS/Codes/stac-populator/implementations
IMP_DIR = STACpopulator/implementations
STAC_HOST = http://localhost:8880/stac

testcmip6:
python $(IMP_DIR)/CMIP6-UofT/add_CMIP6.py $(STAC_HOST) https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/birdhouse/testdata/xclim/cmip6/catalog.html $(IMP_DIR)/CMIP6-UofT/CMIP6.yml
python $(IMP_DIR)/CMIP6_UofT/add_CMIP6.py $(STAC_HOST) https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/birdhouse/testdata/xclim/cmip6/catalog.html

delcmip6:
curl --location --request DELETE '$(STAC_HOST)/collections/CMIP6_UofT'
@echo ""

starthost:
docker compose up
Expand Down
7 changes: 3 additions & 4 deletions STACpopulator/api_requests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
from typing import Any, Optional
from urllib.parse import urljoin

import requests
from colorlog import ColoredFormatter

Expand Down Expand Up @@ -79,17 +79,16 @@ def post_stac_item(
"""
item_id = json_data["id"]

r = requests.post(urljoin(stac_host, f"collections/{collection_id}/items"), json=json_data)
r = requests.post(os.path.join(stac_host, f"collections/{collection_id}/items"), json=json_data)

if r.status_code == 200:
LOGGER.info(f"Item {item_name} successfully added")
elif r.status_code == 409:
if update:
LOGGER.info(f"Item {item_id} already exists. Updating.")
r = requests.put(urljoin(stac_host, f"collections/{collection_id}/items/{item_id}"), json=json_data)
r = requests.put(os.path.join(stac_host, f"collections/{collection_id}/items/{item_id}"), json=json_data)
r.raise_for_status()
else:
LOGGER.info(f"Item {item_id} already exists.")
else:
r.raise_for_status()

179 changes: 0 additions & 179 deletions STACpopulator/extensions/cmip6.py

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 26fe4ad

Please sign in to comment.