yirgacheffe 1.7.6__tar.gz → 1.7.7__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.6/yirgacheffe.egg-info → yirgacheffe-1.7.7}/PKG-INFO +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/pyproject.toml +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_operators.py +2 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_parallel_operators.py +35 -2
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/_core.py +1 -1
- yirgacheffe-1.7.6/yirgacheffe/operators.py → yirgacheffe-1.7.7/yirgacheffe/_operators.py +86 -75
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/base.py +2 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/constant.py +1 -2
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/group.py +1 -2
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/h3layer.py +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/rasters.py +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/rescaled.py +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/vectors.py +1 -1
- yirgacheffe-1.7.7/yirgacheffe/operators.py +7 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/window.py +2 -2
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7/yirgacheffe.egg-info}/PKG-INFO +1 -1
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe.egg-info/SOURCES.txt +1 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/LICENSE +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/MANIFEST.in +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/README.md +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/setup.cfg +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_area.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_auto_windowing.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_base.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_constants.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_datatypes.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_group.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_h3layer.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_intersection.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_multiband.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_nodata.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_openers.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_optimisation.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_pickle.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_projection.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_raster.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_rescaling.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_rounding.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_save_with_window.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_sum_with_window.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_uniform_area_layer.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_union.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_vectors.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/tests/test_window.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/__init__.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/_backends/__init__.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/_backends/enumeration.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/_backends/mlx.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/_backends/numpy.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/constants.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/__init__.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/layers/area.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe/rounding.py +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe.egg-info/dependency_links.txt +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe.egg-info/entry_points.txt +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/yirgacheffe.egg-info/requires.txt +0 -0
- {yirgacheffe-1.7.6 → yirgacheffe-1.7.7}/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.7.
|
|
9
|
+
version = "1.7.7"
|
|
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" }]
|
|
@@ -10,7 +10,8 @@ import torch
|
|
|
10
10
|
import yirgacheffe
|
|
11
11
|
from yirgacheffe.window import Area, PixelScale
|
|
12
12
|
from yirgacheffe.layers import ConstantLayer, RasterLayer, VectorLayer
|
|
13
|
-
from yirgacheffe.operators import
|
|
13
|
+
from yirgacheffe.operators import DataType
|
|
14
|
+
from yirgacheffe._operators import LayerOperation
|
|
14
15
|
from yirgacheffe._backends import backend
|
|
15
16
|
from tests.helpers import gdal_dataset_with_data, gdal_dataset_of_region, make_vectors_with_id
|
|
16
17
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import resource
|
|
2
3
|
import tempfile
|
|
3
4
|
|
|
4
5
|
import numpy as np
|
|
@@ -8,7 +9,7 @@ import torch
|
|
|
8
9
|
import yirgacheffe
|
|
9
10
|
from tests.helpers import gdal_dataset_with_data
|
|
10
11
|
from yirgacheffe.layers import RasterLayer
|
|
11
|
-
from yirgacheffe.
|
|
12
|
+
from yirgacheffe._operators import LayerOperation
|
|
12
13
|
|
|
13
14
|
# These tests are marked skip for MLX, because there seems to be a problem with
|
|
14
15
|
# calling mx.eval in the tests for parallel save on Linux (which is what we use
|
|
@@ -42,7 +43,6 @@ def test_add_byte_layers_with_one_thread_uses_regular_save(monkeypatch) -> None:
|
|
|
42
43
|
with pytest.raises(TypeError):
|
|
43
44
|
comp.parallel_save(result)
|
|
44
45
|
|
|
45
|
-
|
|
46
46
|
@pytest.mark.skipif(yirgacheffe._backends.BACKEND != "NUMPY", reason="Only applies for numpy")
|
|
47
47
|
def test_add_byte_layers(monkeypatch) -> None:
|
|
48
48
|
with monkeypatch.context() as m:
|
|
@@ -71,6 +71,39 @@ def test_add_byte_layers(monkeypatch) -> None:
|
|
|
71
71
|
|
|
72
72
|
assert (expected == actual).all()
|
|
73
73
|
|
|
74
|
+
@pytest.mark.skipif(yirgacheffe._backends.BACKEND != "NUMPY", reason="Only applies for numpy")
|
|
75
|
+
def test_rlimit_nofiles(monkeypatch) -> None:
|
|
76
|
+
with monkeypatch.context() as m:
|
|
77
|
+
m.setattr(yirgacheffe.constants, "YSTEP", 1)
|
|
78
|
+
m.setattr(LayerOperation, "save", None)
|
|
79
|
+
with tempfile.TemporaryDirectory() as tempdir:
|
|
80
|
+
path1 = os.path.join(tempdir, "test1.tif")
|
|
81
|
+
data1 = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
|
|
82
|
+
dataset1 = gdal_dataset_with_data((0.0, 0.0), 0.02, data1, filename=path1)
|
|
83
|
+
dataset1.Close()
|
|
84
|
+
|
|
85
|
+
rlimit_log = []
|
|
86
|
+
def callback_rlimit_recorder(_progress: float) -> None:
|
|
87
|
+
rlimit_log.append(resource.getrlimit(resource.RLIMIT_NOFILE))
|
|
88
|
+
|
|
89
|
+
with RasterLayer.layer_from_file(path1) as layer:
|
|
90
|
+
with RasterLayer.empty_raster_layer_like(layer) as result:
|
|
91
|
+
|
|
92
|
+
before_current_fd_limit, before_max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
93
|
+
|
|
94
|
+
comp = layer * 2
|
|
95
|
+
comp.parallel_save(result, callback=callback_rlimit_recorder)
|
|
96
|
+
|
|
97
|
+
after_current_fd_limit, after_max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
98
|
+
|
|
99
|
+
assert after_current_fd_limit == before_current_fd_limit
|
|
100
|
+
assert after_max_fd_limit == before_max_fd_limit
|
|
101
|
+
|
|
102
|
+
assert len(rlimit_log) > 0
|
|
103
|
+
for recorded_current_fd_limit, recorded_max_fd_limit in rlimit_log:
|
|
104
|
+
assert recorded_current_fd_limit == before_max_fd_limit
|
|
105
|
+
assert recorded_max_fd_limit == before_max_fd_limit
|
|
106
|
+
|
|
74
107
|
@pytest.mark.skipif(yirgacheffe._backends.BACKEND != "NUMPY", reason="Only applies for numpy")
|
|
75
108
|
def test_add_byte_layers_and_sum(monkeypatch) -> None:
|
|
76
109
|
with monkeypatch.context() as m:
|
|
@@ -8,7 +8,7 @@ from .layers.group import GroupLayer, TiledGroupLayer
|
|
|
8
8
|
from .layers.rasters import RasterLayer
|
|
9
9
|
from .layers.vectors import VectorLayer
|
|
10
10
|
from .window import MapProjection
|
|
11
|
-
from .
|
|
11
|
+
from ._backends.enumeration import dtype as DataType
|
|
12
12
|
|
|
13
13
|
def read_raster(
|
|
14
14
|
filename: Union[Path,str],
|
|
@@ -2,10 +2,12 @@ import logging
|
|
|
2
2
|
import math
|
|
3
3
|
import multiprocessing
|
|
4
4
|
import os
|
|
5
|
+
import resource
|
|
5
6
|
import sys
|
|
6
7
|
import tempfile
|
|
7
8
|
import time
|
|
8
9
|
import types
|
|
10
|
+
from contextlib import ExitStack
|
|
9
11
|
from enum import Enum
|
|
10
12
|
from multiprocessing import Semaphore, Process
|
|
11
13
|
from multiprocessing.managers import SharedMemoryManager
|
|
@@ -769,83 +771,92 @@ class LayerOperation(LayerMathMixin):
|
|
|
769
771
|
|
|
770
772
|
total = 0.0
|
|
771
773
|
|
|
772
|
-
with
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
mem_sem_cast
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
if yoffset+self.ystep > computation_window.ysize
|
|
792
|
-
else self.ystep)
|
|
793
|
-
source_queue.put((
|
|
794
|
-
yoffset,
|
|
795
|
-
step
|
|
796
|
-
))
|
|
797
|
-
for _ in range(worker_count):
|
|
798
|
-
source_queue.put(None)
|
|
799
|
-
|
|
800
|
-
if callback:
|
|
801
|
-
callback(0.0)
|
|
802
|
-
|
|
803
|
-
workers = [Process(target=self._parallel_worker, args=(
|
|
804
|
-
i,
|
|
805
|
-
mem_sem_cast[i][0],
|
|
806
|
-
mem_sem_cast[i][1],
|
|
807
|
-
np_dtype,
|
|
808
|
-
computation_window.xsize,
|
|
809
|
-
source_queue,
|
|
810
|
-
result_queue,
|
|
811
|
-
computation_window
|
|
812
|
-
)) for i in range(worker_count)]
|
|
813
|
-
for worker in workers:
|
|
814
|
-
worker.start()
|
|
815
|
-
|
|
816
|
-
sentinal_count = len(workers)
|
|
817
|
-
retired_blocks = 0
|
|
818
|
-
while sentinal_count > 0:
|
|
819
|
-
res = result_queue.get()
|
|
820
|
-
if res is None:
|
|
821
|
-
sentinal_count -= 1
|
|
822
|
-
continue
|
|
823
|
-
index, yoffset, step = res
|
|
824
|
-
_, sem, arr = mem_sem_cast[index]
|
|
825
|
-
if band:
|
|
826
|
-
band.WriteArray(
|
|
827
|
-
arr[0:step],
|
|
828
|
-
destination_window.xoff,
|
|
829
|
-
yoffset + destination_window.yoff,
|
|
774
|
+
with ExitStack() as stack:
|
|
775
|
+
# If we get this far, then we're going to do the multiprocessing path. In general we've had
|
|
776
|
+
# a lot of issues with limits on open file descriptors using multiprocessing on bigger machines
|
|
777
|
+
# with hundreds of cores, and so to avoid blowing up in a way that is confusing to non-compsci
|
|
778
|
+
# types, we just set the soft ulimit as high as we can
|
|
779
|
+
previous_fd_limit, max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
780
|
+
resource.setrlimit(resource.RLIMIT_NOFILE, (max_fd_limit, max_fd_limit))
|
|
781
|
+
stack.callback(resource.setrlimit, resource.RLIMIT_NOFILE, (previous_fd_limit, max_fd_limit))
|
|
782
|
+
|
|
783
|
+
with multiprocessing.Manager() as manager:
|
|
784
|
+
with SharedMemoryManager() as smm:
|
|
785
|
+
|
|
786
|
+
mem_sem_cast = []
|
|
787
|
+
for _ in range(worker_count):
|
|
788
|
+
shared_buf = smm.SharedMemory(size=np_dtype.itemsize * self.ystep * computation_window.xsize)
|
|
789
|
+
cast_buf : npt.NDArray = np.ndarray(
|
|
790
|
+
(self.ystep, computation_window.xsize),
|
|
791
|
+
dtype=np_dtype,
|
|
792
|
+
buffer=shared_buf.buf
|
|
830
793
|
)
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
794
|
+
cast_buf[:] = np.zeros((self.ystep, computation_window.xsize), np_dtype)
|
|
795
|
+
mem_sem_cast.append((shared_buf, Semaphore(), cast_buf))
|
|
796
|
+
|
|
797
|
+
source_queue = manager.Queue()
|
|
798
|
+
result_queue = manager.Queue()
|
|
799
|
+
|
|
800
|
+
for yoffset in range(0, computation_window.ysize, self.ystep):
|
|
801
|
+
step = ((computation_window.ysize - yoffset)
|
|
802
|
+
if yoffset+self.ystep > computation_window.ysize
|
|
803
|
+
else self.ystep)
|
|
804
|
+
source_queue.put((
|
|
805
|
+
yoffset,
|
|
806
|
+
step
|
|
807
|
+
))
|
|
808
|
+
for _ in range(worker_count):
|
|
809
|
+
source_queue.put(None)
|
|
810
|
+
|
|
835
811
|
if callback:
|
|
836
|
-
callback(
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
812
|
+
callback(0.0)
|
|
813
|
+
|
|
814
|
+
workers = [Process(target=self._parallel_worker, args=(
|
|
815
|
+
i,
|
|
816
|
+
mem_sem_cast[i][0],
|
|
817
|
+
mem_sem_cast[i][1],
|
|
818
|
+
np_dtype,
|
|
819
|
+
computation_window.xsize,
|
|
820
|
+
source_queue,
|
|
821
|
+
result_queue,
|
|
822
|
+
computation_window
|
|
823
|
+
)) for i in range(worker_count)]
|
|
824
|
+
for worker in workers:
|
|
825
|
+
worker.start()
|
|
826
|
+
|
|
827
|
+
sentinal_count = len(workers)
|
|
828
|
+
retired_blocks = 0
|
|
829
|
+
while sentinal_count > 0:
|
|
830
|
+
res = result_queue.get()
|
|
831
|
+
if res is None:
|
|
832
|
+
sentinal_count -= 1
|
|
833
|
+
continue
|
|
834
|
+
index, yoffset, step = res
|
|
835
|
+
_, sem, arr = mem_sem_cast[index]
|
|
836
|
+
if band:
|
|
837
|
+
band.WriteArray(
|
|
838
|
+
arr[0:step],
|
|
839
|
+
destination_window.xoff,
|
|
840
|
+
yoffset + destination_window.yoff,
|
|
841
|
+
)
|
|
842
|
+
if and_sum:
|
|
843
|
+
total += np.sum(np.array(arr[0:step]).astype(np.float64))
|
|
844
|
+
sem.release()
|
|
845
|
+
retired_blocks += 1
|
|
846
|
+
if callback:
|
|
847
|
+
callback(retired_blocks / work_blocks)
|
|
848
|
+
|
|
849
|
+
processes = workers
|
|
850
|
+
while processes:
|
|
851
|
+
candidates = [x for x in processes if not x.is_alive()]
|
|
852
|
+
for candidate in candidates:
|
|
853
|
+
candidate.join()
|
|
854
|
+
if candidate.exitcode:
|
|
855
|
+
for victim in processes:
|
|
856
|
+
victim.kill()
|
|
857
|
+
sys.exit(candidate.exitcode)
|
|
858
|
+
processes.remove(candidate)
|
|
859
|
+
time.sleep(0.01)
|
|
849
860
|
|
|
850
861
|
return total if and_sum else None
|
|
851
862
|
|
|
@@ -4,10 +4,11 @@ from typing import Any, Optional, Sequence, Tuple
|
|
|
4
4
|
import deprecation
|
|
5
5
|
|
|
6
6
|
from .. import __version__
|
|
7
|
-
from ..
|
|
7
|
+
from .._operators import LayerMathMixin
|
|
8
8
|
from ..rounding import almost_equal, round_up_pixels, round_down_pixels
|
|
9
9
|
from ..window import Area, MapProjection, PixelScale, Window
|
|
10
10
|
from .._backends import backend
|
|
11
|
+
from .._backends.enumeration import dtype as DataType
|
|
11
12
|
|
|
12
13
|
class YirgacheffeLayer(LayerMathMixin):
|
|
13
14
|
"""The common base class for the different layer types. Most still inherit from RasterLayer as deep down
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
from typing import Any, Union
|
|
2
2
|
|
|
3
|
-
from ..operators import DataType
|
|
4
3
|
from ..window import Area, MapProjection, PixelScale, Window
|
|
5
4
|
from .base import YirgacheffeLayer
|
|
6
5
|
from .._backends import backend
|
|
7
|
-
|
|
6
|
+
from .._backends.enumeration import dtype as DataType
|
|
8
7
|
|
|
9
8
|
class ConstantLayer(YirgacheffeLayer):
|
|
10
9
|
"""This is a layer that will return the identity value - can be used when an input layer is
|
|
@@ -6,13 +6,12 @@ from typing import Any, List, Optional, Sequence, Union
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
from numpy import ma
|
|
8
8
|
|
|
9
|
-
from ..operators import DataType
|
|
10
9
|
from ..rounding import round_down_pixels
|
|
11
10
|
from ..window import Area, Window
|
|
12
11
|
from .base import YirgacheffeLayer
|
|
13
12
|
from .rasters import RasterLayer
|
|
14
13
|
from .._backends import backend
|
|
15
|
-
|
|
14
|
+
from .._backends.enumeration import dtype as DataType
|
|
16
15
|
|
|
17
16
|
class GroupLayerEmpty(ValueError):
|
|
18
17
|
def __init__(self, msg):
|
|
@@ -3,12 +3,12 @@ from typing import Any, Tuple
|
|
|
3
3
|
|
|
4
4
|
import h3
|
|
5
5
|
import numpy as np
|
|
6
|
-
from yirgacheffe.operators import DataType
|
|
7
6
|
|
|
8
7
|
from ..rounding import round_up_pixels
|
|
9
8
|
from ..window import Area, MapProjection, Window
|
|
10
9
|
from .base import YirgacheffeLayer
|
|
11
10
|
from .._backends import backend
|
|
11
|
+
from .._backends.enumeration import dtype as DataType
|
|
12
12
|
|
|
13
13
|
class H3CellLayer(YirgacheffeLayer):
|
|
14
14
|
|
|
@@ -10,8 +10,8 @@ from ..constants import WGS_84_PROJECTION
|
|
|
10
10
|
from ..window import Area, MapProjection, PixelScale, Window
|
|
11
11
|
from ..rounding import round_up_pixels
|
|
12
12
|
from .base import YirgacheffeLayer
|
|
13
|
-
from ..operators import DataType
|
|
14
13
|
from .._backends import backend
|
|
14
|
+
from .._backends.enumeration import dtype as DataType
|
|
15
15
|
|
|
16
16
|
class InvalidRasterBand(Exception):
|
|
17
17
|
def __init__ (self, band):
|
|
@@ -4,11 +4,11 @@ from pathlib import Path
|
|
|
4
4
|
from typing import Any, Optional, Union
|
|
5
5
|
|
|
6
6
|
from skimage import transform
|
|
7
|
-
from yirgacheffe.operators import DataType
|
|
8
7
|
|
|
9
8
|
from ..window import MapProjection, PixelScale, Window
|
|
10
9
|
from .rasters import RasterLayer, YirgacheffeLayer
|
|
11
10
|
from .._backends import backend
|
|
11
|
+
from .._backends.enumeration import dtype as DataType
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class RescaledRasterLayer(YirgacheffeLayer):
|
|
@@ -8,11 +8,11 @@ import deprecation
|
|
|
8
8
|
from osgeo import gdal, ogr
|
|
9
9
|
|
|
10
10
|
from .. import __version__
|
|
11
|
-
from ..operators import DataType
|
|
12
11
|
from ..window import Area, MapProjection, PixelScale
|
|
13
12
|
from .base import YirgacheffeLayer
|
|
14
13
|
from .rasters import RasterLayer
|
|
15
14
|
from .._backends import backend
|
|
15
|
+
from .._backends.enumeration import dtype as DataType
|
|
16
16
|
|
|
17
17
|
def _validate_burn_value(burn_value: Any, layer: ogr.Layer) -> DataType: # pylint: disable=R0911
|
|
18
18
|
if isinstance(burn_value, str):
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Eventually all this should be moved to the top level in 2.0, but for backwards compatibility in 1.x needs
|
|
2
|
+
# to remain here
|
|
3
|
+
|
|
4
|
+
from ._operators import where, minumum, maximum, clip, log, log2, log10, exp, exp2, nan_to_num, isin, \
|
|
5
|
+
floor, ceil # pylint: disable=W0611
|
|
6
|
+
from ._operators import abs, round # pylint: disable=W0611,W0622
|
|
7
|
+
from ._backends.enumeration import dtype as DataType # pylint: disable=W0611
|
|
@@ -174,7 +174,7 @@ class Window:
|
|
|
174
174
|
Y axis offset
|
|
175
175
|
xsize : int
|
|
176
176
|
Width of data in pixels
|
|
177
|
-
|
|
177
|
+
ysize : float
|
|
178
178
|
Height of data in pixels
|
|
179
179
|
|
|
180
180
|
Attributes
|
|
@@ -185,7 +185,7 @@ class Window:
|
|
|
185
185
|
Y axis offset
|
|
186
186
|
xsize : int
|
|
187
187
|
Width of data in pixels
|
|
188
|
-
|
|
188
|
+
ysize : float
|
|
189
189
|
Height of data in pixels
|
|
190
190
|
"""
|
|
191
191
|
xoff: int
|
|
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
|