kuva-reader 1.1.1__py3-none-any.whl → 1.1.2__py3-none-any.whl
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.
Potentially problematic release.
This version of kuva-reader might be problematic. Click here for more details.
- kuva_reader/__init__.py +1 -1
- kuva_reader/reader/level0.py +15 -6
- kuva_reader/reader/level1.py +22 -7
- kuva_reader/reader/product_base.py +1 -1
- {kuva_reader-1.1.1.dist-info → kuva_reader-1.1.2.dist-info}/METADATA +11 -18
- kuva_reader-1.1.2.dist-info/RECORD +15 -0
- {kuva_reader-1.1.1.dist-info → kuva_reader-1.1.2.dist-info}/WHEEL +1 -1
- kuva_reader-1.1.2.dist-info/entry_points.txt +3 -0
- kuva_reader-1.1.1.dist-info/RECORD +0 -15
- kuva_reader-1.1.1.dist-info/entry_points.txt +0 -4
kuva_reader/__init__.py
CHANGED
kuva_reader/reader/level0.py
CHANGED
|
@@ -61,7 +61,7 @@ class Level0Product(ProductBase[MetadataLevel0]):
|
|
|
61
61
|
) -> None:
|
|
62
62
|
super().__init__(image_path, metadata, target_ureg)
|
|
63
63
|
|
|
64
|
-
self.
|
|
64
|
+
self._images = {
|
|
65
65
|
camera: cast(
|
|
66
66
|
rio.DatasetReader,
|
|
67
67
|
rio.open(
|
|
@@ -97,6 +97,12 @@ class Level0Product(ProductBase[MetadataLevel0]):
|
|
|
97
97
|
"""Return the datarray for the chosen camera."""
|
|
98
98
|
return self.images[camera]
|
|
99
99
|
|
|
100
|
+
@property
|
|
101
|
+
def images(self) -> dict[str, rio.DatasetReader]:
|
|
102
|
+
if self._images is None:
|
|
103
|
+
raise RuntimeError("Images has been released.")
|
|
104
|
+
return self._images
|
|
105
|
+
|
|
100
106
|
def keys(self) -> list[str]:
|
|
101
107
|
"""Easy access to the camera keys."""
|
|
102
108
|
return list(self.images.keys())
|
|
@@ -230,11 +236,14 @@ class Level0Product(ProductBase[MetadataLevel0]):
|
|
|
230
236
|
"""Explicitely closes the Rasterio DatasetReaders and releases the memory of
|
|
231
237
|
the `images` variable.
|
|
232
238
|
"""
|
|
233
|
-
|
|
234
|
-
self.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
if self._images is not None:
|
|
240
|
+
for k in self._images.keys():
|
|
241
|
+
self._images[k].close()
|
|
242
|
+
|
|
243
|
+
del self._images
|
|
244
|
+
# We know that images are not None as long as somebody doesn't call
|
|
245
|
+
# this function beforehand....
|
|
246
|
+
self._images = None
|
|
238
247
|
|
|
239
248
|
|
|
240
249
|
def generate_level_0_metafile():
|
kuva_reader/reader/level1.py
CHANGED
|
@@ -50,7 +50,7 @@ class Level1ABProduct(ProductBase[MetadataLevel1AB]):
|
|
|
50
50
|
) -> None:
|
|
51
51
|
super().__init__(image_path, metadata, target_ureg)
|
|
52
52
|
|
|
53
|
-
self.
|
|
53
|
+
self._image = cast(
|
|
54
54
|
rio.DatasetReader,
|
|
55
55
|
rio.open(self.image_path / "L1B.tif"),
|
|
56
56
|
)
|
|
@@ -73,6 +73,12 @@ class Level1ABProduct(ProductBase[MetadataLevel1AB]):
|
|
|
73
73
|
else:
|
|
74
74
|
return f"{self.__class__.__name__} loaded from '{self.image_path}'"
|
|
75
75
|
|
|
76
|
+
@property
|
|
77
|
+
def image(self) -> rio.DatasetReader:
|
|
78
|
+
if self._image is None:
|
|
79
|
+
raise RuntimeError("Images has been released.")
|
|
80
|
+
return self._image
|
|
81
|
+
|
|
76
82
|
def footprint(self, crs="") -> Polygon:
|
|
77
83
|
"""The product footprint as a Shapely polygon."""
|
|
78
84
|
return image_footprint(self.image, crs)
|
|
@@ -130,8 +136,10 @@ class Level1ABProduct(ProductBase[MetadataLevel1AB]):
|
|
|
130
136
|
"""Explicitely closes the Rasterio DatasetReader and releases the memory of
|
|
131
137
|
the `image` variable.
|
|
132
138
|
"""
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
if self._image is not None:
|
|
140
|
+
self._image.close()
|
|
141
|
+
del self._image
|
|
142
|
+
self._image = None
|
|
135
143
|
|
|
136
144
|
|
|
137
145
|
class Level1CProduct(ProductBase[MetadataLevel1C]):
|
|
@@ -170,7 +178,7 @@ class Level1CProduct(ProductBase[MetadataLevel1C]):
|
|
|
170
178
|
) -> None:
|
|
171
179
|
super().__init__(image_path, metadata, target_ureg)
|
|
172
180
|
|
|
173
|
-
self.
|
|
181
|
+
self._image = cast(
|
|
174
182
|
rio.DatasetReader,
|
|
175
183
|
rio.open(self.image_path / "L1C.tif"),
|
|
176
184
|
)
|
|
@@ -193,6 +201,12 @@ class Level1CProduct(ProductBase[MetadataLevel1C]):
|
|
|
193
201
|
else:
|
|
194
202
|
return f"{self.__class__.__name__} loaded from '{self.image_path}'"
|
|
195
203
|
|
|
204
|
+
@property
|
|
205
|
+
def image(self) -> rio.DatasetReader:
|
|
206
|
+
if self._image is None:
|
|
207
|
+
raise RuntimeError("Images has been released.")
|
|
208
|
+
return self._image
|
|
209
|
+
|
|
196
210
|
def footprint(self, crs="") -> Polygon:
|
|
197
211
|
"""The product footprint as a Shapely polygon."""
|
|
198
212
|
return image_footprint(self.image, crs)
|
|
@@ -231,9 +245,10 @@ class Level1CProduct(ProductBase[MetadataLevel1C]):
|
|
|
231
245
|
"""Explicitely closes the Rasterio DatasetReader and releases the memory of
|
|
232
246
|
the `image` variable.
|
|
233
247
|
"""
|
|
234
|
-
self.
|
|
235
|
-
|
|
236
|
-
|
|
248
|
+
if self._image is not None:
|
|
249
|
+
self._image.close()
|
|
250
|
+
del self._image
|
|
251
|
+
self._image = None
|
|
237
252
|
|
|
238
253
|
|
|
239
254
|
def generate_level_1_metafile():
|
|
@@ -35,7 +35,7 @@ class ProductBase(Generic[TMetadata], metaclass=ABCMeta):
|
|
|
35
35
|
def __init__(
|
|
36
36
|
self,
|
|
37
37
|
image_path: Path,
|
|
38
|
-
metadata:
|
|
38
|
+
metadata: TMetadata | None = None,
|
|
39
39
|
target_ureg: UnitRegistry | None = None,
|
|
40
40
|
):
|
|
41
41
|
self.image_path = Path(image_path)
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: kuva-reader
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: Manipulate the Kuva Space image and metadata formats
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Requires-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Requires-Dist: kuva-geometry (>=1.0.1,<2.0.0)
|
|
15
|
-
Requires-Dist: kuva-metadata (>=1.1.1,<2.0.0)
|
|
16
|
-
Requires-Dist: numpy (>=1.26.4,<2.0.0)
|
|
17
|
-
Requires-Dist: numpy-quaternion (>=2022.4.4,<2023.0.0)
|
|
18
|
-
Requires-Dist: pint (>=0.22,<0.23)
|
|
19
|
-
Requires-Dist: rasterio (>=1.4.1,<2.0.0)
|
|
5
|
+
Author-email: Guillem Ballesteros <guillem@kuvaspace.com>, Lennert Antson <lennert.antson@kuvaspace.com>, Arthur Vandenhoeke <arthur.vandenhoeke@kuvaspace.com>, Olli Eloranta <olli.eloranta@kuvaspace.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: <=3.13,>=3.10
|
|
8
|
+
Requires-Dist: kuva-geometry<2.0.0,>=1.0.1
|
|
9
|
+
Requires-Dist: kuva-metadata<2.0.0,>=1.1.1
|
|
10
|
+
Requires-Dist: numpy-quaternion>=2023.4.4
|
|
11
|
+
Requires-Dist: numpy>=1.26.4
|
|
12
|
+
Requires-Dist: pint<1.0.0,>=0.22
|
|
13
|
+
Requires-Dist: rasterio<2,>=1.4.3
|
|
20
14
|
Description-Content-Type: text/markdown
|
|
21
15
|
|
|
22
16
|
<div align="center">
|
|
@@ -128,4 +122,3 @@ The `kuva-reader` project software is under the [MIT license](https://github.com
|
|
|
128
122
|
# Status of unit tests
|
|
129
123
|
|
|
130
124
|
[](https://github.com/KuvaSpace/kuva-data-processing/actions/workflows/test-kuva-reader.yml)
|
|
131
|
-
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
kuva_reader/__init__.py,sha256=7OSXrTPW3RTjctJZqyGTekuHRb_5aQNJaG_c-KFac_s,1389
|
|
2
|
+
kuva_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
kuva_reader/reader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
kuva_reader/reader/image.py,sha256=rqzs5C7nzRArFfVepydRUECd3u55McTZlKINg76nMX4,785
|
|
5
|
+
kuva_reader/reader/level0.py,sha256=hzCmRhWTAn4bERZTH45ArYJwaiN0RZjVxXVhcKGs_dI,9723
|
|
6
|
+
kuva_reader/reader/level1.py,sha256=7d9_dxelf36MHX0v7S7c1clQgKrK_2DDWt86DG3kZ3A,8838
|
|
7
|
+
kuva_reader/reader/level2.py,sha256=kGd-6qTZXiNWuYwwLf_-UWS0Oeng8iTpeQFXtAfyPXA,4106
|
|
8
|
+
kuva_reader/reader/product_base.py,sha256=OuV69tm53j6terSWb7ViXDYkGeK5mWwcbfwIVuZqVg4,4296
|
|
9
|
+
kuva_reader/reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
kuva_reader/reader/read.py,sha256=b5hGFbeJ-7sg-iilSJn29Hcqj4e7kiWT2S0BH2JwcDE,1761
|
|
11
|
+
kuva_reader/reader/utils.py,sha256=oZ1G43nm8lCxzfbdqBs0KhKaXWe_uf-78uBXWvmZigs,1566
|
|
12
|
+
kuva_reader-1.1.2.dist-info/METADATA,sha256=g76kaYKfoamM5MvEcKesRPMUNPAesDMVru4_svvOJUA,4902
|
|
13
|
+
kuva_reader-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
kuva_reader-1.1.2.dist-info/entry_points.txt,sha256=KB_U0ziK5k7o8en_7lMtx3Jb1LRHhp39Wpt5MWbZuB0,152
|
|
15
|
+
kuva_reader-1.1.2.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
kuva_reader/__init__.py,sha256=y0ViXqCoRSWvGPXEUFP9TOohcJIS24-WIarkZrDgcKs,1389
|
|
2
|
-
kuva_reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
kuva_reader/reader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
kuva_reader/reader/image.py,sha256=rqzs5C7nzRArFfVepydRUECd3u55McTZlKINg76nMX4,785
|
|
5
|
-
kuva_reader/reader/level0.py,sha256=u61sKRXmx4uljlnqPfuLdtdEGfkw5NdtiR9N6XfUsrA,9352
|
|
6
|
-
kuva_reader/reader/level1.py,sha256=HRvhSasDEzB03qJi6wrQiv-r9kSdWITuWIf-2IbYqX4,8355
|
|
7
|
-
kuva_reader/reader/level2.py,sha256=kGd-6qTZXiNWuYwwLf_-UWS0Oeng8iTpeQFXtAfyPXA,4106
|
|
8
|
-
kuva_reader/reader/product_base.py,sha256=4NpZQk3FvSPsN2kKde8lHJA_0Wwy6DQBMfOh4ItlO00,4299
|
|
9
|
-
kuva_reader/reader/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
kuva_reader/reader/read.py,sha256=b5hGFbeJ-7sg-iilSJn29Hcqj4e7kiWT2S0BH2JwcDE,1761
|
|
11
|
-
kuva_reader/reader/utils.py,sha256=oZ1G43nm8lCxzfbdqBs0KhKaXWe_uf-78uBXWvmZigs,1566
|
|
12
|
-
kuva_reader-1.1.1.dist-info/METADATA,sha256=RPbtVfnAl3B3uZ2gKpMJUj40CSAQuLKkqvWQ0vEnCZ0,5041
|
|
13
|
-
kuva_reader-1.1.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
14
|
-
kuva_reader-1.1.1.dist-info/entry_points.txt,sha256=YJysY9EChfOb1W_IEht2oE5Z8Y9jA0J6-kofaPv-NdI,149
|
|
15
|
-
kuva_reader-1.1.1.dist-info/RECORD,,
|