drb-chunk-sentinel1 0.1.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.
- drb_chunk_sentinel1-0.1.0/LICENCE.txt +165 -0
- drb_chunk_sentinel1-0.1.0/MANIFEST.in +4 -0
- drb_chunk_sentinel1-0.1.0/PKG-INFO +377 -0
- drb_chunk_sentinel1-0.1.0/README.md +360 -0
- drb_chunk_sentinel1-0.1.0/drb/addons/chunk/sentinel1/__init__.py +35 -0
- drb_chunk_sentinel1-0.1.0/drb/addons/chunk/sentinel1/_generate.py +111 -0
- drb_chunk_sentinel1-0.1.0/drb/addons/chunk/sentinel1/_version.py +21 -0
- drb_chunk_sentinel1-0.1.0/drb/addons/chunk/sentinel1/cortex-slc.ttl +230 -0
- drb_chunk_sentinel1-0.1.0/drb/addons/chunk/sentinel1/cortex.ttl +34 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/PKG-INFO +377 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/SOURCES.txt +26 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/dependency_links.txt +1 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/not-zip-safe +1 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/requires.txt +1 -0
- drb_chunk_sentinel1-0.1.0/drb_chunk_sentinel1.egg-info/top_level.txt +3 -0
- drb_chunk_sentinel1-0.1.0/pyproject.toml +3 -0
- drb_chunk_sentinel1-0.1.0/requirements.txt +1 -0
- drb_chunk_sentinel1-0.1.0/setup.cfg +43 -0
- drb_chunk_sentinel1-0.1.0/setup.py +5 -0
- drb_chunk_sentinel1-0.1.0/tests/test_cortex_ttl.py +95 -0
- drb_chunk_sentinel1-0.1.0/tests/test_navigation.py +40 -0
- drb_chunk_sentinel1-0.1.0/tests/test_package.py +16 -0
- drb_chunk_sentinel1-0.1.0/tests/test_resolution.py +80 -0
- drb_chunk_sentinel1-0.1.0/tests/test_slc_bursts.py +62 -0
- drb_chunk_sentinel1-0.1.0/tests/test_slc_fixture.py +21 -0
- drb_chunk_sentinel1-0.1.0/tests/test_windowed_read.py +30 -0
- drb_chunk_sentinel1-0.1.0/versioneer.py +2140 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: drb-chunk-sentinel1
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Sentinel-1 product chunk descriptors (drb-chunk)
|
|
5
|
+
Author: GAEL Systems
|
|
6
|
+
Author-email: drb-python@gael.fr
|
|
7
|
+
License: LGPLv3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
12
|
+
Requires-Python: <3.14,>=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENCE.txt
|
|
15
|
+
Requires-Dist: rdflib
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# drb-chunk-sentinel1
|
|
19
|
+
|
|
20
|
+
Chunk descriptors for Sentinel-1 **Level-1** product types: **GRD** (detected
|
|
21
|
+
amplitude) and **SLC** (Single Look Complex), built on top of the
|
|
22
|
+
[drb-chunk](../../core/README.md) add-on.
|
|
23
|
+
|
|
24
|
+
## What it is
|
|
25
|
+
|
|
26
|
+
`drb-chunk-sentinel1` ships a generated `cortex.ttl` that declares chunk
|
|
27
|
+
descriptors for Level-1 GRD and SLC products, attached **once** to the
|
|
28
|
+
existing Sentinel-1 Level-1 class URI:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
http://knowledge-base.gael.fr/drb/sentinel-1/product_level-1
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Every Level-1 product — whatever its acquisition mode (IW/EW/SM) or satellite
|
|
35
|
+
(S1A/B/C/D) — resolves to a subclass of `product_level-1` and **inherits**
|
|
36
|
+
the chunks through the topic graph's `subClassOf` chain. There is no
|
|
37
|
+
product-type-specific topic class in the knowledge base, and none was added:
|
|
38
|
+
each chunk's `drb:source` XQuery self-selects on the filename token
|
|
39
|
+
(`-grd-<pol>-` for GRD, `-slc-<pol>-` for SLC) — products of the non-matching
|
|
40
|
+
type yield an empty source for that chunk.
|
|
41
|
+
|
|
42
|
+
The package does **not** modify the Sentinel-1 topic TTL and registers **no
|
|
43
|
+
entry-point group**. It is a pure descriptor extension merged into the topic
|
|
44
|
+
graph at runtime (see [How attachment works](#how-attachment-works)).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Chunks exposed
|
|
49
|
+
|
|
50
|
+
One `measurement` chunk per polarization, tile 512 × 512, `uint16`, one band.
|
|
51
|
+
Array shape is read at runtime from the raster itself (GRD dimensions vary
|
|
52
|
+
per product/slice) — never hard-coded in the descriptor.
|
|
53
|
+
|
|
54
|
+
| Chunk name | Content | dtype | Tile |
|
|
55
|
+
|------------|---------|-------|------|
|
|
56
|
+
| `VV` | VV-polarization detected amplitude | uint16 | 512×512 |
|
|
57
|
+
| `VH` | VH-polarization detected amplitude | uint16 | 512×512 |
|
|
58
|
+
| `HH` | HH-polarization detected amplitude | uint16 | 512×512 |
|
|
59
|
+
| `HV` | HV-polarization detected amplitude | uint16 | 512×512 |
|
|
60
|
+
|
|
61
|
+
### Mode × polarization coverage
|
|
62
|
+
|
|
63
|
+
The four chunk descriptors are declared once, mode-agnostic, and apply
|
|
64
|
+
uniformly across every Level-1 GRD product type. Which polarizations are
|
|
65
|
+
actually present on a given product depends on its acquisition mode and
|
|
66
|
+
polarization scheme; absent polarizations resolve to an empty XQuery source
|
|
67
|
+
(see [Limitations](#limitations)).
|
|
68
|
+
|
|
69
|
+
| Mode | Product type | VV | VH | HH | HV | Validated live |
|
|
70
|
+
|------|--------------|:--:|:--:|:--:|:--:|-----------------|
|
|
71
|
+
| IW (Interferometric Wide) | GRDH | ✅ | ✅ | ✅ | ✅ | ✅ **yes** (local S1C fixture, SDV) |
|
|
72
|
+
| EW (Extra Wide) | GRDM | ✅ | ✅ | ✅ | ✅ | ⚠️ **no** — no local EW fixture |
|
|
73
|
+
| SM (Stripmap) | GRDH / GRDM | ✅ | ✅ | ✅ | ✅ | ⚠️ **no** — no local SM fixture |
|
|
74
|
+
|
|
75
|
+
A single product carries at most a dual-pol pair (e.g. SDV → VV+VH, SDH →
|
|
76
|
+
HH+HV) or a single polarization (SSV → VV, SSH → HH); `available_chunks`
|
|
77
|
+
still lists all four chunk names for every GRD product (they are declared on
|
|
78
|
+
the shared `product_level-1` ancestor), but `apply()` on an absent
|
|
79
|
+
polarization raises `DrbChunkError` — never silently wrong data.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Collection taxonomy
|
|
84
|
+
|
|
85
|
+
`drb:collection` carries the SAFE **data family**; `drb:chunkName` carries
|
|
86
|
+
the addressing within it (polarization for GRD; swath×pol×burst-index for
|
|
87
|
+
SLC). This release populates only `measurement`; the other collections are
|
|
88
|
+
reserved names for future increments (see the design spec §5 for the full
|
|
89
|
+
rationale).
|
|
90
|
+
|
|
91
|
+
| Collection | Content | Status | Increment |
|
|
92
|
+
|------------|---------|--------|-----------|
|
|
93
|
+
| `measurement` | SAR image raster — GRD: 1 chunk/pol (detected, ground-range, uint16, regular 512² tiling) | ✅ **implemented** (this release) | 1 |
|
|
94
|
+
| `bursts` | SLC measurement re-viewed per burst (per swath), geometry from `swathTiming/linesPerBurst` + `burstList` | reserved — new annotation-driven `TilingScheme` | 2 |
|
|
95
|
+
| `calibration` | Radiometric LUTs (sigma0/beta0/gamma/dn), coarse azimuth×range grid, per pol | reserved — candidate LUT/coarse-grid reader | future / RFE |
|
|
96
|
+
| `noise` | Thermal-noise LUTs (range + azimuth), per pol | reserved | future / RFE |
|
|
97
|
+
| `geolocation` | `geolocationGridPoint` (lat/lon/height/incidence…) coarse grid | reserved | future / RFE |
|
|
98
|
+
| `rfi` | RFI detection/mitigation reports (flags) | out of scope — no regular array | — |
|
|
99
|
+
| `preview` | Reduced-resolution quicklook/browse | reserved | future |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## How attachment works
|
|
104
|
+
|
|
105
|
+
`cortex.ttl` extends the Level-1 class **by URI**, targeting
|
|
106
|
+
`sentinel-1:product_level-1` — the level-1 root every GRD (and SLC/WV)
|
|
107
|
+
product inherits from. It does not include a `setup.cfg` entry-point group —
|
|
108
|
+
the TTL is not auto-discovered by the resolver on its own.
|
|
109
|
+
|
|
110
|
+
At runtime the chunk TTL must be **merged into the topic graph** in one of
|
|
111
|
+
two ways (see [Bootstrap](#bootstrap)):
|
|
112
|
+
|
|
113
|
+
- In a **Fuseki** deployment, add the packaged TTL to the named-graph list
|
|
114
|
+
loaded into the dataset.
|
|
115
|
+
- In an **offline** setup, compose it together with the S1-SAFE topic TTLs
|
|
116
|
+
in a single `RDFDao([...])`.
|
|
117
|
+
|
|
118
|
+
Once merged, `drb-chunk` reads the descriptors via `get_dao(topic).graph`
|
|
119
|
+
(walking `subClassOf` upward from the resolved topic) and makes them
|
|
120
|
+
available through the standard chunk API.
|
|
121
|
+
|
|
122
|
+
The packaged TTL path is returned by:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from drb.addons.chunk.sentinel1 import cortex_path
|
|
126
|
+
print(cortex_path()) # /path/to/drb/addons/chunk/sentinel1/cortex.ttl
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Bootstrap
|
|
132
|
+
|
|
133
|
+
### Mode 1 — Fuseki (recommended for production)
|
|
134
|
+
|
|
135
|
+
Set the environment variables before resolving any node:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
export FUSEKI_URL=http://localhost:3030
|
|
139
|
+
export DATASET=drb
|
|
140
|
+
export DRB_FUSEKI_GRAPHS="http://drb.gael.fr/graph/kb/drbx-kb-topics-sentinel-1-safe/latest,http://drb.gael.fr/graph/kb/drbx-kb-topics-safe/latest"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`DRB_FUSEKI_GRAPHS` is a comma-separated list of Fuseki named-graph URIs; the
|
|
144
|
+
chunk-descriptor graph (loaded from this package's `cortex.ttl`) must also
|
|
145
|
+
be merged into the same dataset/graph set. **No change to `drb-fuseki`
|
|
146
|
+
itself is required** — the chunk descriptor attaches to the pre-existing
|
|
147
|
+
`product_level-1` URI, so the KB is used exactly as shipped.
|
|
148
|
+
|
|
149
|
+
### Mode 2 — Offline vendored TTL
|
|
150
|
+
|
|
151
|
+
Compose **three** files into a single `RDFDao` and register it before
|
|
152
|
+
resolving. The base `safe-topics.ttl` is the `owl:imports` root that carries
|
|
153
|
+
the `subClassOf+ drb:item` closure — loading only the Sentinel-1-specific TTL
|
|
154
|
+
loses that closure and every `product*` class vanishes from the DAO:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from drb.topics.dao import ManagerDao
|
|
158
|
+
from drb.topics.dao.rdf_dao import RDFDao
|
|
159
|
+
from drb.addons.chunk.sentinel1 import cortex_path
|
|
160
|
+
|
|
161
|
+
safe_topics_ttl = "/path/to/vendored/safe-topics.ttl"
|
|
162
|
+
s1_safe_ttl = "/path/to/vendored/sentinel-1-safe-topics.ttl"
|
|
163
|
+
ManagerDao().add_dao_instance(
|
|
164
|
+
RDFDao([safe_topics_ttl, s1_safe_ttl, cortex_path()]))
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [`examples/demo_s1_grd_chunk.py`](examples/demo_s1_grd_chunk.py) for a
|
|
168
|
+
complete runnable demonstration of both modes, and
|
|
169
|
+
[`examples/RESULTS-grd.md`](examples/RESULTS-grd.md) for a captured run
|
|
170
|
+
against the local S1C IW GRDH fixture.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Worked example
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import numpy
|
|
178
|
+
from drb.topics import resolver
|
|
179
|
+
from drb.addons.addon import AddonManager
|
|
180
|
+
from drb.chunk.selection import WindowSelection
|
|
181
|
+
|
|
182
|
+
# 1. Resolve the product (bootstrap the KB topics first; see Bootstrap).
|
|
183
|
+
# resolver.create() path-walks a nested "x.SAFE.zip/x.SAFE" URL directly.
|
|
184
|
+
node = resolver.create(
|
|
185
|
+
"/data/S1C_IW_GRDH_1SDV_..._7B0C.SAFE.zip/"
|
|
186
|
+
"S1C_IW_GRDH_1SDV_..._7B0C.SAFE")
|
|
187
|
+
topic = resolver.resolve(node)[0]
|
|
188
|
+
print(topic.uri)
|
|
189
|
+
# http://knowledge-base.gael.fr/drb/sentinel-1/product_level-1_iw_s
|
|
190
|
+
|
|
191
|
+
# 2. Discover the chunks, by collection, declared for this topic
|
|
192
|
+
# (inherited from product_level-1 -- no GRD-specific topic class exists)
|
|
193
|
+
addon = AddonManager().get_addon("chunk")
|
|
194
|
+
print(addon.available_collections(topic))
|
|
195
|
+
# {'measurement': ['VV', 'VH', 'HH', 'HV']}
|
|
196
|
+
|
|
197
|
+
# 3. Build a chunk and read a 512x512 window
|
|
198
|
+
chunk = addon.apply(node, chunk_name="VV", topic=topic)
|
|
199
|
+
window = WindowSelection(x=0, y=0, w=512, h=512)
|
|
200
|
+
array = chunk.select(window).get_impl(numpy.ndarray)
|
|
201
|
+
print(array.shape, array.dtype) # (1, 512, 512) uint16
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## SLC bursts
|
|
207
|
+
|
|
208
|
+
Single Look Complex (SLC) products are resolved as `product_level-1_iw_s[_abc]`
|
|
209
|
+
(a satellite-letter class) and carry **burst-indexed chunks** in the `bursts`
|
|
210
|
+
collection. Each burst is identified by its swath and polarization (e.g.,
|
|
211
|
+
`IW1_VV`, `IW2_HH`); they are enumerated **dynamically** at runtime by reading
|
|
212
|
+
the SLC annotation XML's `burstList`.
|
|
213
|
+
|
|
214
|
+
### Chunk addressing and geometry
|
|
215
|
+
|
|
216
|
+
An SLC burst chunk is addressed as `<SWATH>_<POL>` (e.g., `IW1_VV`):
|
|
217
|
+
|
|
218
|
+
| Chunk name | Content | Tiling scheme | dtype | Sample rate |
|
|
219
|
+
|------------|---------|---|-------|------|
|
|
220
|
+
| `IW1_VV` | Swath 1, VV polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
221
|
+
| `IW1_VH` | Swath 1, VH polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
222
|
+
| `IW2_VV` | Swath 2, VV polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
223
|
+
| `IW2_VH` | Swath 2, VH polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
224
|
+
| `IW3_VV` | Swath 3, VV polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
225
|
+
| `IW3_VH` | Swath 3, VH polarization, per-burst complex SAR image | Burst-indexed (N bursts × 2D) | complex64 | native |
|
|
226
|
+
|
|
227
|
+
Burst **geometry is dynamic**: `linesPerBurst` and `samplesPerBurst` are read
|
|
228
|
+
from the product's annotation XML, and burst windows are assembled from the
|
|
229
|
+
`burstList` offsets. All bursts within a swath carry the **same** sample count;
|
|
230
|
+
line counts may vary per-burst within a swath (nominal case: all equal; edge
|
|
231
|
+
bursts occasionally shorter).
|
|
232
|
+
|
|
233
|
+
### Addressing bursts via `IselSelection(per_dim={"burst": i})`
|
|
234
|
+
|
|
235
|
+
The chunk is a multi-dimensional array with the **burst index as the first
|
|
236
|
+
dimension** (e.g., shape `(N, lines, samples)` for a complex64 image). Bursts
|
|
237
|
+
are **enumerated** via `chunk.tiles()` (yields `(0,), (1,), ..., (N-1,)` tuples)
|
|
238
|
+
and accessed individually via `chunk.tile((i,))` or via selection:
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
from drb.chunk.selection import IselSelection
|
|
242
|
+
import numpy
|
|
243
|
+
|
|
244
|
+
# Enumerate bursts for swath IW1, polarization VV
|
|
245
|
+
chunk = addon.apply(node, chunk_name="IW1_VV", topic=topic)
|
|
246
|
+
burst_count = len(list(chunk.tiles())) # e.g. 9
|
|
247
|
+
|
|
248
|
+
# Read burst 3 as a complex64 numpy array
|
|
249
|
+
burst3 = chunk.select(
|
|
250
|
+
IselSelection(per_dim={"burst": 3})).get_impl(numpy.ndarray)
|
|
251
|
+
print(burst3.shape) # (1, lines, samples)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Kept metadata per burst
|
|
255
|
+
|
|
256
|
+
Each burst reference holds **metadata** (accessed via `chunk.tile((i,)).info`):
|
|
257
|
+
|
|
258
|
+
| Key | Example | Type | Notes |
|
|
259
|
+
|-----|---------|------|-------|
|
|
260
|
+
| `burstIndex` | `3` | int | 0-based burst index within the swath |
|
|
261
|
+
| `burstIdAbsolute` | `900015` | int | Product-relative burst ID from `burstList/@absolute` |
|
|
262
|
+
| `azimuthTime` | `2026-01-20T00:10:05.123456` | str | Burst acquisition timestamp (ISO 8601) |
|
|
263
|
+
| `byteOffset` | `245760` | int | Byte offset of the burst's first line in the measurement file |
|
|
264
|
+
| `window` | `((0, 500), (0, 1296))` | tuple | Line and sample indices bounding the burst in the measurement raster `(line_start:line_end, sample_start:sample_end)` |
|
|
265
|
+
| `footprint` | `POLYGON((20 10, 21 10, ...))` | str | Burst's geolocation footprint (WKT POLYGON) derived from the coarse geolocation grid |
|
|
266
|
+
|
|
267
|
+
### Deferred metadata
|
|
268
|
+
|
|
269
|
+
The `firstValidSample` / `lastValidSample` arrays (per-line validity masks)
|
|
270
|
+
and the per-burst radiometric data (calibration, noise LUTs) are **not yet
|
|
271
|
+
exposed** as chunks — they are reserved for future increments. Descriptive
|
|
272
|
+
metadata (incidence angle, Doppler, etc.) is also deferred.
|
|
273
|
+
|
|
274
|
+
### Bootstrap (same as GRD)
|
|
275
|
+
|
|
276
|
+
SLC chunk descriptors are merged into the same topic graph as GRD chunks. The
|
|
277
|
+
bootstrap procedure (Fuseki or offline vendored TTL) is identical; see
|
|
278
|
+
[Bootstrap](#bootstrap).
|
|
279
|
+
|
|
280
|
+
### Worked example
|
|
281
|
+
|
|
282
|
+
```python
|
|
283
|
+
import numpy
|
|
284
|
+
from drb.topics import resolver
|
|
285
|
+
from drb.addons.addon import AddonManager
|
|
286
|
+
from drb.chunk.selection import IselSelection
|
|
287
|
+
|
|
288
|
+
# 1. Resolve an SLC product.
|
|
289
|
+
node = resolver.create(
|
|
290
|
+
"s3://bucket/S1A_IW_SLC__1SDV_20260120T001002_..._1234.SAFE/"
|
|
291
|
+
"measurement/s1a-iw1-slc-vv-20260120t001002-...-001.tiff")
|
|
292
|
+
topic = resolver.resolve(node)[0]
|
|
293
|
+
print(topic.uri)
|
|
294
|
+
# http://knowledge-base.gael.fr/drb/sentinel-1/product_level-1_iw_s_a
|
|
295
|
+
|
|
296
|
+
# 2. Get the chunk, enumerating bursts at runtime.
|
|
297
|
+
addon = AddonManager().get_addon("chunk")
|
|
298
|
+
chunk = addon.apply(node, chunk_name="IW1_VV", topic=topic)
|
|
299
|
+
bursts = list(chunk.tiles())
|
|
300
|
+
print(f"IW1_VV: {len(bursts)} bursts") # e.g. "9 bursts"
|
|
301
|
+
|
|
302
|
+
# 3. Read burst metadata and data.
|
|
303
|
+
ref = chunk.tile((0,))
|
|
304
|
+
print(ref.window) # e.g. ((0, 500), (0, 1296))
|
|
305
|
+
print(ref.info['azimuthTime']) # 2026-01-20T00:10:02.123456
|
|
306
|
+
print(ref.info['footprint']) # POLYGON((20 10, 21 10, ...))
|
|
307
|
+
|
|
308
|
+
# 4. Read the burst's full data as a numpy array.
|
|
309
|
+
burst0 = chunk.select(
|
|
310
|
+
IselSelection(per_dim={"burst": 0})).get_impl(numpy.ndarray)
|
|
311
|
+
print(burst0.shape, burst0.dtype) # (1, 500, 1296) complex64
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
See [`examples/demo_s1_slc_burst.py`](examples/demo_s1_slc_burst.py) for a
|
|
315
|
+
complete runnable demonstration against the offline synthetic fixture, and
|
|
316
|
+
[`examples/RESULTS-slc.md`](examples/RESULTS-slc.md) for a captured run.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Limitations
|
|
321
|
+
|
|
322
|
+
- **Chunks are listed even when not materialisable on a given product.**
|
|
323
|
+
Because all four polarization chunks (and, from increment 2, the SLC
|
|
324
|
+
bursts) are declared once on the shared `product_level-1` ancestor,
|
|
325
|
+
`available_chunks`/`available_collections` on any Level-1 product (GRD,
|
|
326
|
+
SLC, or WV) lists all of them, whether or not that specific product
|
|
327
|
+
carries that polarization or product type. `apply(chunk_name=...)` raises
|
|
328
|
+
`DrbChunkError` if the chunk's XQuery source matches nothing in the given
|
|
329
|
+
product — never silently wrong data.
|
|
330
|
+
- **EW GRDM / SM GRD are not validated against a live product** in this
|
|
331
|
+
release — only IW GRDH was exercised end-to-end (no local EW/SM fixture
|
|
332
|
+
available). The chunk descriptors are mode-agnostic and unit-parsed
|
|
333
|
+
(`tests/test_cortex_ttl.py`), so EW/SM are expected to work identically,
|
|
334
|
+
but this is a documented gap, not a claim. See
|
|
335
|
+
[`examples/RESULTS-grd.md`](examples/RESULTS-grd.md).
|
|
336
|
+
- **Windowing is correct but not a true partial network fetch on every
|
|
337
|
+
medium.** Locally (plain file or zip member) a 512×512 window reads back
|
|
338
|
+
in ~0.02 s with no measurable zip overhead. Over S3, GRD's raster layout
|
|
339
|
+
(striped, 1-line blocks, no internal tiling, no overviews) caps
|
|
340
|
+
efficiency at line-band granularity — see
|
|
341
|
+
[`docs/evolution-requests.md`](docs/evolution-requests.md) RFE 1.
|
|
342
|
+
- **Single-tile materialisation:** each `apply` / `select` call opens one
|
|
343
|
+
measurement GeoTIFF. Multi-tile mosaicking is not supported in this
|
|
344
|
+
release (existing drb-chunk v1 deferral, tracked in
|
|
345
|
+
`docs/evolution-requests.md`).
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Regenerating the descriptor
|
|
350
|
+
|
|
351
|
+
The `cortex.ttl` is generated from a small polarization table embedded in
|
|
352
|
+
`_generate.py`. To regenerate after editing the table:
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
python -m drb.addons.chunk.sentinel1._generate
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
The file is written next to the module (i.e.
|
|
359
|
+
`drb/addons/chunk/sentinel1/cortex.ttl`). Commit the result.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Installation
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
pip install drb-chunk-sentinel1
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
This package's only declared runtime dependency is `rdflib` (it ships a
|
|
370
|
+
generated `cortex.ttl` descriptor, see `requirements.txt`). The consuming
|
|
371
|
+
environment is responsible for providing a working drb stack — `drb`,
|
|
372
|
+
`drb-chunk`, `drb-extractor`, `drb-driver-image`, `rasterio`, `numpy`
|
|
373
|
+
(listed in `requirements-test.txt` for dev/CI) — plus either a Fuseki
|
|
374
|
+
instance or the vendored S1 topic TTLs at runtime (see
|
|
375
|
+
[Bootstrap](#bootstrap)). Resolving a `.SAFE.zip` or S3-hosted product
|
|
376
|
+
additionally requires `drb-driver-zip` / `drb-driver-s3`, which are not
|
|
377
|
+
declared dependencies of this package either.
|