yirgacheffe 1.7.3__tar.gz → 1.7.4__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.7.3/yirgacheffe.egg-info → yirgacheffe-1.7.4}/PKG-INFO +4 -1
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/pyproject.toml +4 -1
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_nodata.py +28 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_operators.py +12 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/_backends/enumeration.py +1 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/_backends/mlx.py +2 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/_backends/numpy.py +2 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/group.py +4 -3
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/operators.py +7 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4/yirgacheffe.egg-info}/PKG-INFO +4 -1
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/LICENSE +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/MANIFEST.in +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/README.md +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/setup.cfg +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_area.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_auto_windowing.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_base.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_constants.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_datatypes.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_group.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_h3layer.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_intersection.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_multiband.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_openers.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_optimisation.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_parallel_operators.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_pickle.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_projection.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_raster.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_rescaling.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_rounding.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_save_with_window.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_sum_with_window.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_uniform_area_layer.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_union.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_vectors.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/tests/test_window.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/__init__.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/_backends/__init__.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/_core.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/constants.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/__init__.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/area.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/base.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/constant.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/h3layer.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/rasters.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/rescaled.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/layers/vectors.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/rounding.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe/window.py +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe.egg-info/SOURCES.txt +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe.egg-info/dependency_links.txt +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe.egg-info/entry_points.txt +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe.egg-info/requires.txt +0 -0
- {yirgacheffe-1.7.3 → yirgacheffe-1.7.4}/yirgacheffe.egg-info/top_level.txt +0 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yirgacheffe
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.4
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/quantifyearth/yirgacheffe
|
|
8
|
+
Project-URL: Repository, https://github.com/quantifyearth/yirgacheffe.git
|
|
9
|
+
Project-URL: Issues, https://github.com/quantifyearth/yirgacheffe/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/quantifyearth/yirgacheffe/blob/main/CHANGES.md
|
|
8
11
|
Keywords: gdal,numpy,math
|
|
9
12
|
Requires-Python: >=3.10
|
|
10
13
|
Description-Content-Type: text/markdown
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "yirgacheffe"
|
|
9
|
-
version = "1.7.
|
|
9
|
+
version = "1.7.4"
|
|
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" }]
|
|
@@ -28,6 +28,9 @@ dev = ["mypy", "pylint", "pytest", "h3", "pytest-cov", "mlx"]
|
|
|
28
28
|
|
|
29
29
|
[project.urls]
|
|
30
30
|
Homepage = "https://github.com/quantifyearth/yirgacheffe"
|
|
31
|
+
Repository = "https://github.com/quantifyearth/yirgacheffe.git"
|
|
32
|
+
Issues = "https://github.com/quantifyearth/yirgacheffe/issues"
|
|
33
|
+
Changelog = "https://github.com/quantifyearth/yirgacheffe/blob/main/CHANGES.md"
|
|
31
34
|
|
|
32
35
|
[project.scripts]
|
|
33
36
|
realpython = "reader.__main__:main"
|
|
@@ -62,3 +62,31 @@ def test_group_layer_with_nodata_values_ignore_nodata() -> None:
|
|
|
62
62
|
with GroupLayer([layer1, layer2]) as group:
|
|
63
63
|
actual = group.read_array(0, 0, 4, 2)
|
|
64
64
|
assert np.array_equal(data1, actual, equal_nan=True)
|
|
65
|
+
|
|
66
|
+
def test_group_layer_with_nodata_read_from_empty_area() -> None:
|
|
67
|
+
data1 = np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 5.0, 5.0, 5.0]])
|
|
68
|
+
dataset1 = gdal_dataset_with_data((0.0, 10.0), 1.0, data1)
|
|
69
|
+
dataset1.GetRasterBand(1).SetNoDataValue(5.0)
|
|
70
|
+
|
|
71
|
+
data2 = np.array([[1.0, 1.0, 1.0, 1.0], [5.0, 6.0, 7.0, 8.0]])
|
|
72
|
+
dataset2 = gdal_dataset_with_data((0.0, -8.0), 1.0, data2)
|
|
73
|
+
dataset2.GetRasterBand(1).SetNoDataValue(1.0)
|
|
74
|
+
|
|
75
|
+
with RasterLayer(dataset1) as layer1:
|
|
76
|
+
with RasterLayer(dataset2) as layer2:
|
|
77
|
+
with GroupLayer([layer1, layer2]) as group:
|
|
78
|
+
|
|
79
|
+
assert group.window.xsize == 4
|
|
80
|
+
assert group.window.ysize == 20
|
|
81
|
+
|
|
82
|
+
actual = group.read_array(0, 0, 4, 2)
|
|
83
|
+
expected = np.array([[1.0, 2.0, 3.0, 4.0], [0.0, 0.0, 0.0, 0.0]])
|
|
84
|
+
assert np.array_equal(expected, actual, equal_nan=True)
|
|
85
|
+
|
|
86
|
+
actual = group.read_array(0, 10, 4, 2)
|
|
87
|
+
expected = np.array([[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]])
|
|
88
|
+
assert np.array_equal(expected, actual, equal_nan=True)
|
|
89
|
+
|
|
90
|
+
actual = group.read_array(0, 18, 4, 2)
|
|
91
|
+
expected = np.array([[0.0, 0.0, 0.0, 0.0], [5.0, 6.0, 7.0, 8.0]])
|
|
92
|
+
assert np.array_equal(expected, actual, equal_nan=True)
|
|
@@ -1567,3 +1567,15 @@ def test_raster_and_vector_no_scale_on_vector() -> None:
|
|
|
1567
1567
|
calc = raster * vector
|
|
1568
1568
|
assert calc.sum() > 0.0
|
|
1569
1569
|
assert calc.sum() < raster.sum()
|
|
1570
|
+
|
|
1571
|
+
def test_isnan() -> None:
|
|
1572
|
+
data1 = np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 5.0, 8.0]])
|
|
1573
|
+
dataset = gdal_dataset_with_data((0.0, 0.0), 0.02, data1)
|
|
1574
|
+
dataset.GetRasterBand(1).SetNoDataValue(5.0)
|
|
1575
|
+
with RasterLayer(dataset) as layer:
|
|
1576
|
+
calc = layer.isnan()
|
|
1577
|
+
with RasterLayer.empty_raster_layer_like(calc) as result:
|
|
1578
|
+
calc.save(result)
|
|
1579
|
+
actual = result.read_array(0, 0, 4, 2)
|
|
1580
|
+
expected = data1 == 5.0
|
|
1581
|
+
assert (expected == actual).all()
|
|
@@ -40,6 +40,7 @@ maximum = mx.maximum
|
|
|
40
40
|
minimum = mx.minimum
|
|
41
41
|
zeros = mx.zeros
|
|
42
42
|
pad = mx.pad
|
|
43
|
+
isnan = mx.isnan
|
|
43
44
|
isscalar = np.isscalar
|
|
44
45
|
full = mx.full
|
|
45
46
|
allclose = mx.allclose
|
|
@@ -218,4 +219,5 @@ operator_map : Dict[op,Callable] = {
|
|
|
218
219
|
op.FLOOR: mx.floor,
|
|
219
220
|
op.ROUND: mx.round,
|
|
220
221
|
op.CEIL: mx.ceil,
|
|
222
|
+
op.ISNAN: mx.isnan,
|
|
221
223
|
}
|
|
@@ -43,6 +43,7 @@ minimum = np.minimum
|
|
|
43
43
|
zeros = np.zeros
|
|
44
44
|
pad = np.pad
|
|
45
45
|
sum_op = lambda a: np.sum(a.astype(np.float64))
|
|
46
|
+
isnan = np.isnan
|
|
46
47
|
isscalar = np.isscalar
|
|
47
48
|
full = np.full
|
|
48
49
|
allclose = np.allclose
|
|
@@ -156,4 +157,5 @@ operator_map : Dict[op,Callable] = {
|
|
|
156
157
|
op.FLOOR: np.floor,
|
|
157
158
|
op.ROUND: np.round,
|
|
158
159
|
op.CEIL: np.ceil,
|
|
160
|
+
op.ISNAN: np.isnan,
|
|
159
161
|
}
|
|
@@ -114,8 +114,9 @@ class GroupLayer(YirgacheffeLayer):
|
|
|
114
114
|
if (xsize <= 0) or (ysize <= 0):
|
|
115
115
|
raise ValueError("Request dimensions must be positive and non-zero")
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
assert
|
|
117
|
+
map_projection = self.map_projection
|
|
118
|
+
assert map_projection is not None
|
|
119
|
+
scale = map_projection.scale
|
|
119
120
|
|
|
120
121
|
target_window = Window(
|
|
121
122
|
window.xoff + xoffset,
|
|
@@ -151,7 +152,7 @@ class GroupLayer(YirgacheffeLayer):
|
|
|
151
152
|
intersection.ysize
|
|
152
153
|
)
|
|
153
154
|
if layer.nodata is not None:
|
|
154
|
-
data
|
|
155
|
+
data = backend.where(backend.isnan(data), 0.0, data)
|
|
155
156
|
return data
|
|
156
157
|
|
|
157
158
|
result = np.zeros((ysize, xsize), dtype=float)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yirgacheffe
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.4
|
|
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
|
|
7
7
|
Project-URL: Homepage, https://github.com/quantifyearth/yirgacheffe
|
|
8
|
+
Project-URL: Repository, https://github.com/quantifyearth/yirgacheffe.git
|
|
9
|
+
Project-URL: Issues, https://github.com/quantifyearth/yirgacheffe/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/quantifyearth/yirgacheffe/blob/main/CHANGES.md
|
|
8
11
|
Keywords: gdal,numpy,math
|
|
9
12
|
Requires-Python: >=3.10
|
|
10
13
|
Description-Content-Type: text/markdown
|
|
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
|