Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving logic and extensibility #9

Merged
merged 50 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
700db7c
DB driver independent metadata fields implementation
Kirill888 Aug 14, 2018
b64eb70
Adding test to ensure `float-range` is understood as `numeric-range`
Kirill888 Aug 14, 2018
792b43a
Moved Field/Expression base classes
Kirill888 Jan 11, 2019
4d6cc75
Tests for datacube.utils.aws.*
Kirill888 Apr 12, 2019
303ada1
Adding tools for AWS s3 cloud access
Kirill888 Sep 9, 2019
3d53679
Make sure to clear all AWS_* environment variables for testing
Kirill888 Sep 9, 2019
3037849
More tests for `.utils.aws.`
Kirill888 Sep 10, 2019
6b036db
Move AWS env erasing into a test fixture
Kirill888 Sep 10, 2019
e309f60
Add test for non-happy path of get_creds_with_retry
Kirill888 Sep 10, 2019
d6c4443
Test that number of attempts is as configured
Kirill888 Sep 10, 2019
d1b2523
Add s3_url_parse helper method
Kirill888 Sep 10, 2019
279df1c
Helper method for formatting s3 request byte range
Kirill888 Sep 11, 2019
6d64de7
Adding helpers for reading/writing from/to s3
Kirill888 Sep 11, 2019
519aafd
Filling some test gaps in datacube.utils.aws
Kirill888 Sep 11, 2019
d4e1bbe
Add s3 client thread local cache
Kirill888 Sep 11, 2019
f746086
Mocking tests for running on travis
Kirill888 Sep 12, 2019
99645b9
Cleanups: more mypy annotations remove more python2-isms
Kirill888 May 5, 2020
fe53737
Support unsigned s3 access in datacube.utils.aws
Kirill888 Jun 30, 2020
fb5948a
Add s3_head_object helper method
Kirill888 Aug 13, 2020
8514929
Add and update license headers for all Python files
alexgleith Nov 5, 2020
354b426
Add and update license headers for all Python files
alexgleith Nov 5, 2020
ddfccb7
Simplify dependencies, use mock from stdlib
omad Dec 4, 2020
f3c0e28
Update tests for new version of boto
petewa Dec 14, 2020
3d1545f
IAM authentication for Postgres (#1168)
SpacemanPaul Aug 5, 2021
ed40534
Product resource implementation and tests.
SpacemanPaul Mar 8, 2022
866f46f
Merge pull request #1247 from opendatacube/in_memory_index_driver
SpacemanPaul May 10, 2022
f903134
Fix mypy error in model/fields and typo in utils/geometry/gbox from l…
SpacemanPaul May 31, 2022
aa2a94c
More mypy compliance fixes.
SpacemanPaul Jun 1, 2022
10d0bef
More assorted mypy compliance.
SpacemanPaul Jun 1, 2022
841d76b
Fix regressions.
SpacemanPaul Jun 3, 2022
f5640d4
Merge pull request #1266 from opendatacube/typehint_compliance
SpacemanPaul Jun 6, 2022
4299e9b
Porting recent develop (1.8.x) changes forward into develop-1.9 branc…
SpacemanPaul Jun 21, 2023
589adcc
Porting recent develop (1.8.x) changes forward into develop-1.9 branc…
SpacemanPaul Jun 21, 2023
1166fd2
updates to properties, rename DatasetDocBase for consistency, some ti…
Aug 1, 2023
47b1586
Copy model/fields into eo3
Aug 14, 2023
43fbd76
initial design for DatasetMetadata
Aug 17, 2023
b0ed625
fix some linting, add more properties to model
Aug 18, 2023
0f8da0a
further refine model and update tests
Aug 30, 2023
e1eeb50
Copy aws tests into eo3
Aug 30, 2023
f5908dd
undo stac-extension version change
Aug 31, 2023
f8e4561
copy over aws tests
Aug 31, 2023
9fca71d
add moto to tests requirements
Aug 31, 2023
49d983e
remove unused aws functions
Aug 31, 2023
ecdaa4e
add docstrings, removed GridDoc, complete additional metadata test
Sep 5, 2023
f16bcab
add Range to public objects
Sep 5, 2023
af6e900
facilitate core integration, resolve some todos
Sep 7, 2023
92fc204
put back _is_json_array, put utils into a module, copy over tests fro…
Sep 8, 2023
005c491
add pytest-httpserver to test requirements, update requirements files
Sep 13, 2023
a684adc
pin jsonschema to >=4.18 and <4.19 to avoid RefResolver error
Sep 13, 2023
d8f8bce
pin jsonschema to 4.18.0
Sep 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions eo3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from ._version import get_versions
from .assemble import IncompleteDatasetError
from .images import GridSpec, ValidDataMethod
from .model import Eo3DatasetDocBase
from .model import DatasetDocBase
Ariana-B marked this conversation as resolved.
Show resolved Hide resolved
from .properties import Eo3DictBase

REPO_URL = "https://github.com/GeoscienceAustralia/eo-datasets.git"
Expand All @@ -10,10 +9,9 @@
del get_versions

__all__ = (
"Eo3DatasetDocBase",
"DatasetDocBase",
"Eo3DictBase",
"GridSpec",
"IncompleteDatasetError",
"REPO_URL",
"ValidDataMethod",
"__version__",
Expand Down
146 changes: 0 additions & 146 deletions eo3/assemble.py

This file was deleted.

68 changes: 34 additions & 34 deletions eo3/eo3_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
polygon,
)

EO3_SCHEMA = "https://schemas.opendatacube.org/dataset"
from eo3.model import ODC_DATASET_SCHEMA_URL


# This is should become eo3.models.GridDoc
Expand Down Expand Up @@ -174,7 +174,7 @@ def is_doc_eo3(doc: Dict[str, Any]) -> bool:
if schema is None:
return False

if schema == EO3_SCHEMA:
if schema == ODC_DATASET_SCHEMA_URL:
return True

# Otherwise it has an unknown schema.
Expand Down Expand Up @@ -204,46 +204,46 @@ def is_doc_geo(doc: Dict[str, Any], check_eo3: bool = True) -> bool:
return "extent" in doc or "grid_spatial" in doc


def prep_eo3(
doc: Dict[str, Any], auto_skip: bool = False, resolution: Optional[float] = None
) -> Dict[str, Any]:
"""Modify spatial and lineage sections of eo3 metadata
def prep_eo3(doc: Dict[str, Any],
resolution: Optional[float] = None, # can we remove this?
remap_lineage=True) -> Dict[str, Any]:
""" Modify spatial and lineage sections of eo3 metadata
:param doc: input document
:param auto_skip: If true check if dataset is EO3 and if not
silently return input dataset without modifications
:param remap_lineage: If True (default) disambiguate lineage classifiers so that
source_id and classifier form a unique index (for indexes that DON'T
support external_lineage).
If False, leave lineage in the same format.
"""
if doc is None:
return None

if auto_skip:
if not is_doc_eo3(doc):
return doc

def stringify(u: Optional[Union[str, UUID]]) -> Optional[str]:
return u if isinstance(u, str) else str(u) if u else None

doc["id"] = stringify(doc.get("id", None))
doc['id'] = stringify(doc.get('id', None))

doc = add_eo3_parts(doc, resolution=resolution)
lineage = doc.pop("lineage", {})

def remap_lineage(name, uuids) -> Dict[str, Any]:
"""Turn name, [uuid] -> {name: {id: uuid}}"""
if len(uuids) == 0:
return {}
if isinstance(uuids, dict) or isinstance(uuids[0], dict):
raise ValueError("Embedded lineage not supported for eo3 metadata types")
if len(uuids) == 1:
return {name: {"id": stringify(uuids[0])}}

out = {}
for idx, uuid in enumerate(uuids, start=1):
out[name + str(idx)] = {"id": stringify(uuid)}
return out

sources = {}
for name, uuids in lineage.items():
sources.update(remap_lineage(name, uuids))

doc["lineage"] = dict(source_datasets=sources)
if remap_lineage:
lineage = doc.pop('lineage', {})

def lineage_remap(name, uuids) -> Dict[str, Any]:
""" Turn name, [uuid] -> {name: {id: uuid}}
"""
if len(uuids) == 0:
return {}
if isinstance(uuids, dict) or isinstance(uuids[0], dict):
raise ValueError("Embedded lineage not supported for eo3 metadata types")
if len(uuids) == 1:
return {name: {'id': stringify(uuids[0])}}

out = {}
for idx, uuid in enumerate(uuids, start=1):
out[name+str(idx)] = {'id': stringify(uuid)}
return out

sources = {}
for name, uuids in lineage.items():
sources.update(lineage_remap(name, uuids))

doc['lineage'] = dict(source_datasets=sources)
return doc
Loading
Loading