Skip to content

Commit

Permalink
Setup of inital structure
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Apr 25, 2024
1 parent 8bed954 commit cf8559b
Show file tree
Hide file tree
Showing 15 changed files with 1,028 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/unitest-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
push:
release:
types: [published]

jobs:
unittest:
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: 1
steps:
- name: checkout xcube-stac
uses: actions/checkout@v3

- name: Set up MicroMamba
uses: mamba-org/provision-with-micromamba@main
with:
cache-env: true
extra-specs: |
python=3.10
- name: Run unit tests
shell: bash -l {0}
run: |
cd /home/runner/work/xcube-stac/xcube-stac
ls
pytest
114 changes: 114 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Credentials
*-credentials.json

# Test output data
test-outputs/

# IntelliJ / PyCharm
.idea

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.vscode/settings.json
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Changes in 0.1.0 (in development)

Initial version of STAC Data Store.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Brockmann Consult GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: xcube-stac
channels:
- conda-forge
- defaults
dependencies:
# Required
- xarray
- pystac
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools >= 61.2.0"]
build-backend = "setuptools.build_meta"

[project]
name = "xcube_stac"
dynamic = ["version"]
authors = [
{name = "Konstantin Ntokas", email = "[email protected]"}
]
description = """\
xcube data store for accessing stac catalogs\
"""
keywords = [
"analysis ready data", "data science", "datacube", "xarray", "zarr", "xcube", "stac"
]
readme = {file = "README.md", content-type = "text/markdown"}
license = {text = "MIT"}
requires-python = ">=3.10"
dependencies = [
"xarray",
"pystac"
]

[tool.setuptools.dynamic]
version = {attr = "xcube_stac.__version__"}

[tool.setuptools.packages.find]
exclude = [
"test*",
"doc*"
]

[project.optional-dependencies]
dev = [
"pytest",
"flake8"
]

[project.urls]
Repository = 'https://github.com/xcube-dev/xcube-stac'
Issues = 'https://github.com/xcube-dev/xcube-stac/issues'
Changelog = 'https://github.com/xcube-dev/xcube-stac/blob/main/CHANGES.md'
53 changes: 53 additions & 0 deletions test/test_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# The MIT License (MIT)
# Copyright (c) 2024 by the xcube development team and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import unittest

from xcube.util.extension import ExtensionRegistry
from xcube_stac.plugin import init_plugin


class XcubePluginTest(unittest.TestCase):
def test_plugin(self):
"""Assert xcube extensions registered by xcube-stac"""
registry = ExtensionRegistry()
init_plugin(registry)
self.assertEqual(
{
"xcube.core.store": {
"stac": {
"component": "<not loaded yet>",
"description": "STAC DataStore",
"name": "stac",
"point": "xcube.core.store",
}
},
"xcube.core.store.opener": {
"dataset:zarr:stac": {
"component": "<not loaded yet>",
"description": "xarray.Dataset from STAC API",
"name": "dataset:zarr:stac",
"point": "xcube.core.store.opener",
}
},
},
registry.to_dict(),
)
35 changes: 35 additions & 0 deletions test/test_stac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# The MIT License (MIT)
# Copyright (c) 2024 by the xcube development team and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import unittest
from xcube_stac.stac import Stac


class StacTest(unittest.TestCase):

def test_open_data(self):
stac_instance = Stac("url")
with self.assertRaises(NotImplementedError) as cm:
stac_instance.open_data("data_id1")
self.assertEqual(
"open_data() operation is not supported yet",
f"{cm.exception}",
)
Loading

0 comments on commit cf8559b

Please sign in to comment.