yirgacheffe 1.2.0__tar.gz → 1.2.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.

Files changed (51) hide show
  1. {yirgacheffe-1.2.0/yirgacheffe.egg-info → yirgacheffe-1.2.1}/PKG-INFO +2 -1
  2. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/README.md +1 -0
  3. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/pyproject.toml +1 -1
  4. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_operators.py +28 -0
  5. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/backends/enumeration.py +1 -0
  6. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/backends/mlx.py +2 -0
  7. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/backends/numpy.py +2 -0
  8. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/operators.py +8 -0
  9. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1/yirgacheffe.egg-info}/PKG-INFO +2 -1
  10. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/LICENSE +0 -0
  11. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/MANIFEST.in +0 -0
  12. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/setup.cfg +0 -0
  13. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_area.py +0 -0
  14. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_auto_windowing.py +0 -0
  15. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_base.py +0 -0
  16. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_group.py +0 -0
  17. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_h3layer.py +0 -0
  18. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_intersection.py +0 -0
  19. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_multiband.py +0 -0
  20. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_optimisation.py +0 -0
  21. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_parallel_operators.py +0 -0
  22. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_pickle.py +0 -0
  23. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_raster.py +0 -0
  24. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_rescaling.py +0 -0
  25. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_rounding.py +0 -0
  26. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_save_with_window.py +0 -0
  27. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_sum_with_window.py +0 -0
  28. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_uniform_area_layer.py +0 -0
  29. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_union.py +0 -0
  30. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_vectors.py +0 -0
  31. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/tests/test_window.py +0 -0
  32. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/__init__.py +0 -0
  33. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/backends/__init__.py +0 -0
  34. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/constants.py +0 -0
  35. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/h3layer.py +0 -0
  36. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/__init__.py +0 -0
  37. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/area.py +0 -0
  38. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/base.py +0 -0
  39. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/constant.py +0 -0
  40. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/group.py +0 -0
  41. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/h3layer.py +0 -0
  42. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/rasters.py +0 -0
  43. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/rescaled.py +0 -0
  44. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/layers/vectors.py +0 -0
  45. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/rounding.py +0 -0
  46. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe/window.py +0 -0
  47. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe.egg-info/SOURCES.txt +0 -0
  48. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe.egg-info/dependency_links.txt +0 -0
  49. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe.egg-info/entry_points.txt +0 -0
  50. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe.egg-info/requires.txt +0 -0
  51. {yirgacheffe-1.2.0 → yirgacheffe-1.2.1}/yirgacheffe.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yirgacheffe
3
- Version: 1.2.0
3
+ Version: 1.2.1
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
@@ -295,6 +295,7 @@ with RasterLayer.layer_from_file('test1.tif') as layer1:
295
295
 
296
296
  The following math operators common to numpy and other libraries are currently supported:
297
297
 
298
+ * abs
298
299
  * clip
299
300
  * exp
300
301
  * exp2
@@ -271,6 +271,7 @@ with RasterLayer.layer_from_file('test1.tif') as layer1:
271
271
 
272
272
  The following math operators common to numpy and other libraries are currently supported:
273
273
 
274
+ * abs
274
275
  * clip
275
276
  * exp
276
277
  * exp2
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "yirgacheffe"
9
- version = "1.2.0"
9
+ version = "1.2.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" }]
@@ -1197,6 +1197,34 @@ def test_clip_lower_module() -> None:
1197
1197
  actual = result.read_array(0, 0, 4, 2)
1198
1198
  assert (expected == actual).all()
1199
1199
 
