Skip to content

Commit cf8559b

Browse files
committed
Setup of inital structure
1 parent 8bed954 commit cf8559b

15 files changed

+1028
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
unittest:
10+
runs-on: ubuntu-latest
11+
env:
12+
NUMBA_DISABLE_JIT: 1
13+
steps:
14+
- name: checkout xcube-stac
15+
uses: actions/checkout@v3
16+
17+
- name: Set up MicroMamba
18+
uses: mamba-org/provision-with-micromamba@main
19+
with:
20+
cache-env: true
21+
extra-specs: |
22+
python=3.10
23+
24+
- name: Run unit tests
25+
shell: bash -l {0}
26+
run: |
27+
cd /home/runner/work/xcube-stac/xcube-stac
28+
ls
29+
pytest

.gitignore

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Credentials
2+
*-credentials.json
3+
4+
# Test output data
5+
test-outputs/
6+
7+
# IntelliJ / PyCharm
8+
.idea
9+
10+
# Byte-compiled / optimized / DLL files
11+
__pycache__/
12+
*.py[cod]
13+
*$py.class
14+
15+
# C extensions
16+
*.so
17+
18+
# Distribution / packaging
19+
.Python
20+
build/
21+
develop-eggs/
22+
dist/
23+
downloads/
24+
eggs/
25+
.eggs/
26+
lib/
27+
lib64/
28+
parts/
29+
sdist/
30+
var/
31+
wheels/
32+
*.egg-info/
33+
.installed.cfg
34+
*.egg
35+
MANIFEST
36+
37+
# PyInstaller
38+
# Usually these files are written by a python script from a template
39+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
40+
*.manifest
41+
*.spec
42+
43+
# Installer logs
44+
pip-log.txt
45+
pip-delete-this-directory.txt
46+
47+
# Unit test / coverage reports
48+
htmlcov/
49+
.tox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
.hypothesis/
57+
.pytest_cache/
58+
59+
# Translations
60+
*.mo
61+
*.pot
62+
63+
# Django stuff:
64+
*.log
65+
local_settings.py
66+
db.sqlite3
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# pyenv
85+
.python-version
86+
87+
# celery beat schedule file
88+
celerybeat-schedule
89+
90+
# SageMath parsed files
91+
*.sage.py
92+
93+
# Environments
94+
.env
95+
.venv
96+
env/
97+
venv/
98+
ENV/
99+
env.bak/
100+
venv.bak/
101+
102+
# Spyder project settings
103+
.spyderproject
104+
.spyproject
105+
106+
# Rope project settings
107+
.ropeproject
108+
109+
# mkdocs documentation
110+
/site
111+
112+
# mypy
113+
.mypy_cache/
114+
.vscode/settings.json

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Changes in 0.1.0 (in development)
2+
3+
Initial version of STAC Data Store.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Brockmann Consult GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

environment.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: xcube-stac
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
# Required
7+
- xarray
8+
- pystac

pyproject.toml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["setuptools >= 61.2.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "xcube_stac"
7+
dynamic = ["version"]
8+
authors = [
9+
{name = "Konstantin Ntokas", email = "[email protected]"}
10+
]
11+
description = """\
12+
xcube data store for accessing stac catalogs\
13+
"""
14+
keywords = [
15+
"analysis ready data", "data science", "datacube", "xarray", "zarr", "xcube", "stac"
16+
]
17+
readme = {file = "README.md", content-type = "text/markdown"}
18+
license = {text = "MIT"}
19+
requires-python = ">=3.10"
20+
dependencies = [
21+
"xarray",
22+
"pystac"
23+
]
24+
25+
[tool.setuptools.dynamic]
26+
version = {attr = "xcube_stac.__version__"}
27+
28+
[tool.setuptools.packages.find]
29+
exclude = [
30+
"test*",
31+
"doc*"
32+
]
33+
34+
[project.optional-dependencies]
35+
dev = [
36+
"pytest",
37+
"flake8"
38+
]
39+
40+
[project.urls]
41+
Repository = 'https://github.com/xcube-dev/xcube-stac'
42+
Issues = 'https://github.com/xcube-dev/xcube-stac/issues'
43+
Changelog = 'https://github.com/xcube-dev/xcube-stac/blob/main/CHANGES.md'

test/test_plugin.py

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# The MIT License (MIT)
2+
# Copyright (c) 2024 by the xcube development team and contributors
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a
5+
# copy of this software and associated documentation files (the "Software"),
6+
# to deal in the Software without restriction, including without limitation
7+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
# and/or sell copies of the Software, and to permit persons to whom the
9+
# Software is furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
import unittest
23+
24+
from xcube.util.extension import ExtensionRegistry
25+
from xcube_stac.plugin import init_plugin
26+
27+
28+
class XcubePluginTest(unittest.TestCase):
29+
def test_plugin(self):
30+
"""Assert xcube extensions registered by xcube-stac"""
31+
registry = ExtensionRegistry()
32+
init_plugin(registry)
33+
self.assertEqual(
34+
{
35+
"xcube.core.store": {
36+
"stac": {
37+
"component": "<not loaded yet>",
38+
"description": "STAC DataStore",
39+
"name": "stac",
40+
"point": "xcube.core.store",
41+
}
42+
},
43+
"xcube.core.store.opener": {
44+
"dataset:zarr:stac": {
45+
"component": "<not loaded yet>",
46+
"description": "xarray.Dataset from STAC API",
47+
"name": "dataset:zarr:stac",
48+
"point": "xcube.core.store.opener",
49+
}
50+
},
51+
},
52+
registry.to_dict(),
53+
)

test/test_stac.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# The MIT License (MIT)
2+
# Copyright (c) 2024 by the xcube development team and contributors
3+
#
4+
# Permission is hereby granted, free of charge, to any person obtaining a
5+
# copy of this software and associated documentation files (the "Software"),
6+
# to deal in the Software without restriction, including without limitation
7+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
# and/or sell copies of the Software, and to permit persons to whom the
9+
# Software is furnished to do so, subject to the following conditions:
10+
#
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
#
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
import unittest
23+
from xcube_stac.stac import Stac
24+
25+
26+
class StacTest(unittest.TestCase):
27+
28+
def test_open_data(self):
29+
stac_instance = Stac("url")
30+
with self.assertRaises(NotImplementedError) as cm:
31+
stac_instance.open_data("data_id1")
32+
self.assertEqual(
33+
"open_data() operation is not supported yet",
34+
f"{cm.exception}",
35+
)

0 commit comments

Comments
 (0)