taco-eo 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taco_eo-0.3.0 → taco_eo-0.5.0}/CHANGELOG.md +52 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/PKG-INFO +13 -2
- {taco_eo-0.3.0 → taco_eo-0.5.0}/README.md +1 -1
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/change_detection.py +2 -12
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/geospatial.py +3 -16
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/oceantaco_istac.py +1 -17
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/sequence.py +1 -3
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/stac_segmentation.py +2 -16
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/time_series.py +1 -2
- {taco_eo-0.3.0 → taco_eo-0.5.0}/pyproject.toml +11 -1
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/__init__.py +6 -2
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_repr.py +3 -1
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/contract.py +142 -68
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/dataset.py +2 -2
- taco_eo-0.5.0/taco/extensions/__init__.py +7 -0
- taco_eo-0.5.0/taco/extensions/rumi.py +143 -0
- taco_eo-0.5.0/taco/extensions/spatiotemporal.py +222 -0
- taco_eo-0.5.0/taco/metadata/_base.py +116 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/asset.py +1 -16
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/spatiotemporal.py +13 -12
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/reader/__init__.py +75 -22
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/schema.py +43 -11
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/validate.py +5 -2
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/archive.py +8 -3
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/metadata_tables.py +18 -8
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/conftest.py +7 -14
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/datasets.py +11 -81
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_contract.py +3 -3
- taco_eo-0.5.0/tests/test_extension_contract.py +145 -0
- taco_eo-0.5.0/tests/test_extension_rumi.py +196 -0
- taco_eo-0.5.0/tests/test_extension_spatiotemporal.py +166 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_metadata.py +9 -9
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_reader.py +46 -1
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_writer.py +2 -5
- taco_eo-0.3.0/taco/metadata/_base.py +0 -68
- {taco_eo-0.3.0 → taco_eo-0.5.0}/.gitignore +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/LICENSE +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/minimal.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/numpy_minimal.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/examples/partitioned.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_graph.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_parquet.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_publish.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_source.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/_view.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/__init__.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/collection.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/naming.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/sample.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/structure.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/contract/types.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/cozip.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/errors.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/__init__.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/collection.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/derived.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/folder.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/sample.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/metadata/split.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/py.typed +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/reader/engine.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/tacocat.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/__init__.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/core.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/folder.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/progress.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/taco/writer/staging.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/__init__.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_collection.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_examples.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_parquet.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_progress.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_publish.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_tacocat.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_types.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_validate.py +0 -0
- {taco_eo-0.3.0 → taco_eo-0.5.0}/tests/test_writer_cases.py +0 -0
|
@@ -5,6 +5,58 @@ All notable changes to `taco` are documented here. The format follows
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
## 0.5.0 - 2026-09-13
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `Extension` and `ExtensionContext` provide one writer-time metadata API for
|
|
13
|
+
operations with validated sample inputs, declared outputs, dependencies, and
|
|
14
|
+
access to local assets. Extensions are explicitly attached to a metadata
|
|
15
|
+
level and run in dependency order.
|
|
16
|
+
- Explicit `taco.extensions.STAC()` and `ISTAC()` operations derive centroids
|
|
17
|
+
and temporal midpoints during `writer.run()`. `MajorTOM` composes with STAC
|
|
18
|
+
through its `stac:centroid` dependency regardless of declaration order.
|
|
19
|
+
- `taco.extensions.Rumi()` stores the canonical binary `rumi:header` for local
|
|
20
|
+
`.rumi` assets and can calculate named per-band `rumi:stats`.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Active STAC and ISTAC metadata can run at sample or folder scope according
|
|
25
|
+
to their configured input model.
|
|
26
|
+
- Development and release checks exercise real Rumi and antimeridian runtimes
|
|
27
|
+
instead of silently skipping those integrations.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- `metadata.asset.Raster` and `RasterStats`. Their manually repeated shape,
|
|
32
|
+
dtype, resolution, and positional statistics duplicated format metadata and
|
|
33
|
+
did not inspect raster assets.
|
|
34
|
+
|
|
35
|
+
## 0.4.0 - 2026-09-10
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- `@asterisk-labs/taco` 1.0.0, a standalone JavaScript reader for TACO v3
|
|
40
|
+
FOLDER, ZIP, and TACOCAT datasets over HTTP. It supports raw-level reads,
|
|
41
|
+
wide and long layouts, sample and file selection, semantic filters,
|
|
42
|
+
reader-calculated `taco:location` values, and targeted payload range reads.
|
|
43
|
+
- A browser TACO viewer backed by the JavaScript reader and the public
|
|
44
|
+
TACO/Rumi fixtures. It maps STAC and ISTAC centroids, navigates the Parquet
|
|
45
|
+
hierarchy for each sample, presents the dataset-wide contract separately,
|
|
46
|
+
and provides copy, download, and Rumi-read actions for payloads.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- Python, R, and Julia now expose only the `location` reader argument. Stored
|
|
51
|
+
`cozip:location` and `taco:location` values remain protected and are never
|
|
52
|
+
surfaced as trusted locations.
|
|
53
|
+
- The project README now presents all four language bindings and links to the
|
|
54
|
+
viewer, specification, package registries, and release checks.
|
|
55
|
+
- Python release checks enforce formatting, linting, strict typing, warnings,
|
|
56
|
+
and branch coverage before building and publishing artifacts.
|
|
57
|
+
|
|
58
|
+
## 0.3.0 - 2026-09-08
|
|
59
|
+
|
|
8
60
|
### Changed
|
|
9
61
|
|
|
10
62
|
- Python, R, and Julia now share `open_dataset()` and `read()`. An open dataset
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: taco-eo
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Read and write TACO datasets in Python.
|
|
5
5
|
Project-URL: Homepage, https://asterisk.coop/taco
|
|
6
6
|
Project-URL: Specification, https://asterisk.coop/taco/spec
|
|
@@ -27,6 +27,12 @@ Requires-Dist: duckdb>=1.5.5
|
|
|
27
27
|
Requires-Dist: numpy>=1.24
|
|
28
28
|
Requires-Dist: pyarrow>=14
|
|
29
29
|
Requires-Dist: pydantic>=2.8
|
|
30
|
+
Requires-Dist: pyproj>=3.6
|
|
31
|
+
Requires-Dist: shapely>=2
|
|
32
|
+
Provides-Extra: antimeridian
|
|
33
|
+
Requires-Dist: antimeridian>=0.4; extra == 'antimeridian'
|
|
34
|
+
Requires-Dist: pyproj>=3.6; extra == 'antimeridian'
|
|
35
|
+
Requires-Dist: shapely>=2; extra == 'antimeridian'
|
|
30
36
|
Provides-Extra: dev
|
|
31
37
|
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
32
38
|
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
@@ -36,9 +42,14 @@ Provides-Extra: geoenrich
|
|
|
36
42
|
Requires-Dist: earthengine-api>=1; extra == 'geoenrich'
|
|
37
43
|
Provides-Extra: progress
|
|
38
44
|
Requires-Dist: tqdm>=4.66; extra == 'progress'
|
|
45
|
+
Provides-Extra: rumi
|
|
46
|
+
Requires-Dist: rumi-eo[write]>=0.19; extra == 'rumi'
|
|
39
47
|
Provides-Extra: test
|
|
40
48
|
Requires-Dist: pytest-cov>=5; extra == 'test'
|
|
41
49
|
Requires-Dist: pytest>=8; extra == 'test'
|
|
50
|
+
Provides-Extra: test-eo
|
|
51
|
+
Requires-Dist: antimeridian>=0.4; extra == 'test-eo'
|
|
52
|
+
Requires-Dist: rumi-eo[write]>=0.19; extra == 'test-eo'
|
|
42
53
|
Description-Content-Type: text/markdown
|
|
43
54
|
|
|
44
55
|
# taco
|
|
@@ -70,6 +81,6 @@ the current directory.
|
|
|
70
81
|
| [`sequence.py`](examples/sequence.py) | Variable-length asset sequences |
|
|
71
82
|
| [`time_series.py`](examples/time_series.py) | Per-observation time and cloud metadata |
|
|
72
83
|
| [`geospatial.py`](examples/geospatial.py) | Compact STAC metadata and derived MajorTOM cells |
|
|
73
|
-
| [`stac_segmentation.py`](examples/stac_segmentation.py) |
|
|
84
|
+
| [`stac_segmentation.py`](examples/stac_segmentation.py) | STAC extensions for regular raster chips, labels, bands, and scaling |
|
|
74
85
|
| [`oceantaco_istac.py`](examples/oceantaco_istac.py) | OceanTACO-inspired ISTAC metadata for irregular SWOT swaths and Argo collocations |
|
|
75
86
|
| [`partitioned.py`](examples/partitioned.py) | ZIP partitions and their TACOCAT catalog |
|
|
@@ -27,6 +27,6 @@ the current directory.
|
|
|
27
27
|
| [`sequence.py`](examples/sequence.py) | Variable-length asset sequences |
|
|
28
28
|
| [`time_series.py`](examples/time_series.py) | Per-observation time and cloud metadata |
|
|
29
29
|
| [`geospatial.py`](examples/geospatial.py) | Compact STAC metadata and derived MajorTOM cells |
|
|
30
|
-
| [`stac_segmentation.py`](examples/stac_segmentation.py) |
|
|
30
|
+
| [`stac_segmentation.py`](examples/stac_segmentation.py) | STAC extensions for regular raster chips, labels, bands, and scaling |
|
|
31
31
|
| [`oceantaco_istac.py`](examples/oceantaco_istac.py) | OceanTACO-inspired ISTAC metadata for irregular SWOT swaths and Argo collocations |
|
|
32
32
|
| [`partitioned.py`](examples/partitioned.py) | ZIP partitions and their TACOCAT catalog |
|
|
@@ -16,7 +16,6 @@ def encode(array: np.ndarray) -> bytes:
|
|
|
16
16
|
return buffer.getvalue()
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
raster = taco.metadata.asset.Raster
|
|
20
19
|
contract = taco.Contract(
|
|
21
20
|
structure=[
|
|
22
21
|
"before/B02.npy",
|
|
@@ -27,9 +26,7 @@ contract = taco.Contract(
|
|
|
27
26
|
],
|
|
28
27
|
metadata=taco.MetadataSchema(
|
|
29
28
|
taco.Level("sample", ml=taco.metadata.sample.Split),
|
|
30
|
-
taco.Level("children", acquisition=Acquisition | None
|
|
31
|
-
taco.Level("children/before", raster=raster),
|
|
32
|
-
taco.Level("children/after", raster=raster),
|
|
29
|
+
taco.Level("children", acquisition=Acquisition | None),
|
|
33
30
|
),
|
|
34
31
|
)
|
|
35
32
|
collection = taco.Collection(
|
|
@@ -52,14 +49,7 @@ paths = {
|
|
|
52
49
|
"after/B03.npy": after[1],
|
|
53
50
|
"change.npy": np.any(before != after, axis=0),
|
|
54
51
|
}
|
|
55
|
-
assets = [
|
|
56
|
-
taco.Asset(
|
|
57
|
-
encode(array),
|
|
58
|
-
path=path,
|
|
59
|
-
metadata=taco.Metadata(raster=raster(resolution=10, num_bands=1, data_type=str(array.dtype))),
|
|
60
|
-
)
|
|
61
|
-
for path, array in paths.items()
|
|
62
|
-
]
|
|
52
|
+
assets = [taco.Asset(encode(array), path=path) for path, array in paths.items()]
|
|
63
53
|
sample = taco.Sample(
|
|
64
54
|
assets=assets,
|
|
65
55
|
metadata=taco.Metadata(ml=taco.metadata.sample.Split(split="train")),
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import struct
|
|
2
1
|
from datetime import datetime, timezone
|
|
3
2
|
|
|
4
3
|
import taco
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
def point(longitude: float, latitude: float) -> bytes:
|
|
8
|
-
return struct.pack("<BIdd", 1, 1, longitude, latitude)
|
|
9
|
-
|
|
10
|
-
|
|
11
5
|
contract = taco.Contract(
|
|
12
6
|
structure=["image.bin"],
|
|
13
7
|
metadata=taco.MetadataSchema(
|
|
14
8
|
taco.Level(
|
|
15
9
|
"sample",
|
|
16
|
-
stac=taco.
|
|
17
|
-
majortom=taco.
|
|
10
|
+
stac=taco.extensions.STAC(),
|
|
11
|
+
majortom=taco.extensions.MajorTOM(
|
|
18
12
|
dist_km=100,
|
|
19
13
|
latitude_range=(-20, 0),
|
|
20
14
|
longitude_range=(-90, -60),
|
|
21
15
|
),
|
|
22
16
|
),
|
|
23
|
-
taco.Level("children", raster=taco.metadata.asset.Raster),
|
|
24
17
|
),
|
|
25
18
|
)
|
|
26
19
|
collection = taco.Collection(
|
|
@@ -36,19 +29,13 @@ collection = taco.Collection(
|
|
|
36
29
|
sites = [(-77.04, -12.05), (-71.97, -13.53), (-80.63, -5.19)]
|
|
37
30
|
with taco.open_writer(collection, "geospatial.zip", overwrite=True) as writer:
|
|
38
31
|
for index, (longitude, latitude) in enumerate(sites):
|
|
39
|
-
location = point(longitude, latitude)
|
|
40
32
|
stac = taco.metadata.sample.STAC(
|
|
41
33
|
crs="EPSG:4326",
|
|
42
34
|
tensor_shape=(1, 8, 8),
|
|
43
35
|
geotransform=(longitude - 0.05, 0.0125, 0, latitude + 0.05, 0, -0.0125),
|
|
44
|
-
centroid=location,
|
|
45
36
|
time_start=datetime(2024, 1, index + 1, tzinfo=timezone.utc),
|
|
46
37
|
)
|
|
47
|
-
asset = taco.Asset(
|
|
48
|
-
bytes([index + 1]) * 64,
|
|
49
|
-
path="image.bin",
|
|
50
|
-
metadata=taco.Metadata(raster=taco.metadata.asset.Raster(resolution=10, num_bands=1, data_type="uint8")),
|
|
51
|
-
)
|
|
38
|
+
asset = taco.Asset(bytes([index + 1]) * 64, path="image.bin")
|
|
52
39
|
writer.add(taco.Sample(assets=asset, metadata=taco.Metadata(stac=stac)))
|
|
53
40
|
writer.run()
|
|
54
41
|
|
|
@@ -53,10 +53,6 @@ def encode(array: np.ndarray) -> bytes:
|
|
|
53
53
|
return buffer.getvalue()
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def point(longitude: float, latitude: float) -> bytes:
|
|
57
|
-
return struct.pack("<BIdd", 1, 1, longitude, latitude)
|
|
58
|
-
|
|
59
|
-
|
|
60
56
|
def polygon(ring: list[tuple[float, float]]) -> bytes:
|
|
61
57
|
if ring[0] != ring[-1]:
|
|
62
58
|
ring = [*ring, ring[0]]
|
|
@@ -76,7 +72,7 @@ contract = taco.Contract(
|
|
|
76
72
|
metadata=taco.MetadataSchema(
|
|
77
73
|
taco.Level(
|
|
78
74
|
"sample",
|
|
79
|
-
istac=taco.
|
|
75
|
+
istac=taco.extensions.ISTAC(),
|
|
80
76
|
ocean=OceanWindow,
|
|
81
77
|
ml=taco.metadata.sample.Split,
|
|
82
78
|
),
|
|
@@ -85,15 +81,11 @@ contract = taco.Contract(
|
|
|
85
81
|
group=AssetGroup | None,
|
|
86
82
|
variables=OceanVariables | None,
|
|
87
83
|
array=ArrayLayout | None,
|
|
88
|
-
raster=taco.metadata.asset.Raster | None,
|
|
89
|
-
stats=taco.metadata.asset.RasterStats | None,
|
|
90
84
|
),
|
|
91
85
|
taco.Level(
|
|
92
86
|
"children/satellite",
|
|
93
87
|
variables=OceanVariables,
|
|
94
88
|
array=ArrayLayout,
|
|
95
|
-
raster=taco.metadata.asset.Raster,
|
|
96
|
-
stats=taco.metadata.asset.RasterStats,
|
|
97
89
|
),
|
|
98
90
|
taco.Level(
|
|
99
91
|
"children/in_situ",
|
|
@@ -184,7 +176,6 @@ with taco.open_writer(collection, "oceantaco-istac.zip", overwrite=True) as writ
|
|
|
184
176
|
units: str,
|
|
185
177
|
source_product: str,
|
|
186
178
|
) -> taco.Asset:
|
|
187
|
-
stats = [[float(array.min()), float(array.max()), float(array.mean())]]
|
|
188
179
|
return taco.Asset(
|
|
189
180
|
encode(array),
|
|
190
181
|
path=path,
|
|
@@ -198,8 +189,6 @@ with taco.open_writer(collection, "oceantaco-istac.zip", overwrite=True) as writ
|
|
|
198
189
|
array=ArrayLayout(
|
|
199
190
|
dimensions=["along_track", "across_track"], shape=list(array.shape), data_type="float32"
|
|
200
191
|
),
|
|
201
|
-
raster=taco.metadata.asset.Raster(resolution=2_000, num_bands=1, data_type="float32"),
|
|
202
|
-
stats=taco.metadata.asset.RasterStats(stats=stats),
|
|
203
192
|
),
|
|
204
193
|
)
|
|
205
194
|
|
|
@@ -253,10 +242,6 @@ with taco.open_writer(collection, "oceantaco-istac.zip", overwrite=True) as writ
|
|
|
253
242
|
shape=list(quality.shape),
|
|
254
243
|
data_type="uint8",
|
|
255
244
|
),
|
|
256
|
-
raster=taco.metadata.asset.Raster(resolution=2_000, num_bands=1, data_type="uint8"),
|
|
257
|
-
stats=taco.metadata.asset.RasterStats(
|
|
258
|
-
stats=[[float(quality.min()), float(quality.max()), float(quality.mean())]]
|
|
259
|
-
),
|
|
260
245
|
),
|
|
261
246
|
),
|
|
262
247
|
]
|
|
@@ -265,7 +250,6 @@ with taco.open_writer(collection, "oceantaco-istac.zip", overwrite=True) as writ
|
|
|
265
250
|
istac = taco.metadata.sample.ISTAC(
|
|
266
251
|
crs="EPSG:4326",
|
|
267
252
|
geometry=polygon(window["ring"]),
|
|
268
|
-
centroid=point(*window["centroid"]),
|
|
269
253
|
time_start=window["time"],
|
|
270
254
|
time_end=window["time"] + timedelta(minutes=18),
|
|
271
255
|
)
|
|
@@ -15,7 +15,6 @@ contract = taco.Contract(
|
|
|
15
15
|
structure=["image*[2,5].npy"],
|
|
16
16
|
metadata=taco.MetadataSchema(
|
|
17
17
|
taco.Level("sample", ml=taco.metadata.sample.Split),
|
|
18
|
-
taco.Level("children", raster=taco.metadata.asset.Raster),
|
|
19
18
|
),
|
|
20
19
|
)
|
|
21
20
|
collection = taco.Collection(
|
|
@@ -33,8 +32,7 @@ with taco.open_writer(collection, "image-sequence.zip", overwrite=True) as write
|
|
|
33
32
|
assets = []
|
|
34
33
|
for frame_index in range(length):
|
|
35
34
|
image = np.full((8, 8), sample_index * 10 + frame_index, dtype=np.uint16)
|
|
36
|
-
|
|
37
|
-
assets.append(taco.Asset(encode(image), path=f"image{frame_index}.npy", metadata=metadata))
|
|
35
|
+
assets.append(taco.Asset(encode(image), path=f"image{frame_index}.npy"))
|
|
38
36
|
split = "test" if sample_index == 2 else "train"
|
|
39
37
|
writer.add(
|
|
40
38
|
taco.Sample(
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import io
|
|
2
|
-
import struct
|
|
3
2
|
from datetime import datetime, timedelta, timezone
|
|
4
3
|
from typing import Annotated, Literal
|
|
5
4
|
|
|
@@ -38,20 +37,15 @@ def encode(array: np.ndarray) -> bytes:
|
|
|
38
37
|
return buffer.getvalue()
|
|
39
38
|
|
|
40
39
|
|
|
41
|
-
def point(longitude: float, latitude: float) -> bytes:
|
|
42
|
-
# WKB keeps the example dependency-free. Centroids are always EPSG:4326.
|
|
43
|
-
return struct.pack("<BIdd", 1, 1, longitude, latitude)
|
|
44
|
-
|
|
45
|
-
|
|
46
40
|
contract = taco.Contract(
|
|
47
41
|
structure=["image.npy", "label.npy"],
|
|
48
42
|
metadata=taco.MetadataSchema(
|
|
49
43
|
taco.Level(
|
|
50
44
|
"sample",
|
|
51
|
-
stac=taco.
|
|
45
|
+
stac=taco.extensions.STAC(),
|
|
52
46
|
chip=Chip,
|
|
53
47
|
ml=taco.metadata.sample.Split,
|
|
54
|
-
majortom=taco.
|
|
48
|
+
majortom=taco.extensions.MajorTOM(
|
|
55
49
|
dist_km=100,
|
|
56
50
|
latitude_range=(-20, 0),
|
|
57
51
|
longitude_range=(-90, -60),
|
|
@@ -60,8 +54,6 @@ contract = taco.Contract(
|
|
|
60
54
|
taco.Level(
|
|
61
55
|
"children",
|
|
62
56
|
content=AssetContent,
|
|
63
|
-
raster=taco.metadata.asset.Raster,
|
|
64
|
-
stats=taco.metadata.asset.RasterStats | None,
|
|
65
57
|
scaling=taco.metadata.asset.Scaling | None,
|
|
66
58
|
),
|
|
67
59
|
),
|
|
@@ -146,8 +138,6 @@ with taco.open_writer(collection, "stac-segmentation.zip", overwrite=True) as wr
|
|
|
146
138
|
class_scores[class_names.index(chip["cover"])] += 5_000
|
|
147
139
|
label = np.argmax(class_scores, axis=0).astype(np.uint8)
|
|
148
140
|
dominant_land_cover = class_names[int(np.bincount(label.ravel()).argmax())]
|
|
149
|
-
band_stats = [[float(band.min()), float(band.max()), float(band.mean())] for band in image]
|
|
150
|
-
longitude, latitude = chip["centroid"]
|
|
151
141
|
easting, northing = chip["origin"]
|
|
152
142
|
|
|
153
143
|
# STAC is enough here because the affine grid reconstructs every footprint.
|
|
@@ -155,7 +145,6 @@ with taco.open_writer(collection, "stac-segmentation.zip", overwrite=True) as wr
|
|
|
155
145
|
crs=chip["crs"],
|
|
156
146
|
tensor_shape=image.shape,
|
|
157
147
|
geotransform=(easting, 10, 0, northing, 0, -10),
|
|
158
|
-
centroid=point(longitude, latitude),
|
|
159
148
|
time_start=chip["time"],
|
|
160
149
|
time_end=chip["time"] + timedelta(minutes=10),
|
|
161
150
|
)
|
|
@@ -165,8 +154,6 @@ with taco.open_writer(collection, "stac-segmentation.zip", overwrite=True) as wr
|
|
|
165
154
|
path="image.npy",
|
|
166
155
|
metadata=taco.Metadata(
|
|
167
156
|
content=AssetContent(role="input", bands=["B02", "B03", "B04", "B08"], nodata=0),
|
|
168
|
-
raster=taco.metadata.asset.Raster(resolution=10, num_bands=4, data_type="uint16"),
|
|
169
|
-
stats=taco.metadata.asset.RasterStats(stats=band_stats),
|
|
170
157
|
scaling=taco.metadata.asset.Scaling(
|
|
171
158
|
scale_factor=[0.0001] * 4,
|
|
172
159
|
scale_offset=[0.0] * 4,
|
|
@@ -178,7 +165,6 @@ with taco.open_writer(collection, "stac-segmentation.zip", overwrite=True) as wr
|
|
|
178
165
|
path="label.npy",
|
|
179
166
|
metadata=taco.Metadata(
|
|
180
167
|
content=AssetContent(role="target", bands=["land_cover"], nodata=255),
|
|
181
|
-
raster=taco.metadata.asset.Raster(resolution=10, num_bands=1, data_type="uint8"),
|
|
182
168
|
),
|
|
183
169
|
),
|
|
184
170
|
]
|
|
@@ -28,7 +28,7 @@ contract = taco.Contract(
|
|
|
28
28
|
structure=["image*[3,6].npy"],
|
|
29
29
|
metadata=taco.MetadataSchema(
|
|
30
30
|
taco.Level("sample", site=Site),
|
|
31
|
-
taco.Level("children", observation=Observation
|
|
31
|
+
taco.Level("children", observation=Observation),
|
|
32
32
|
),
|
|
33
33
|
)
|
|
34
34
|
collection = taco.Collection(
|
|
@@ -52,7 +52,6 @@ with taco.open_writer(collection, "time-series.zip", overwrite=True) as writer:
|
|
|
52
52
|
time=start + timedelta(days=step * 5),
|
|
53
53
|
cloud_cover=float(step * 8),
|
|
54
54
|
),
|
|
55
|
-
raster=taco.metadata.asset.Raster(resolution=10, num_bands=4, data_type="uint16"),
|
|
56
55
|
)
|
|
57
56
|
assets.append(taco.Asset(encode(image), path=f"image{step}.npy", metadata=metadata))
|
|
58
57
|
writer.add(taco.Sample(assets=assets, metadata=taco.Metadata(site=Site(name=f"site-{site_index}"))))
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "taco-eo"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.5.0"
|
|
8
8
|
description = "Read and write TACO datasets in Python."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -41,12 +41,17 @@ dependencies = [
|
|
|
41
41
|
"numpy>=1.24",
|
|
42
42
|
"pyarrow>=14",
|
|
43
43
|
"pydantic>=2.8",
|
|
44
|
+
"pyproj>=3.6",
|
|
45
|
+
"shapely>=2",
|
|
44
46
|
]
|
|
45
47
|
|
|
46
48
|
[project.optional-dependencies]
|
|
47
49
|
test = ["pytest>=8", "pytest-cov>=5"]
|
|
48
50
|
dev = ["pytest>=8", "pytest-cov>=5", "ruff>=0.5", "mypy>=1.8"]
|
|
51
|
+
test-eo = ["rumi-eo[write]>=0.19", "antimeridian>=0.4"]
|
|
49
52
|
geoenrich = ["earthengine-api>=1"]
|
|
53
|
+
rumi = ["rumi-eo[write]>=0.19"]
|
|
54
|
+
antimeridian = ["pyproj>=3.6", "shapely>=2", "antimeridian>=0.4"]
|
|
50
55
|
progress = ["tqdm>=4.66"]
|
|
51
56
|
|
|
52
57
|
[project.urls]
|
|
@@ -66,6 +71,7 @@ testpaths = ["tests"]
|
|
|
66
71
|
addopts = "-q --strict-config --strict-markers"
|
|
67
72
|
filterwarnings = ["error"]
|
|
68
73
|
xfail_strict = true
|
|
74
|
+
markers = ["integration: exercises installed optional runtimes with real files"]
|
|
69
75
|
|
|
70
76
|
[tool.ruff]
|
|
71
77
|
target-version = "py310"
|
|
@@ -83,6 +89,10 @@ strict = true
|
|
|
83
89
|
module = "taco.cozip"
|
|
84
90
|
disable_error_code = ["import-untyped"]
|
|
85
91
|
|
|
92
|
+
[[tool.mypy.overrides]]
|
|
93
|
+
module = ["pyarrow", "pyarrow.*"]
|
|
94
|
+
ignore_missing_imports = true
|
|
95
|
+
|
|
86
96
|
[[tool.mypy.overrides]]
|
|
87
97
|
module = ["taco._view", "taco.tacocat", "taco.writer.metadata_tables"]
|
|
88
98
|
disable_error_code = ["no-untyped-call"]
|
|
@@ -2,11 +2,12 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from importlib.metadata import PackageNotFoundError, version
|
|
4
4
|
|
|
5
|
-
from . import metadata, reader
|
|
5
|
+
from . import extensions, metadata, reader
|
|
6
6
|
from .contract import Asset, Collection, Contract, Folder, Sample
|
|
7
7
|
from .dataset import Dataset, open_dataset, read
|
|
8
8
|
from .errors import TacoError
|
|
9
|
-
from .
|
|
9
|
+
from .metadata._base import ExtensionContext
|
|
10
|
+
from .schema import CollectionMetadata, DerivedMetadata, Extension, Level, Metadata, MetadataSchema
|
|
10
11
|
from .tacocat import consolidate
|
|
11
12
|
from .validate import validate
|
|
12
13
|
from .writer import open_writer
|
|
@@ -23,6 +24,8 @@ __all__ = [
|
|
|
23
24
|
"Contract",
|
|
24
25
|
"Dataset",
|
|
25
26
|
"DerivedMetadata",
|
|
27
|
+
"Extension",
|
|
28
|
+
"ExtensionContext",
|
|
26
29
|
"Folder",
|
|
27
30
|
"Level",
|
|
28
31
|
"Metadata",
|
|
@@ -31,6 +34,7 @@ __all__ = [
|
|
|
31
34
|
"TacoError",
|
|
32
35
|
"__version__",
|
|
33
36
|
"consolidate",
|
|
37
|
+
"extensions",
|
|
34
38
|
"metadata",
|
|
35
39
|
"open_dataset",
|
|
36
40
|
"open_writer",
|
|
@@ -193,7 +193,9 @@ def _structure(dataset: Dataset) -> str:
|
|
|
193
193
|
def _metadata(dataset: Dataset) -> str:
|
|
194
194
|
rows = []
|
|
195
195
|
for level, fields in dataset.contract.metadata.items():
|
|
196
|
-
produced = {
|
|
196
|
+
produced = {
|
|
197
|
+
field for group in dataset.contract.extensions.get(level, {}).values() for field in group["produces"]
|
|
198
|
+
}
|
|
197
199
|
chips = "".join(_metadata_field(name, field, derived=name in produced) for name, field in fields.items())
|
|
198
200
|
content = chips or '<span class="taco-empty">no fields</span>'
|
|
199
201
|
rows.append(
|