1200
+ def test_abs_method() -> None:
1201
+ data1 = np.array([[1.0, 2.0, 3.0, 4.0], [-1.0, -2.0, -3.0, -4.0]])
1202
+ layer1 = RasterLayer(gdal_dataset_with_data((0.0, 0.0), 0.02, data1))
1203
+ result = RasterLayer.empty_raster_layer_like(layer1)
1204
+
1205
+ comp = layer1.abs()
1206
+ comp.save(result)
1207
+
1208
+ expected = backend.abs_op(backend.promote(data1))
1209
+ backend.eval_op(expected)
1210
+
1211
+ actual = result.read_array(0, 0, 4, 2)
1212
+ assert (expected == actual).all()
1213
+
1214
+ def test_abs_module() -> None:
1215
+ data1 = np.array([[1.0, 2.0, 3.0, 4.0], [-1.0, -2.0, -3.0, -4.0]])
1216
+ layer1 = RasterLayer(gdal_dataset_with_data((0.0, 0.0), 0.02, data1))
1217
+ result = RasterLayer.empty_raster_layer_like(layer1)
1218
+
1219
+ comp = LayerOperation.abs(layer1)
1220
+ comp.save(result)
1221
+
1222
+ expected = backend.abs_op(backend.promote(data1))
1223
+ backend.eval_op(expected)
1224
+
1225
+ actual = result.read_array(0, 0, 4, 2)
1226
+ assert (expected == actual).all()
1227
+
1200
1228
  @pytest.mark.parametrize("skip", [
1201
1229
  1,
1202
1230
  2,
@@ -31,3 +31,4 @@ class operators(Enum):
31
31
  REMAINDER = 28
32
32
  FLOORDIV = 29
33
33
  CONV2D = 30
34
+ ABS = 31
@@ -43,6 +43,7 @@ full = mx.full
43
43
  allclose = mx.allclose
44
44
  remainder_op = mx.remainder
45
45
  floordiv_op = mx.array.__floordiv__
46
+ abs_op = mx.abs
46
47
 
47
48
  def sum_op(a):
48
49
  # There are weird issues around how MLX overflows int8, so just promote the data ahead of summing
@@ -153,4 +154,5 @@ operator_map = {
153
154
  op.REMAINDER: mx.remainder,
154
155
  op.FLOORDIV: mx.array.__floordiv__,
155
156
  op.CONV2D: conv2d_op,
157
+ op.ABS: mx.abs,
156
158
  }
@@ -46,6 +46,7 @@ full = np.full
46
46
  allclose = np.allclose
47
47
  remainder_op = np.ndarray.__mod__
48
48
  floordiv_op = np.ndarray.__floordiv__
49
+ abs_op = np.abs
49
50
 
50
51
  def conv2d_op(data, weights):
51
52
  # torch wants to process dimensions of channels of width of height
@@ -90,6 +91,7 @@ operator_map = {
90
91
  op.REMAINDER: np.ndarray.__mod__,
91
92
  op.FLOORDIV: np.ndarray.__floordiv__,
92
93
  op.CONV2D: conv2d_op,
94
+ op.ABS: np.abs,
93
95
  }
94
96
 
95
97
  operator_str_map = {
@@ -112,6 +112,13 @@ class LayerMathMixin:
112
112
  test_elements=test_elements,
113
113
  )
114
114
 
115
+ def abs(self):
116
+ return LayerOperation(
117
+ self,
118
+ op.ABS,
119
+ window_op=WindowOperation.NONE,
120
+ )
121
+
115
122
  def log(self):
116
123
  return LayerOperation(
117
124
  self,
@@ -736,3 +743,4 @@ exp = LayerOperation.exp
736
743
  exp2 = LayerOperation.exp2
737
744
  nan_to_num = LayerOperation.nan_to_num
738
745
  isin = LayerOperation.isin
746
+ abs = LayerOperation.abs # pylint: disable=W0622
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yirgacheffe
3
- Version: 1.2.0
3
+ Version: 1.2.1
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
@@ -295,6 +295,7 @@ with RasterLayer.layer_from_file('test1.tif') as layer1:
295
295
 
296
296
  The following math operators common to numpy and other libraries are currently supported:
297
297
 
298
+ * abs
298
299
  * clip
299
300
  * exp
300
301
  * exp2
File without changes
File without changes
File without changes