yirgacheffe 1.7.9__py3-none-any.whl → 1.8.1__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/window.py CHANGED
@@ -3,7 +3,6 @@ import math
3
3
  import sys
4
4
  from collections import namedtuple
5
5
  from dataclasses import dataclass
6
- from typing import List, Optional, Tuple
7
6
 
8
7
  PixelScale = namedtuple('PixelScale', ['xstep', 'ystep'])
9
8
 
@@ -13,23 +12,15 @@ class MapProjection:
13
12
 
14
13
  This superceeeds the old PixelScale class, which will be removed in version 2.0.
15
14
 
16
- Parameters
17
- ----------
18
- name : str
19
- The map projection used.
20
- xstep : float
21
- The number of units horizontal distance a step of one pixel makes in the map projection.
22
- ystep : float
23
- The number of units verticle distance a step of one pixel makes in the map projection.
15
+ Args:
16
+ name: The map projection used.
17
+ xstep: The number of units horizontal distance a step of one pixel makes in the map projection.
18
+ ystep: The number of units vertical distance a step of one pixel makes in the map projection.
24
19
 
25
- Attributes
26
- ----------
27
- name : str
28
- The map projection used.
29
- xstep : float
30
- The number of units horizontal distance a step of one pixel makes in the map projection.
31
- ystep : float
32
- The number of units verticle distance a step of one pixel makes in the map projection.
20
+ Attributes:
21
+ name: The map projection used.
22
+ xstep: The number of units horizontal distance a step of one pixel makes in the map projection.
23
+ ystep: The number of units vertical distance a step of one pixel makes in the map projection.
33
24
  """
34
25
 
35
26
  name : str
@@ -52,27 +43,17 @@ class MapProjection:
52
43
  class Area:
53
44
  """Class to hold a geospatial area of data in the given projection.
54
45
 
55
- Parameters
56
- ----------
57
- left : float
58
- Left most point in the projection space
59
- top : float
60
- Top most point in the projection space
61
- right : float
62
- Right most point in the projection space
63
- bottom : float
64
- Bottom most point in the projection space
65
-
66
- Attributes
67
- ----------
68
- left : float
69
- Left most point in the projection space
70
- top : float
71
- Top most point in the projection space
72
- right : float
73
- Right most point in the projection space
74
- bottom : float
75
- Bottom most point in the projection space
46
+ Args:
47
+ left: Left most point in the projection space.
48
+ top: Top most point in the projection space.
49
+ right: Right most point in the projection space.
50
+ bottom: Bottom most point in the projection space.
51
+
52
+ Attributes:
53
+ left: Left most point in the projection space.
54
+ top: Top most point in the projection space.
55
+ right: Right most point in the projection space.
56
+ bottom: Bottom most point in the projection space.
76
57
  """
77
58
  left: float
78
59
  top: float
@@ -83,9 +64,7 @@ class Area:
83
64
  def world() -> Area:
84
65
  """Creates an area that covers the entire planet.
85
66
 
86
- Returns
87
- -------
88
- Area
67
+ Returns:
89
68
  An area where the extents are nan, but is_world returns true.
90
69
  """
91
70
  return Area(float("nan"), float("nan"), float("nan"), float("nan"))
@@ -93,27 +72,24 @@ class Area:
93
72
  def __hash__(self):
94
73
  return (self.left, self.top, self.right, self.bottom).__hash__()
95
74
 
96
- def __eq__(self, other) -> bool:
75
+ def __eq__(self, other: object) -> bool:
76
+ if not isinstance(other, Area):
77
+ return False
97
78
  return math.isclose(self.left, other.left, abs_tol=1e-09) and \
98
79
  math.isclose(self.right, other.right, abs_tol=1e-09) and \
99
80
  math.isclose(self.top, other.top, abs_tol=1e-09) and \
100
81
  math.isclose(self.bottom, other.bottom, abs_tol=1e-09)
101
82
 
102
- def grow(self, offset: float):
83
+ def grow(self, offset: float) -> Area:
103
84
  """Expand the area in all directions by the given amount.
104
85
 
105
86
  Generates a new area that is an expanded version of the current area.
106
87
 
107
- Parameters
108
- ----------
109
- offset : float
110
- The amount by which to grow the area
88
+ Args:
89
+ offset: The amount by which to grow the area.
111
90
 
112
- Returns
113
- -------
114
- Area
91
+ Returns:
115
92
  A new area of the expanded size.
116
-
117
93
  """
118
94
  return Area(
119
95
  left=self.left - offset,
@@ -124,26 +100,20 @@ class Area:
124
100
 
125
101
  @property
126
102
  def is_world(self) -> bool:
127
- """Returns true if this is a global area, independant of projection.
103
+ """Returns true if this is a global area, independent of projection.
128
104
 
129
- Returns
130
- -------
131
- bool
132
- True is the Area was created with `world` otherwise False.
105
+ Returns:
106
+ True if the Area was created with `world` otherwise False.
133
107
  """
