yirgacheffe 1.9.1__py3-none-any.whl → 1.9.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 yirgacheffe might be problematic. Click here for more details.
- yirgacheffe/_operators.py +53 -0
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/METADATA +3 -1
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/RECORD +7 -7
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/WHEEL +0 -0
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/entry_points.txt +0 -0
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/licenses/LICENSE +0 -0
- {yirgacheffe-1.9.1.dist-info → yirgacheffe-1.9.2.dist-info}/top_level.txt +0 -0
yirgacheffe/_operators.py
CHANGED
|
@@ -339,6 +339,55 @@ class LayerMathMixin:
|
|
|
339
339
|
round_down_pixels((y - area.top) / pixel_scale.ystep, builtins.abs(pixel_scale.ystep)),
|
|
340
340
|
)
|
|
341
341
|
|
|
342
|
+
@property
|
|
343
|
+
def window(self) -> Window:
|
|
344
|
+
raise NotImplementedError("Must be overridden by subclass")
|
|
345
|
+
|
|
346
|
+
@property
|
|
347
|
+
def area(self) -> Area:
|
|
348
|
+
raise NotImplementedError("Must be overridden by subclass")
|
|
349
|
+
|
|
350
|
+
def read_array(self, _x, _y, _w, _h):
|
|
351
|
+
raise NotImplementedError("Must be overridden by subclass")
|
|
352
|
+
|
|
353
|
+
def show(self, ax=None, max_pixels: int | None =1000, **kwargs):
|
|
354
|
+
"""Display data using matplotlib.
|
|
355
|
+
|
|
356
|
+
Args:
|
|
357
|
+
ax: Matplotlib axes object. If not provided, the default matplotlib context will be used.
|
|
358
|
+
max_pixels: How many pixels to downsample to. If None, raw pixels will be used.
|
|
359
|
+
**kwargs: Passed to matplotlib imshow.
|
|
360
|
+
|
|
361
|
+
Returns:
|
|
362
|
+
A matplotlib image.
|
|
363
|
+
"""
|
|
364
|
+
import matplotlib.pyplot as plt # pylint: disable=C0415
|
|
365
|
+
|
|
366
|
+
if ax is None:
|
|
367
|
+
ax = plt.gca()
|
|
368
|
+
|
|
369
|
+
window = self.window
|
|
370
|
+
|
|
371
|
+
raw_data = self.read_array(
|
|
372
|
+
0,
|
|
373
|
+
0,
|
|
374
|
+
window.xsize,
|
|
375
|
+
window.ysize
|
|
376
|
+
)
|
|
377
|
+
if max_pixels:
|
|
378
|
+
downsample = max(window.xsize, window.ysize) // max_pixels
|
|
379
|
+
data = raw_data[::downsample,::downsample]
|
|
380
|
+
else:
|
|
381
|
+
data = raw_data
|
|
382
|
+
area = self.area
|
|
383
|
+
extent = [
|
|
384
|
+
area.left,
|
|
385
|
+
area.right,
|
|
386
|
+
area.bottom,
|
|
387
|
+
area.top,
|
|
388
|
+
]
|
|
389
|
+
return ax.imshow(data, extent=extent, **kwargs)
|
|
390
|
+
|
|
342
391
|
|
|
343
392
|
class LayerOperation(LayerMathMixin):
|
|
344
393
|
|
|
@@ -383,6 +432,7 @@ class LayerOperation(LayerMathMixin):
|
|
|
383
432
|
self.kwargs = kwargs
|
|
384
433
|
self.window_op = window_op
|
|
385
434
|
self.buffer_padding = buffer_padding
|
|
435
|
+
self._forced_area = None
|
|
386
436
|
|
|
387
437
|
if lhs is None:
|
|
388
438
|
raise ValueError("LHS on operation should not be none")
|
|
@@ -450,6 +500,9 @@ class LayerOperation(LayerMathMixin):
|
|
|
450
500
|
return self._get_operation_area(self.map_projection)
|
|
451
501
|
|
|
452
502
|
def _get_operation_area(self, projection: MapProjection | None) -> Area:
|
|
503
|
+
if self._forced_area is not None:
|
|
504
|
+
return self._forced_area
|
|
505
|
+
|
|
453
506
|
lhs_area = self.lhs._get_operation_area(projection)
|
|
454
507
|
try:
|
|
455
508
|
rhs_area = self.rhs._get_operation_area(projection)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yirgacheffe
|
|
3
|
-
Version: 1.9.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: Abstraction of gdal datasets for doing basic math operations
|
|
5
5
|
Author-email: Michael Dales <mwd24@cam.ac.uk>
|
|
6
6
|
License-Expression: ISC
|
|
@@ -30,6 +30,8 @@ Requires-Dist: h3
|
|
|
30
30
|
Requires-Dist: pyproj
|
|
31
31
|
Provides-Extra: mlx
|
|
32
32
|
Requires-Dist: mlx; extra == "mlx"
|
|
33
|
+
Provides-Extra: matplotlib
|
|
34
|
+
Requires-Dist: matplotlib; extra == "matplotlib"
|
|
33
35
|
Provides-Extra: dev
|
|
34
36
|
Requires-Dist: mypy; extra == "dev"
|
|
35
37
|
Requires-Dist: pylint; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
yirgacheffe/__init__.py,sha256=OOzfXtafPoDpAsNRC08BXjmwv0hBp-mNFCjwplGs9lY,668
|
|
2
2
|
yirgacheffe/_core.py,sha256=AU6tlqovBV_l1dNZs6AlHSw59Z0U6pStUaQZvJGiLhM,5721
|
|
3
|
-
yirgacheffe/_operators.py,sha256=
|
|
3
|
+
yirgacheffe/_operators.py,sha256=DjwWEGStNyliNeXNySe7SUjuouxsEUtZnpMKeZp0iJg,41208
|
|
4
4
|
yirgacheffe/constants.py,sha256=bKUjOGNj19zwggV79lJgK7tiv51DH2-rgNOKswl2gvQ,293
|
|
5
5
|
yirgacheffe/operators.py,sha256=nw-BpnAwTjCwFtjosa8wKd2MGUuC0PJR5jACFdLhqCg,412
|
|
6
6
|
yirgacheffe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -19,9 +19,9 @@ yirgacheffe/layers/h3layer.py,sha256=Rq1bFo7CApIh5NdBcV7hSj3hm-DszY79nhYsTRAvJ_g
|
|
|
19
19
|
yirgacheffe/layers/rasters.py,sha256=zBE9uXm6LvAQF2_XdQzcOgJQOQWGmuPflY5JNDrUf3k,13527
|
|
20
20
|
yirgacheffe/layers/rescaled.py,sha256=gEFbXeYxX1nVn7eQYmbGww90_yc5ENmgQrD_WxXxpQE,3352
|
|
21
21
|
yirgacheffe/layers/vectors.py,sha256=A27kuTr0C9BZhHG0-cplNEa7aSNcse37Pm9xTjEzv-c,19990
|
|
22
|
-
yirgacheffe-1.9.
|
|
23
|
-
yirgacheffe-1.9.
|
|
24
|
-
yirgacheffe-1.9.
|
|
25
|
-
yirgacheffe-1.9.
|
|
26
|
-
yirgacheffe-1.9.
|
|
27
|
-
yirgacheffe-1.9.
|
|
22
|
+
yirgacheffe-1.9.2.dist-info/licenses/LICENSE,sha256=dNSHwUCJr6axStTKDEdnJtfmDdFqlE3h1NPCveqPfnY,757
|
|
23
|
+
yirgacheffe-1.9.2.dist-info/METADATA,sha256=dtcXyXfgUIXRNPseIm3AT7KxJQLzlflciYzic9t4zX0,24262
|
|
24
|
+
yirgacheffe-1.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
yirgacheffe-1.9.2.dist-info/entry_points.txt,sha256=j4KgHXbVGbGyfTySc1ypBdERpfihO4WNjppvCdE9HjE,52
|
|
26
|
+
yirgacheffe-1.9.2.dist-info/top_level.txt,sha256=9DBFlKO2Ld3hG6TuE3qOTd3Tt8ugTiXil4AN4Wr9_y0,12
|
|
27
|
+
yirgacheffe-1.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|