rasterix 0.1a1__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.
- rasterix/__init__.py +15 -0
- rasterix/_version.py +1 -0
- rasterix/raster_index.py +405 -0
- rasterix-0.1a1.dist-info/METADATA +26 -0
- rasterix-0.1a1.dist-info/RECORD +8 -0
- rasterix-0.1a1.dist-info/WHEEL +5 -0
- rasterix-0.1a1.dist-info/licenses/LICENSE +191 -0
- rasterix-0.1a1.dist-info/top_level.txt +1 -0
rasterix/__init__.py
ADDED
rasterix/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1a1"
|
rasterix/raster_index.py
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import textwrap
|
|
2
|
+
from collections.abc import Hashable, Mapping
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from affine import Affine
|
|
8
|
+
from xarray import DataArray, Index, Variable
|
|
9
|
+
from xarray.core.coordinate_transform import CoordinateTransform
|
|
10
|
+
|
|
11
|
+
# TODO: import from public API once it is available
|
|
12
|
+
from xarray.core.indexes import CoordinateTransformIndex, PandasIndex
|
|
13
|
+
from xarray.core.indexing import IndexSelResult, merge_sel_results
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class AffineTransform(CoordinateTransform):
|
|
17
|
+
"""Affine 2D transform wrapper."""
|
|
18
|
+
|
|
19
|
+
affine: Affine
|
|
20
|
+
xy_dims: tuple[str, str]
|
|
21
|
+
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
affine: Affine,
|
|
25
|
+
width: int,
|
|
26
|
+
height: int,
|
|
27
|
+
x_coord_name: Hashable = "xc",
|
|
28
|
+
y_coord_name: Hashable = "yc",
|
|
29
|
+
x_dim: str = "x",
|
|
30
|
+
y_dim: str = "y",
|
|
31
|
+
dtype: Any = np.dtype(np.float64),
|
|
32
|
+
):
|
|
33
|
+
super().__init__((x_coord_name, y_coord_name), {x_dim: width, y_dim: height}, dtype=dtype)
|
|
34
|
+
self.affine = affine
|
|
35
|
+
|
|
36
|
+
# array dimensions in reverse order (y = rows, x = cols)
|
|
37
|
+
self.xy_dims = self.dims[0], self.dims[1]
|
|
38
|
+
self.dims = self.dims[1], self.dims[0]
|
|
39
|
+
|
|
40
|
+
def forward(self, dim_positions):
|
|
41
|
+
positions = tuple(dim_positions[dim] for dim in self.xy_dims)
|
|
42
|
+
x_labels, y_labels = self.affine * positions
|
|
43
|
+
|
|
44
|
+
results = {}
|
|
45
|
+
for name, labels in zip(self.coord_names, [x_labels, y_labels]):
|
|
46
|
+
results[name] = labels
|
|
47
|
+
|
|
48
|
+
return results
|
|
49
|
+
|
|
50
|
+
def reverse(self, coord_labels):
|
|
51
|
+
labels = tuple(coord_labels[name] for name in self.coord_names)
|
|
52
|
+
x_positions, y_positions = ~self.affine * labels
|
|
53
|
+
|
|
54
|
+
results = {}
|
|
55
|
+
for dim, positions in zip(self.xy_dims, [x_positions, y_positions]):
|
|
56
|
+
results[dim] = positions
|
|
57
|
+
|
|
58
|
+
return results
|
|
59
|
+
|
|
60
|
+
def equals(self, other):
|
|
61
|
+
if not isinstance(other, AffineTransform):
|
|
62
|
+
return False
|
|
63
|
+
return self.affine == other.affine and self.dim_size == other.dim_size
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class AxisAffineTransform(CoordinateTransform):
|
|
67
|
+
"""Axis-independent wrapper of an affine 2D transform with no skew/rotation."""
|
|
68
|
+
|
|
69
|
+
affine: Affine
|
|
70
|
+
is_xaxis: bool
|
|
71
|
+
coord_name: Hashable
|
|
72
|
+
dim: str
|
|
73
|
+
size: int
|
|
74
|
+
|
|
75
|
+
def __init__(
|
|
76
|
+
self,
|
|
77
|
+
affine: Affine,
|
|
78
|
+
size: int,
|
|
79
|
+
coord_name: Hashable,
|
|
80
|
+
dim: str,
|
|
81
|
+
is_xaxis: bool,
|
|
82
|
+
dtype: Any = np.dtype(np.float64),
|
|
83
|
+
):
|
|
84
|
+
assert affine.is_rectilinear and (affine.b == affine.d == 0)
|
|
85
|
+
|
|
86
|
+
super().__init__((coord_name,), {dim: size}, dtype=dtype)
|
|
87
|
+
self.affine = affine
|
|
88
|
+
self.is_xaxis = is_xaxis
|
|
89
|
+
self.coord_name = coord_name
|
|
90
|
+
self.dim = dim
|
|
91
|
+
self.size = size
|
|
92
|
+
|
|
93
|
+
def forward(self, dim_positions: dict[str, Any]) -> dict[Hashable, Any]:
|
|
94
|
+
positions = np.asarray(dim_positions[self.dim])
|
|
95
|
+
|
|
96
|
+
if self.is_xaxis:
|
|
97
|
+
labels, _ = self.affine * (positions, np.zeros_like(positions))
|
|
98
|
+
else:
|
|
99
|
+
_, labels = self.affine * (np.zeros_like(positions), positions)
|
|
100
|
+
|
|
101
|
+
return {self.coord_name: labels}
|
|
102
|
+
|
|
103
|
+
def reverse(self, coord_labels: dict[Hashable, Any]) -> dict[str, Any]:
|
|
104
|
+
labels = np.asarray(coord_labels[self.coord_name])
|
|
105
|
+
|
|
106
|
+
if self.is_xaxis:
|
|
107
|
+
positions, _ = ~self.affine * (labels, np.zeros_like(labels))
|
|
108
|
+
else:
|
|
109
|
+
_, positions = ~self.affine * (np.zeros_like(labels), labels)
|
|
110
|
+
|
|
111
|
+
return {self.dim: positions}
|
|
112
|
+
|
|
113
|
+
def equals(self, other):
|
|
114
|
+
if not isinstance(other, AxisAffineTransform):
|
|
115
|
+
return False
|
|
116
|
+
|
|
117
|
+
# only compare the affine parameters of the relevant axis
|
|
118
|
+
if self.is_xaxis:
|
|
119
|
+
affine_match = self.affine.a == other.affine.a and self.affine.c == other.affine.c
|
|
120
|
+
else:
|
|
121
|
+
affine_match = self.affine.e == other.affine.e and self.affine.f == other.affine.f
|
|
122
|
+
|
|
123
|
+
return affine_match and self.size == other.size
|
|
124
|
+
|
|
125
|
+
def generate_coords(self, dims: tuple[str, ...] | None = None) -> dict[Hashable, Any]:
|
|
126
|
+
assert dims is None or dims == self.dims
|
|
127
|
+
return self.forward({self.dim: np.arange(self.size)})
|
|
128
|
+
|
|
129
|
+
def slice(self, slice: slice) -> "AxisAffineTransform":
|
|
130
|
+
start = max(slice.start or 0, 0)
|
|
131
|
+
stop = min(slice.stop or self.size, self.size)
|
|
132
|
+
step = slice.step or 1
|
|
133
|
+
|
|
134
|
+
# TODO: support reverse transform (i.e., start > stop)?
|
|
135
|
+
assert start < stop
|
|
136
|
+
|
|
137
|
+
size = (stop - start) // step
|
|
138
|
+
scale = float(step)
|
|
139
|
+
|
|
140
|
+
if self.is_xaxis:
|
|
141
|
+
affine = self.affine * Affine.translation(start, 0.0) * Affine.scale(scale, 1.0)
|
|
142
|
+
else:
|
|
143
|
+
affine = self.affine * Affine.translation(0.0, start) * Affine.scale(1.0, scale)
|
|
144
|
+
|
|
145
|
+
return type(self)(
|
|
146
|
+
affine,
|
|
147
|
+
size,
|
|
148
|
+
self.coord_name,
|
|
149
|
+
self.dim,
|
|
150
|
+
is_xaxis=self.is_xaxis,
|
|
151
|
+
dtype=self.dtype,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class AxisAffineTransformIndex(CoordinateTransformIndex):
|
|
156
|
+
"""Axis-independent Xarray Index for an affine 2D transform with no
|
|
157
|
+
skew/rotation.
|
|
158
|
+
|
|
159
|
+
For internal use only.
|
|
160
|
+
|
|
161
|
+
This Index class provides specific behavior on top of
|
|
162
|
+
Xarray's `CoordinateTransformIndex`:
|
|
163
|
+
|
|
164
|
+
- Data slicing computes a new affine transform and returns a new
|
|
165
|
+
`AxisAffineTransformIndex` object
|
|
166
|
+
|
|
167
|
+
- Otherwise data selection creates and returns a new Xarray
|
|
168
|
+
`PandasIndex` object for non-scalar indexers
|
|
169
|
+
|
|
170
|
+
- The index can be converted to a `pandas.Index` object (useful for Xarray
|
|
171
|
+
operations that don't work with Xarray indexes yet).
|
|
172
|
+
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
axis_transform: AxisAffineTransform
|
|
176
|
+
dim: str
|
|
177
|
+
|
|
178
|
+
def __init__(self, transform: AxisAffineTransform):
|
|
179
|
+
assert isinstance(transform, AxisAffineTransform)
|
|
180
|
+
super().__init__(transform)
|
|
181
|
+
self.axis_transform = transform
|
|
182
|
+
self.dim = transform.dim
|
|
183
|
+
|
|
184
|
+
def isel( # type: ignore[override]
|
|
185
|
+
self, indexers: Mapping[Any, int | slice | np.ndarray | Variable]
|
|
186
|
+
) -> "AxisAffineTransformIndex | PandasIndex | None":
|
|
187
|
+
idxer = indexers[self.dim]
|
|
188
|
+
|
|
189
|
+
# generate a new index with updated transform if a slice is given
|
|
190
|
+
if isinstance(idxer, slice):
|
|
191
|
+
return AxisAffineTransformIndex(self.axis_transform.slice(idxer))
|
|
192
|
+
# no index for vectorized (fancy) indexing with n-dimensional Variable
|
|
193
|
+
elif isinstance(idxer, Variable) and idxer.ndim > 1:
|
|
194
|
+
return None
|
|
195
|
+
# no index for scalar value
|
|
196
|
+
elif np.ndim(idxer) == 0:
|
|
197
|
+
return None
|
|
198
|
+
# otherwise return a PandasIndex with values computed by forward transformation
|
|
199
|
+
else:
|
|
200
|
+
values = self.axis_transform.forward({self.dim: idxer})[self.axis_transform.coord_name]
|
|
201
|
+
if isinstance(idxer, Variable):
|
|
202
|
+
new_dim = idxer.dims[0]
|
|
203
|
+
else:
|
|
204
|
+
new_dim = self.dim
|
|
205
|
+
return PandasIndex(values, new_dim, coord_dtype=values.dtype)
|
|
206
|
+
|
|
207
|
+
def sel(self, labels, method=None, tolerance=None):
|
|
208
|
+
coord_name = self.axis_transform.coord_name
|
|
209
|
+
label = labels[coord_name]
|
|
210
|
+
|
|
211
|
+
if isinstance(label, slice):
|
|
212
|
+
if label.step is None:
|
|
213
|
+
# continuous interval slice indexing (preserves the index)
|
|
214
|
+
pos = self.transform.reverse({coord_name: np.array([label.start, label.stop])})
|
|
215
|
+
pos = np.round(pos[self.dim]).astype("int")
|
|
216
|
+
new_start = max(pos[0], 0)
|
|
217
|
+
new_stop = min(pos[1], self.axis_transform.size)
|
|
218
|
+
return IndexSelResult({self.dim: slice(new_start, new_stop)})
|
|
219
|
+
else:
|
|
220
|
+
# otherwise convert to basic (array) indexing
|
|
221
|
+
label = np.arange(label.start, label.stop, label.step)
|
|
222
|
+
|
|
223
|
+
# support basic indexing (in the 1D case basic vs. vectorized indexing
|
|
224
|
+
# are pretty much similar)
|
|
225
|
+
unwrap_xr = False
|
|
226
|
+
if not isinstance(label, Variable | DataArray):
|
|
227
|
+
# basic indexing -> either scalar or 1-d array
|
|
228
|
+
try:
|
|
229
|
+
var = Variable("_", label)
|
|
230
|
+
except ValueError:
|
|
231
|
+
var = Variable((), label)
|
|
232
|
+
labels = {self.dim: var}
|
|
233
|
+
unwrap_xr = True
|
|
234
|
+
|
|
235
|
+
result = super().sel(labels, method=method, tolerance=tolerance)
|
|
236
|
+
|
|
237
|
+
if unwrap_xr:
|
|
238
|
+
dim_indexers = {self.dim: result.dim_indexers[self.dim].values}
|
|
239
|
+
result = IndexSelResult(dim_indexers)
|
|
240
|
+
|
|
241
|
+
return result
|
|
242
|
+
|
|
243
|
+
def to_pandas_index(self) -> "pd.Index":
|
|
244
|
+
import pandas as pd
|
|
245
|
+
|
|
246
|
+
values = self.transform.generate_coords()
|
|
247
|
+
return pd.Index(values[self.dim])
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# The types of Xarray indexes that may be wrapped by RasterIndex
|
|
251
|
+
WrappedIndex = AxisAffineTransformIndex | PandasIndex | CoordinateTransformIndex
|
|
252
|
+
WrappedIndexCoords = Hashable | tuple[Hashable, Hashable]
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def _filter_dim_indexers(index: WrappedIndex, indexers: Mapping) -> Mapping:
|
|
256
|
+
if isinstance(index, CoordinateTransformIndex):
|
|
257
|
+
dims = index.transform.dims
|
|
258
|
+
else:
|
|
259
|
+
# PandasIndex
|
|
260
|
+
dims = (str(index.dim),)
|
|
261
|
+
|
|
262
|
+
return {dim: indexers[dim] for dim in dims if dim in indexers}
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class RasterIndex(Index):
|
|
266
|
+
"""Xarray index for raster coordinates.
|
|
267
|
+
|
|
268
|
+
RasterIndex is itself a wrapper around one or more Xarray indexes associated
|
|
269
|
+
with either the raster x or y axis coordinate or both, depending on the
|
|
270
|
+
affine transformation and prior data selection (if any):
|
|
271
|
+
|
|
272
|
+
- The affine transformation is not rectilinear or has rotation: this index
|
|
273
|
+
encapsulates a single `CoordinateTransformIndex` object for both the x and
|
|
274
|
+
y axis (2-dimensional) coordinates.
|
|
275
|
+
|
|
276
|
+
- The affine transformation is rectilinear ands has no rotation: this index
|
|
277
|
+
encapsulates one or two index objects for either the x or y axis or both
|
|
278
|
+
(1-dimensional) coordinates. The index type is either a subclass of
|
|
279
|
+
`CoordinateTransformIndex` that supports slicing or `PandasIndex` (e.g.,
|
|
280
|
+
after data selection at arbitrary locations).
|
|
281
|
+
|
|
282
|
+
"""
|
|
283
|
+
|
|
284
|
+
_wrapped_indexes: dict[WrappedIndexCoords, WrappedIndex]
|
|
285
|
+
|
|
286
|
+
def __init__(self, indexes: Mapping[WrappedIndexCoords, WrappedIndex]):
|
|
287
|
+
idx_keys = list(indexes)
|
|
288
|
+
idx_vals = list(indexes.values())
|
|
289
|
+
|
|
290
|
+
# either one or the other configuration (dependent vs. independent x/y axes)
|
|
291
|
+
axis_dependent = (
|
|
292
|
+
len(indexes) == 1
|
|
293
|
+
and isinstance(idx_keys[0], tuple)
|
|
294
|
+
and isinstance(idx_vals[0], CoordinateTransformIndex)
|
|
295
|
+
)
|
|
296
|
+
axis_independent = len(indexes) in (1, 2) and all(
|
|
297
|
+
isinstance(idx, AxisAffineTransformIndex | PandasIndex) for idx in idx_vals
|
|
298
|
+
)
|
|
299
|
+
assert axis_dependent ^ axis_independent
|
|
300
|
+
|
|
301
|
+
self._wrapped_indexes = dict(indexes)
|
|
302
|
+
|
|
303
|
+
@classmethod
|
|
304
|
+
def from_transform(
|
|
305
|
+
cls, affine: Affine, width: int, height: int, x_dim: str = "x", y_dim: str = "y"
|
|
306
|
+
) -> "RasterIndex":
|
|
307
|
+
indexes: dict[WrappedIndexCoords, AxisAffineTransformIndex | CoordinateTransformIndex]
|
|
308
|
+
|
|
309
|
+
# pixel centered coordinates
|
|
310
|
+
affine = affine * Affine.translation(0.5, 0.5)
|
|
311
|
+
|
|
312
|
+
if affine.is_rectilinear and affine.b == affine.d == 0:
|
|
313
|
+
x_transform = AxisAffineTransform(affine, width, "x", x_dim, is_xaxis=True)
|
|
314
|
+
y_transform = AxisAffineTransform(affine, height, "y", y_dim, is_xaxis=False)
|
|
315
|
+
indexes = {
|
|
316
|
+
"x": AxisAffineTransformIndex(x_transform),
|
|
317
|
+
"y": AxisAffineTransformIndex(y_transform),
|
|
318
|
+
}
|
|
319
|
+
else:
|
|
320
|
+
xy_transform = AffineTransform(affine, width, height, x_dim=x_dim, y_dim=y_dim)
|
|
321
|
+
indexes = {("x", "y"): CoordinateTransformIndex(xy_transform)}
|
|
322
|
+
|
|
323
|
+
return cls(indexes)
|
|
324
|
+
|
|
325
|
+
@classmethod
|
|
326
|
+
def from_variables(
|
|
327
|
+
cls,
|
|
328
|
+
variables: Mapping[Any, Variable],
|
|
329
|
+
*,
|
|
330
|
+
options: Mapping[str, Any],
|
|
331
|
+
) -> "RasterIndex":
|
|
332
|
+
# TODO: compute bounds, resolution and affine transform from explicit coordinates.
|
|
333
|
+
raise NotImplementedError("Creating a RasterIndex from existing coordinates is not yet supported.")
|
|
334
|
+
|
|
335
|
+
def create_variables(self, variables: Mapping[Any, Variable] | None = None) -> dict[Hashable, Variable]:
|
|
336
|
+
new_variables: dict[Hashable, Variable] = {}
|
|
337
|
+
|
|
338
|
+
for index in self._wrapped_indexes.values():
|
|
339
|
+
new_variables.update(index.create_variables())
|
|
340
|
+
|
|
341
|
+
return new_variables
|
|
342
|
+
|
|
343
|
+
def isel(self, indexers: Mapping[Any, int | slice | np.ndarray | Variable]) -> "RasterIndex | None":
|
|
344
|
+
new_indexes: dict[WrappedIndexCoords, WrappedIndex] = {}
|
|
345
|
+
|
|
346
|
+
for coord_names, index in self._wrapped_indexes.items():
|
|
347
|
+
index_indexers = _filter_dim_indexers(index, indexers)
|
|
348
|
+
if not index_indexers:
|
|
349
|
+
# no selection to perform: simply propagate the index
|
|
350
|
+
# TODO: uncomment when https://github.com/pydata/xarray/issues/10063 is fixed
|
|
351
|
+
# new_indexes[coord_names] = index
|
|
352
|
+
...
|
|
353
|
+
else:
|
|
354
|
+
new_index = index.isel(index_indexers)
|
|
355
|
+
if new_index is not None:
|
|
356
|
+
new_indexes[coord_names] = new_index
|
|
357
|
+
|
|
358
|
+
if new_indexes:
|
|
359
|
+
# TODO: if there's only a single PandasIndex can we just return it?
|
|
360
|
+
# (maybe better to keep it wrapped if we plan to later make RasterIndex CRS-aware)
|
|
361
|
+
return RasterIndex(new_indexes)
|
|
362
|
+
else:
|
|
363
|
+
return None
|
|
364
|
+
|
|
365
|
+
def sel(self, labels: dict[Any, Any], method=None, tolerance=None) -> IndexSelResult:
|
|
366
|
+
results = []
|
|
367
|
+
|
|
368
|
+
for coord_names, index in self._wrapped_indexes.items():
|
|
369
|
+
if not isinstance(coord_names, tuple):
|
|
370
|
+
coord_names = (coord_names,)
|
|
371
|
+
index_labels = {k: v for k, v in labels if k in coord_names}
|
|
372
|
+
if index_labels:
|
|
373
|
+
results.append(index.sel(index_labels, method=method, tolerance=tolerance))
|
|
374
|
+
|
|
375
|
+
return merge_sel_results(results)
|
|
376
|
+
|
|
377
|
+
def equals(self, other: Index) -> bool:
|
|
378
|
+
if not isinstance(other, RasterIndex):
|
|
379
|
+
return False
|
|
380
|
+
if set(self._wrapped_indexes) != set(other._wrapped_indexes):
|
|
381
|
+
return False
|
|
382
|
+
|
|
383
|
+
return all(
|
|
384
|
+
index.equals(other._wrapped_indexes[k]) # type: ignore[arg-type]
|
|
385
|
+
for k, index in self._wrapped_indexes.items()
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
def to_pandas_index(self) -> "pd.Index":
|
|
389
|
+
# conversion is possible only if this raster index encapsulates
|
|
390
|
+
# exactly one AxisAffineTransformIndex or a PandasIndex associated
|
|
391
|
+
# to either the x or y axis (1-dimensional) coordinate.
|
|
392
|
+
if len(self._wrapped_indexes) == 1:
|
|
393
|
+
index = next(iter(self._wrapped_indexes.values()))
|
|
394
|
+
if isinstance(index, AxisAffineTransformIndex | PandasIndex):
|
|
395
|
+
return index.to_pandas_index()
|
|
396
|
+
|
|
397
|
+
raise ValueError("Cannot convert RasterIndex to pandas.Index")
|
|
398
|
+
|
|
399
|
+
def __repr__(self):
|
|
400
|
+
items: list[str] = []
|
|
401
|
+
|
|
402
|
+
for coord_names, index in self._wrapped_indexes.items():
|
|
403
|
+
items += [repr(coord_names) + ":", textwrap.indent(repr(index), " ")]
|
|
404
|
+
|
|
405
|
+
return "RasterIndex\n" + "\n".join(items)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rasterix
|
|
3
|
+
Version: 0.1a1
|
|
4
|
+
Summary: Raster extensions for Xarray
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: xarray
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Natural Language :: English
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: affine
|
|
19
|
+
Requires-Dist: pandas>=2
|
|
20
|
+
Requires-Dist: numpy>=2
|
|
21
|
+
Requires-Dist: xarray>=2025
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# rasterix: Raster tricks for Xarray
|
|
25
|
+
|
|
26
|
+
<img src="rasterix.png" width="400">
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
rasterix/__init__.py,sha256=3-ipA2RgFW3FZ_uOr0_CagEw8p8JTMWepIIg3tZCSjY,253
|
|
2
|
+
rasterix/_version.py,sha256=oixvE9DVoe4z2vLWfAweh5smrXr9lPfc9uA5ZFJvxvo,21
|
|
3
|
+
rasterix/raster_index.py,sha256=Lq-X2F5Zrz5dR2odKvUuG-zYk0nwZ6bBnT-pkRVxJVQ,14976
|
|
4
|
+
rasterix-0.1a1.dist-info/licenses/LICENSE,sha256=QFnsASMx8_yBNbrS7GVOhJ5CglGsLMj83Rn61uWyMs8,10265
|
|
5
|
+
rasterix-0.1a1.dist-info/METADATA,sha256=0HsuR9lB_sx5wDg7nMWcGcc-ryDajKLGsnAQKQrl8FU,798
|
|
6
|
+
rasterix-0.1a1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
7
|
+
rasterix-0.1a1.dist-info/top_level.txt,sha256=xrxwvEojFP_KT72cB7W-Bax_gPoV4e7Jw_4c41uiaj0,9
|
|
8
|
+
rasterix-0.1a1.dist-info/RECORD,,
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
|
10
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
|
13
|
+
owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
|
16
|
+
that control, are controlled by, or are under common control with that entity.
|
|
17
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
|
18
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
19
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
+
permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications, including
|
|
26
|
+
but not limited to software source code, documentation source, and configuration
|
|
27
|
+
files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
|
30
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
31
|
+
generated documentation, and conversions to other media types.
|
|
32
|
+
|
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
|
34
|
+
available under the License, as indicated by a copyright notice that is included
|
|
35
|
+
in or attached to the work (an example is provided in the Appendix below).
|
|
36
|
+
|
|
37
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
38
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
39
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
40
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
41
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
42
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the original version
|
|
45
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
46
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
47
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
48
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
49
|
+
"submitted" means any form of electronic, verbal, or written communication sent
|
|
50
|
+
to the Licensor or its representatives, including but not limited to
|
|
51
|
+
communication on electronic mailing lists, source code control systems, and
|
|
52
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
53
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
54
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
55
|
+
owner as "Not a Contribution."
|
|
56
|
+
|
|
57
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
58
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
59
|
+
incorporated within the Work.
|
|
60
|
+
|
|
61
|
+
2. Grant of Copyright License.
|
|
62
|
+
|
|
63
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
64
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
65
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
66
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
67
|
+
Derivative Works in Source or Object form.
|
|
68
|
+
|
|
69
|
+
3. Grant of Patent License.
|
|
70
|
+
|
|
71
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
72
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
73
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
74
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
75
|
+
such license applies only to those patent claims licensable by such Contributor
|
|
76
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
77
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
78
|
+
submitted. If You institute patent litigation against any entity (including a
|
|
79
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
80
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
|
81
|
+
patent infringement, then any patent licenses granted to You under this License
|
|
82
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
83
|
+
|
|
84
|
+
4. Redistribution.
|
|
85
|
+
|
|
86
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
87
|
+
in any medium, with or without modifications, and in Source or Object form,
|
|
88
|
+
provided that You meet the following conditions:
|
|
89
|
+
|
|
90
|
+
You must give any other recipients of the Work or Derivative Works a copy of
|
|
91
|
+
this License; and
|
|
92
|
+
You must cause any modified files to carry prominent notices stating that You
|
|
93
|
+
changed the files; and
|
|
94
|
+
You must retain, in the Source form of any Derivative Works that You distribute,
|
|
95
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
|
96
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
|
97
|
+
Derivative Works; and
|
|
98
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
99
|
+
Derivative Works that You distribute must include a readable copy of the
|
|
100
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
101
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
102
|
+
following places: within a NOTICE text file distributed as part of the
|
|
103
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
104
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
105
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
106
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
107
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
108
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
109
|
+
provided that such additional attribution notices cannot be construed as
|
|
110
|
+
modifying the License.
|
|
111
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
112
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
113
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
114
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
115
|
+
with the conditions stated in this License.
|
|
116
|
+
|
|
117
|
+
5. Submission of Contributions.
|
|
118
|
+
|
|
119
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
120
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
121
|
+
conditions of this License, without any additional terms or conditions.
|
|
122
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
123
|
+
any separate license agreement you may have executed with Licensor regarding
|
|
124
|
+
such Contributions.
|
|
125
|
+
|
|
126
|
+
6. Trademarks.
|
|
127
|
+
|
|
128
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
129
|
+
service marks, or product names of the Licensor, except as required for
|
|
130
|
+
reasonable and customary use in describing the origin of the Work and
|
|
131
|
+
reproducing the content of the NOTICE file.
|
|
132
|
+
|
|
133
|
+
7. Disclaimer of Warranty.
|
|
134
|
+
|
|
135
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
136
|
+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
137
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
138
|
+
including, without limitation, any warranties or conditions of TITLE,
|
|
139
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
140
|
+
solely responsible for determining the appropriateness of using or
|
|
141
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
|
142
|
+
permissions under this License.
|
|
143
|
+
|
|
144
|
+
8. Limitation of Liability.
|
|
145
|
+
|
|
146
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
|
147
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
148
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
149
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
|
150
|
+
or consequential damages of any character arising as a result of this License or
|
|
151
|
+
out of the use or inability to use the Work (including but not limited to
|
|
152
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
153
|
+
any and all other commercial damages or losses), even if such Contributor has
|
|
154
|
+
been advised of the possibility of such damages.
|
|
155
|
+
|
|
156
|
+
9. Accepting Warranty or Additional Liability.
|
|
157
|
+
|
|
158
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
159
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
160
|
+
other liability obligations and/or rights consistent with this License. However,
|
|
161
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
162
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
163
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
164
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
|
165
|
+
accepting any such warranty or additional liability.
|
|
166
|
+
|
|
167
|
+
END OF TERMS AND CONDITIONS
|
|
168
|
+
|
|
169
|
+
APPENDIX: How to apply the Apache License to your work
|
|
170
|
+
|
|
171
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
172
|
+
notice, with the fields enclosed by brackets "[]" replaced with your own
|
|
173
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
174
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
175
|
+
recommend that a file or class name and description of purpose be included on
|
|
176
|
+
the same "printed page" as the copyright notice for easier identification within
|
|
177
|
+
third-party archives.
|
|
178
|
+
|
|
179
|
+
Copyright 2014-2025 Deepak Cherian
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rasterix
|