134
108
  return math.isnan(self.left)
135
109
 
136
- def overlaps(self, other) -> bool:
110
+ def overlaps(self, other: Area) -> bool:
137
111
  """Check if this area overlaps with another area.
138
112
 
139
- Parameters
140
- ----------
141
- other : Area
142
- The other area to compare this area with
113
+ Args:
114
+ other: The other area to compare this area with.
143
115
 
144
- Returns
145
- -------
146
- bool
116
+ Returns:
147
117
  True if the two areas intersect, otherwise false.
148
118
  """
149
119
 
@@ -166,27 +136,17 @@ class Area:
166
136
  class Window:
167
137
  """Class to hold the pixel dimensions of data in the given projection.
168
138
 
169
- Parameters
170
- ----------
171
- xoff : int
172
- X axis offset
173
- yoff : int
174
- Y axis offset
175
- xsize : int
176
- Width of data in pixels
177
- ysize : float
178
- Height of data in pixels
179
-
180
- Attributes
181
- ----------
182
- xoff : int
183
- X axis offset
184
- yoff : int
185
- Y axis offset
186
- xsize : int
187
- Width of data in pixels
188
- ysize : float
189
- Height of data in pixels
139
+ Args:
140
+ xoff: X axis offset.
141
+ yoff: Y axis offset.
142
+ xsize: Width of data in pixels.
143
+ ysize: Height of data in pixels.
144
+
145
+ Attributes:
146
+ xoff: X axis offset.
147
+ yoff: Y axis offset.
148
+ xsize: Width of data in pixels.
149
+ ysize: Height of data in pixels.
190
150
  """
191
151
  xoff: int
192
152
  yoff: int
@@ -194,7 +154,7 @@ class Window:
194
154
  ysize: int
195
155
 
196
156
  @property
197
- def as_array_args(self) -> Tuple[int,...]:
157
+ def as_array_args(self) -> tuple[int, ...]:
198
158
  """A tuple containing xoff, yoff, xsize, and ysize."""
199
159
  return (self.xoff, self.yoff, self.xsize, self.ysize)
200
160
 
@@ -230,21 +190,16 @@ class Window:
230
190
  ((self.xoff + self.xsize) >= (other.xoff + other.xsize)) and \
231
191
  ((self.yoff + self.ysize) >= (other.yoff + other.ysize))
232
192
 
233
- def grow(self, pixels: int):
193
+ def grow(self, pixels: int) -> Window:
234
194
  """Expand the area in all directions by the given amount.
235
195
 
236
196
  Generates a new window that is an expanded version of the current window.
237
197
 
238
- Parameters
239
- ----------
240
- pixels : int
241
- The amount by which to grow the window in pixels
198
+ Args:
199
+ pixels: The amount by which to grow the window in pixels.
242
200
 
243
- Returns
244
- -------
245
- Window
201
+ Returns:
246
202
  A new window of the expanded size.
247
-
248
203
  """
249
204
  return Window(
250
205
  xoff=self.xoff - pixels,
@@ -254,7 +209,7 @@ class Window:
254
209
  )
255
210
 
256
211
  @staticmethod
257
- def find_intersection(windows: List) -> "Window":
212
+ def find_intersection(windows: list) -> Window:
258
213
  if not windows:
259
214
  raise ValueError("Expected list of windows")
260
215
  # This isn't very pythonic, as it was originally written, but
@@ -277,7 +232,7 @@ class Window:
277
232
  )
278
233
 
279
234
  @staticmethod
280
- def find_intersection_no_throw(windows: List) -> Optional["Window"]:
235
+ def find_intersection_no_throw(windows: list) -> Window | None:
281
236
  if not windows:
282
237
  raise ValueError("Expected list of windows")
283
238
  # This isn't very pythonic, as it was originally written, but
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yirgacheffe
3
- Version: 1.7.9
3
+ Version: 1.8.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
7
- Project-URL: Homepage, https://github.com/quantifyearth/yirgacheffe
7
+ Project-URL: Homepage, https://yirgacheffe.org/
8
8
  Project-URL: Repository, https://github.com/quantifyearth/yirgacheffe.git
9
9
  Project-URL: Issues, https://github.com/quantifyearth/yirgacheffe/issues
10
- Project-URL: Changelog, https://github.com/quantifyearth/yirgacheffe/blob/main/CHANGES.md
10
+ Project-URL: Changelog, https://yirgacheffe.org/latest/changelog/
11
11
  Keywords: gdal,gis,geospatial,declarative
12
12
  Classifier: Development Status :: 5 - Production/Stable
13
13
  Classifier: Intended Audience :: Science/Research
