yirgacheffe 1.3.0__tar.gz → 1.3.1__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.
Potentially problematic release.
This version of yirgacheffe might be problematic. Click here for more details.
- {yirgacheffe-1.3.0/yirgacheffe.egg-info → yirgacheffe-1.3.1}/PKG-INFO +1 -1
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/pyproject.toml +1 -1
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_auto_windowing.py +34 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/operators.py +4 -3
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1/yirgacheffe.egg-info}/PKG-INFO +1 -1
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/LICENSE +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/MANIFEST.in +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/README.md +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/setup.cfg +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_area.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_base.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_datatypes.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_group.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_h3layer.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_intersection.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_multiband.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_operators.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_optimisation.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_parallel_operators.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_pickle.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_raster.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_rescaling.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_rounding.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_save_with_window.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_sum_with_window.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_uniform_area_layer.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_union.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_vectors.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/tests/test_window.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/__init__.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/backends/__init__.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/backends/enumeration.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/backends/mlx.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/backends/numpy.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/constants.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/h3layer.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/__init__.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/area.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/base.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/constant.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/group.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/h3layer.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/rasters.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/rescaled.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/layers/vectors.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/rounding.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe/window.py +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe.egg-info/SOURCES.txt +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe.egg-info/dependency_links.txt +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe.egg-info/entry_points.txt +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe.egg-info/requires.txt +0 -0
- {yirgacheffe-1.3.0 → yirgacheffe-1.3.1}/yirgacheffe.egg-info/top_level.txt +0 -0
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "yirgacheffe"
|
|
9
|
-
version = "1.3.
|
|
9
|
+
version = "1.3.1"
|
|
10
10
|
description = "Abstraction of gdal datasets for doing basic math operations"
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
authors = [{ name = "Michael Dales", email = "mwd24@cam.ac.uk" }]
|
|
@@ -2,7 +2,9 @@ import os
|
|
|
2
2
|
import tempfile
|
|
3
3
|
|
|
4
4
|
import numpy as np
|
|
5
|
+
import pytest
|
|
5
6
|
|
|
7
|
+
import yirgacheffe
|
|
6
8
|
from helpers import gdal_dataset_with_data, make_vectors_with_mutlile_ids
|
|
7
9
|
from yirgacheffe.layers import ConstantLayer, RasterLayer, VectorLayer, area
|
|
8
10
|
from yirgacheffe.window import Area
|
|
@@ -248,3 +250,35 @@ def test_vector_layers_multiply() -> None:
|
|
|
248
250
|
|
|
249
251
|
expected = np.array([[2, 0], [0, 8]])
|
|
250
252
|
assert (expected == actual).all()
|
|
253
|
+
|
|
254
|
+
@pytest.mark.skipif(yirgacheffe.backends.BACKEND != "NUMPY", reason="Only applies for numpy")
|
|
255
|
+
def test_parallel_save_windows() -> None:
|
|
256
|
+
data1 = np.array([[1, 2], [3, 4]])
|
|
257
|
+
data2 = np.array([[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160]])
|
|
258
|
+
|
|
259
|
+
with tempfile.TemporaryDirectory() as tempdir:
|
|
260
|
+
layer1_filename = os.path.join(tempdir, "layer1.tif")
|
|
261
|
+
layer1_dataset = gdal_dataset_with_data((0.0, 0.0), 0.02, data1, filename=layer1_filename)
|
|
262
|
+
layer1_dataset.Close()
|
|
263
|
+
|
|
264
|
+
layer2_filename = os.path.join(tempdir, "layer2.tif")
|
|
265
|
+
layer2_dataset = gdal_dataset_with_data((0.0, 0.0), 0.02, data2, filename=layer2_filename)
|
|
266
|
+
layer2_dataset.Close()
|
|
267
|
+
|
|
268
|
+
layer1 = RasterLayer.layer_from_file(layer1_filename)
|
|
269
|
+
layer2 = RasterLayer.layer_from_file(layer2_filename)
|
|
270
|
+
|
|
271
|
+
assert layer1.area != layer2.area
|
|
272
|
+
assert layer1.window != layer2.window
|
|
273
|
+
|
|
274
|
+
calc = layer1 + layer2
|
|
275
|
+
|
|
276
|
+
assert calc.area == layer2.area
|
|
277
|
+
assert calc.window == layer2.window
|
|
278
|
+
|
|
279
|
+
result = RasterLayer.empty_raster_layer_like(calc)
|
|
280
|
+
calc.parallel_save(result)
|
|
281
|
+
|
|
282
|
+
expected = np.array([[11, 22, 30, 40], [53, 64, 70, 80], [90, 100, 110, 120], [130, 140, 150, 160]])
|
|
283
|
+
actual = result.read_array(0, 0, 4, 4)
|
|
284
|
+
assert (expected == actual).all()
|
|
@@ -529,7 +529,7 @@ class LayerOperation(LayerMathMixin):
|
|
|
529
529
|
|
|
530
530
|
return total if and_sum else None
|
|
531
531
|
|
|
532
|
-
def _parallel_worker(self, index, shared_mem, sem, np_dtype, width, input_queue, output_queue):
|
|
532
|
+
def _parallel_worker(self, index, shared_mem, sem, np_dtype, width, input_queue, output_queue, computation_window):
|
|
533
533
|
arr = np.ndarray((self.ystep, width), dtype=np_dtype, buffer=shared_mem.buf)
|
|
534
534
|
|
|
535
535
|
try:
|
|
@@ -549,7 +549,7 @@ class LayerOperation(LayerMathMixin):
|
|
|
549
549
|
break
|
|
550
550
|
yoffset, step = task
|
|
551
551
|
|
|
552
|
-
result = self._eval(self.area, yoffset, step)
|
|
552
|
+
result = self._eval(self.area, yoffset, step, computation_window)
|
|
553
553
|
backend.eval_op(result)
|
|
554
554
|
|
|
555
555
|
arr[:step] = backend.demote_array(result)
|
|
@@ -650,7 +650,8 @@ class LayerOperation(LayerMathMixin):
|
|
|
650
650
|
np_dtype,
|
|
651
651
|
computation_window.xsize,
|
|
652
652
|
source_queue,
|
|
653
|
-
result_queue
|
|
653
|
+
result_queue,
|
|
654
|
+
computation_window
|
|
654
655
|
)) for i in range(worker_count)]
|
|
655
656
|
for worker in workers:
|
|
656
657
|
worker.start()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|