@@ -36,9 +36,13 @@ Requires-Dist: pytest; extra == "dev"
36
36
  Requires-Dist: pytest-cov; extra == "dev"
37
37
  Requires-Dist: build; extra == "dev"
38
38
  Requires-Dist: twine; extra == "dev"
39
+ Requires-Dist: mkdocs-material; extra == "dev"
40
+ Requires-Dist: mkdocstrings-python; extra == "dev"
41
+ Requires-Dist: mike; extra == "dev"
42
+ Requires-Dist: mkdocs-gen-files; extra == "dev"
39
43
  Dynamic: license-file
40
44
 
41
- # Yirgacheffe: a gdal wrapper that does the tricky bits
45
+ # Yirgacheffe: a declarative geospatial library for Python to make data-science with maps easier
42
46
 
43
47
  ## Overview
44
48
 
@@ -0,0 +1,27 @@
1
+ yirgacheffe/__init__.py,sha256=OOzfXtafPoDpAsNRC08BXjmwv0hBp-mNFCjwplGs9lY,668
2
+ yirgacheffe/_core.py,sha256=AU6tlqovBV_l1dNZs6AlHSw59Z0U6pStUaQZvJGiLhM,5721
3
+ yirgacheffe/_operators.py,sha256=OiR4pCVILmdXDmG37YILJuYjcxZlRussrJC7DeyoOts,36070
4
+ yirgacheffe/constants.py,sha256=uCWJwec3-ND-zVxYbsk1sdHKANl3ToNCTPg7MZb0j2g,434
5
+ yirgacheffe/operators.py,sha256=nw-BpnAwTjCwFtjosa8wKd2MGUuC0PJR5jACFdLhqCg,412
6
+ yirgacheffe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ yirgacheffe/rounding.py,sha256=ZNuAaxsWfzYETC_G9H5weY1ZOci2pihEKTVrUiIqfZw,2257
8
+ yirgacheffe/window.py,sha256=WTCqX4Tw24siD0l13Pxl-GPufiC5M1OwZfhrNmJe_Gg,8986
9
+ yirgacheffe/_backends/__init__.py,sha256=jN-2iRrHStnPI6cNL7XhwhsROtI0EaGfIrbF5c-ECV0,334
10
+ yirgacheffe/_backends/enumeration.py,sha256=9bcCXz9Ssrh8Oh1iazodkx6Gm2kQBi9HQ9z9zehS4AE,1806
11
+ yirgacheffe/_backends/mlx.py,sha256=U1gl1lK1mZXLEET6ylF1TNs6WJ0PBEvfSk7ppn28n8w,6203
12
+ yirgacheffe/_backends/numpy.py,sha256=Gxx49JJH79GFEkKIpV6IyjCUcdtN5-qLlzRfylzKhS4,4142
13
+ yirgacheffe/layers/__init__.py,sha256=mYKjw5YTcMNv_hMy7a6K4yRzIuNUbR8WuBTw4WIAmSk,435
14
+ yirgacheffe/layers/area.py,sha256=wJcMHbLJBaXS4BeFbu5rYeKfgu3gvaE9hwQ5j6aw-y4,3976
15
+ yirgacheffe/layers/base.py,sha256=dQQLFKP05QK4C73N1DCDYT8D8eD15HuSQKN5KrABeHg,14289
16
+ yirgacheffe/layers/constant.py,sha256=gtkQ98Z01CYYDgFElswtRZY4ZG3UnS5NIAoIVue5ufk,1481
17
+ yirgacheffe/layers/group.py,sha256=yaqf-ra_Vh59yrWcz7-OvJ1fBnTcBXZd18AfRDN5Ymo,16157
18
+ yirgacheffe/layers/h3layer.py,sha256=Rq1bFo7CApIh5NdBcV7hSj3hm-DszY79nhYsTRAvJ_g,9916
19
+ yirgacheffe/layers/rasters.py,sha256=zBE9uXm6LvAQF2_XdQzcOgJQOQWGmuPflY5JNDrUf3k,13527
20
+ yirgacheffe/layers/rescaled.py,sha256=gEFbXeYxX1nVn7eQYmbGww90_yc5ENmgQrD_WxXxpQE,3352
21
+ yirgacheffe/layers/vectors.py,sha256=A27kuTr0C9BZhHG0-cplNEa7aSNcse37Pm9xTjEzv-c,19990
22
+ yirgacheffe-1.8.1.dist-info/licenses/LICENSE,sha256=dNSHwUCJr6axStTKDEdnJtfmDdFqlE3h1NPCveqPfnY,757
23
+ yirgacheffe-1.8.1.dist-info/METADATA,sha256=iPbaENoRBTey7wYvg3OUTKjkulgoFS0wcwJoRJ2HcYQ,23797
24
+ yirgacheffe-1.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ yirgacheffe-1.8.1.dist-info/entry_points.txt,sha256=j4KgHXbVGbGyfTySc1ypBdERpfihO4WNjppvCdE9HjE,52
26
+ yirgacheffe-1.8.1.dist-info/top_level.txt,sha256=9DBFlKO2Ld3hG6TuE3qOTd3Tt8ugTiXil4AN4Wr9_y0,12
27
+ yirgacheffe-1.8.1.dist-info/RECORD,,
@@ -1,27 +0,0 @@
1
- yirgacheffe/__init__.py,sha256=pY9dqmHHARfY44T-7-7y6Ah97qQHj9_0pgYTItI5TR8,567
2
- yirgacheffe/_core.py,sha256=hnACrthBI8OFNoi88-Qnj-4aizBGZstFO7kj-5g9MSU,6083
3
- yirgacheffe/_operators.py,sha256=63KZZKTW-Pz0eOBRZUuolWxNNQvPC_sHruAdyo6J5dc,36238
4
- yirgacheffe/constants.py,sha256=uCWJwec3-ND-zVxYbsk1sdHKANl3ToNCTPg7MZb0j2g,434
5
- yirgacheffe/operators.py,sha256=nw-BpnAwTjCwFtjosa8wKd2MGUuC0PJR5jACFdLhqCg,412
6
- yirgacheffe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- yirgacheffe/rounding.py,sha256=ggBG4lMyLMtHLW3dBxr3gBCcF2qhRrY5etZiFGlIoqA,2258
8
- yirgacheffe/window.py,sha256=Oxf8VcslLxNacqjUcDHqZLvdMaTnIwuNwjsm1WEOc0g,9503
9
- yirgacheffe/_backends/__init__.py,sha256=jN-2iRrHStnPI6cNL7XhwhsROtI0EaGfIrbF5c-ECV0,334
10
- yirgacheffe/_backends/enumeration.py,sha256=Jrce2p2n4Wlk5tHBkiWntDnpLSD_0H-bnwgsKXHjkwQ,1018
11
- yirgacheffe/_backends/mlx.py,sha256=6a0S80JCxwiq72hWv-83238NaQykn-vQw_IDRBIBbbw,6173
12
- yirgacheffe/_backends/numpy.py,sha256=N-Ygpw1lgJJI7xGoRJnB480rR0tst75cOIowubGnSjw,4112
13
- yirgacheffe/layers/__init__.py,sha256=mYKjw5YTcMNv_hMy7a6K4yRzIuNUbR8WuBTw4WIAmSk,435
14
- yirgacheffe/layers/area.py,sha256=LeLSinB-z2k4ODSfiNJvQnSnMfa8Gn7VnkJrLt50zVU,3970
15
- yirgacheffe/layers/base.py,sha256=-7QIfAI3iGlzt-dDLztpRaLrL2sSqB1y2Yw2TdJ9VJM,14426
16
- yirgacheffe/layers/constant.py,sha256=8wfyw1JOxr5FQv_M9Jzbd6vW2rjK3AJHmoe-ftDmPlM,1457
17
- yirgacheffe/layers/group.py,sha256=hK84oCAweaX2eQP0DXPd_uHj1aVdTD9F-gaCRPfjxmY,16202
18
- yirgacheffe/layers/h3layer.py,sha256=t8yC3c8pXU5qbFqsfP76ZX8UHkW9lK4ZgnNm4pwTjls,9886
19
- yirgacheffe/layers/rasters.py,sha256=M2DG5-UPbhKsCHL5B2LDncqgb7VP6yzeDfXv_U6EaZo,13610
20
- yirgacheffe/layers/rescaled.py,sha256=jbr2GxFy3I29vudX0oyMaFRTimrbEcAPI6dnHvjWpfU,3377
21
- yirgacheffe/layers/vectors.py,sha256=c8QWeKF1umBGo5BYyJPl-CN_EfjxdTGNaQJDfAkvTIM,20139
22
- yirgacheffe-1.7.9.dist-info/licenses/LICENSE,sha256=dNSHwUCJr6axStTKDEdnJtfmDdFqlE3h1NPCveqPfnY,757
23
- yirgacheffe-1.7.9.dist-info/METADATA,sha256=cfrQwtndmOW5MTb28UoWG73U-1j4ufa1SyqoLACr2SA,23618
24
- yirgacheffe-1.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- yirgacheffe-1.7.9.dist-info/entry_points.txt,sha256=j4KgHXbVGbGyfTySc1ypBdERpfihO4WNjppvCdE9HjE,52
26
- yirgacheffe-1.7.9.dist-info/top_level.txt,sha256=9DBFlKO2Ld3hG6TuE3qOTd3Tt8ugTiXil4AN4Wr9_y0,12
27
- yirgacheffe-1.7.9.dist-info/RECORD,,