rio-tiler 7.5.0__py3-none-any.whl → 7.5.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.
- rio_tiler/__init__.py +1 -1
- rio_tiler/utils.py +34 -24
- {rio_tiler-7.5.0.dist-info → rio_tiler-7.5.1.dist-info}/METADATA +1 -1
- {rio_tiler-7.5.0.dist-info → rio_tiler-7.5.1.dist-info}/RECORD +7 -7
- {rio_tiler-7.5.0.dist-info → rio_tiler-7.5.1.dist-info}/WHEEL +0 -0
- {rio_tiler-7.5.0.dist-info → rio_tiler-7.5.1.dist-info}/licenses/AUTHORS.txt +0 -0
- {rio_tiler-7.5.0.dist-info → rio_tiler-7.5.1.dist-info}/licenses/LICENSE +0 -0
rio_tiler/__init__.py
CHANGED
rio_tiler/utils.py
CHANGED
|
@@ -59,8 +59,8 @@ def _weighted_stdev(
|
|
|
59
59
|
values: NDArray[numpy.floating],
|
|
60
60
|
weights: NDArray[numpy.floating],
|
|
61
61
|
) -> float:
|
|
62
|
-
average = numpy.average(values, weights=weights)
|
|
63
|
-
variance = numpy.average((values - average) ** 2, weights=weights)
|
|
62
|
+
average = numpy.ma.average(values, weights=weights)
|
|
63
|
+
variance = numpy.ma.average((values - average) ** 2, weights=weights)
|
|
64
64
|
return float(math.sqrt(variance))
|
|
65
65
|
|
|
66
66
|
|
|
@@ -174,35 +174,44 @@ def get_array_statistics(
|
|
|
174
174
|
_weighted_quantiles(data_comp, masked_coverage.compressed(), pp / 100.0)
|
|
175
175
|
for pp in percentiles
|
|
176
176
|
]
|
|
177
|
-
else:
|
|
178
|
-
percentiles_values = [numpy.nan] * len(percentiles_names)
|
|
179
|
-
|
|
180
|
-
if valid_pixels:
|
|
181
177
|
majority = float(keys[counts.tolist().index(counts.max())].tolist())
|
|
182
178
|
minority = float(keys[counts.tolist().index(counts.min())].tolist())
|
|
179
|
+
std = _weighted_stdev(data_comp, masked_coverage.compressed())
|
|
180
|
+
med = _weighted_quantiles(data_comp, masked_coverage.compressed())
|
|
181
|
+
_min = float(data[b].min())
|
|
182
|
+
_max = float(data[b].max())
|
|
183
|
+
_mean = float(data_cov.sum() / masked_coverage.sum())
|
|
184
|
+
_count = float(masked_coverage.sum())
|
|
185
|
+
_sum = float(data_cov.sum())
|
|
186
|
+
|
|
183
187
|
else:
|
|
188
|
+
percentiles_values = [numpy.nan] * len(percentiles_names)
|
|
184
189
|
majority = numpy.nan
|
|
185
190
|
minority = numpy.nan
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
std = numpy.nan
|
|
192
|
+
med = numpy.nan
|
|
193
|
+
_min = numpy.nan
|
|
194
|
+
_max = numpy.nan
|
|
195
|
+
_count = 0
|
|
196
|
+
_sum = 0
|
|
197
|
+
_mean = numpy.nan
|
|
189
198
|
|
|
190
199
|
output.append(
|
|
191
200
|
{
|
|
192
201
|
# Minimum value, not taking coverage fractions into account.
|
|
193
|
-
"min":
|
|
202
|
+
"min": _min,
|
|
194
203
|
# Maximum value, not taking coverage fractions into account.
|
|
195
|
-
"max":
|
|
204
|
+
"max": _max,
|
|
196
205
|
# Mean value, weighted by the percent of each cell that is covered.
|
|
197
|
-
"mean":
|
|
206
|
+
"mean": _mean,
|
|
198
207
|
# Sum of all non-masked cell coverage fractions.
|
|
199
|
-
"count":
|
|
208
|
+
"count": _count,
|
|
200
209
|
# Sum of values, weighted by their coverage fractions.
|
|
201
|
-
"sum":
|
|
210
|
+
"sum": _sum,
|
|
202
211
|
# Population standard deviation of cell values, taking into account coverage fraction.
|
|
203
|
-
"std":
|
|
212
|
+
"std": std,
|
|
204
213
|
# Median value of cells, weighted by the percent of each cell that is covered.
|
|
205
|
-
"median":
|
|
214
|
+
"median": med,
|
|
206
215
|
# The value occupying the greatest number of cells.
|
|
207
216
|
"majority": majority,
|
|
208
217
|
# The value occupying the least number of cells.
|
|
@@ -773,14 +782,15 @@ def resize_array(
|
|
|
773
782
|
category=NotGeoreferencedWarning,
|
|
774
783
|
module="rasterio",
|
|
775
784
|
)
|
|
776
|
-
with rasterio.
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
785
|
+
with rasterio.Env(GDAL_MEM_ENABLE_OPEN=True):
|
|
786
|
+
with rasterio.open(datasetname, "r+") as src:
|
|
787
|
+
# if a 2D array is passed, using indexes=1 makes sure we return an 2D array
|
|
788
|
+
indexes = 1 if len(data.shape) == 2 else None
|
|
789
|
+
return src.read(
|
|
790
|
+
out_shape=out_shape,
|
|
791
|
+
indexes=indexes,
|
|
792
|
+
resampling=Resampling[resampling_method],
|
|
793
|
+
)
|
|
784
794
|
|
|
785
795
|
|
|
786
796
|
def normalize_bounds(bounds: BBox) -> BBox:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rio-tiler
|
|
3
|
-
Version: 7.5.
|
|
3
|
+
Version: 7.5.1
|
|
4
4
|
Summary: User friendly Rasterio plugin to read raster datasets.
|
|
5
5
|
Project-URL: Homepage, https://cogeotiff.github.io/rio-tiler/
|
|
6
6
|
Project-URL: Documentation, https://cogeotiff.github.io/rio-tiler/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
rio_tiler/__init__.py,sha256=
|
|
1
|
+
rio_tiler/__init__.py,sha256=F5UhzpbBi4ZXUWqnpllv1a9P6HKq42umdO-eaGbWoGI,192
|
|
2
2
|
rio_tiler/colormap.py,sha256=E2FYp6AysmnSAhj2901XUrgB2q-8OvO8zoe_hmM_UZU,11186
|
|
3
3
|
rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
|
|
4
4
|
rio_tiler/errors.py,sha256=dnaAHPc5VL7SNKXm00gzlrU_4XIuw5rwzD-9Q2kFJsc,2018
|
|
@@ -10,7 +10,7 @@ rio_tiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
10
10
|
rio_tiler/reader.py,sha256=FiDQQU_v8mDk2JTxBpLmsTqaCQFOsjOw0LocasLeXjk,22721
|
|
11
11
|
rio_tiler/tasks.py,sha256=tiQo24rZHBVxids40QkNInuMzDFEei08zYW3I_pkSVE,3157
|
|
12
12
|
rio_tiler/types.py,sha256=wrGiiGBQ-WdzHf-lEypiH3cub7Knu_rXJw7EWZ2FAS8,1632
|
|
13
|
-
rio_tiler/utils.py,sha256=
|
|
13
|
+
rio_tiler/utils.py,sha256=uX8C0RxB_u1sJI3MCvQMdlolDJcWW5G4waU08VfYRF4,30249
|
|
14
14
|
rio_tiler/cmap_data/__init__.py,sha256=8FtVmfpTjXlvhxQ5QesN0UC1m_B3MuF3LbGbhMC5Rw4,1039
|
|
15
15
|
rio_tiler/cmap_data/accent.npy,sha256=Qde1ldOoXghe4L05v1QbVvnMA1ldwNjKWPf5xCBbmI4,1152
|
|
16
16
|
rio_tiler/cmap_data/accent_r.npy,sha256=ba-GWSMSPRAcm9CGzlXJeNG4ABbBHDCV602hAWV2idc,1152
|
|
@@ -235,8 +235,8 @@ rio_tiler/mosaic/reader.py,sha256=_YBwTJwHvXOzKwpNpOmmh0F4yicyxgWo9vHyof3w_Do,96
|
|
|
235
235
|
rio_tiler/mosaic/methods/__init__.py,sha256=tgkXM9skaTLXIm5QFoheOEznQXM97KGflcAWHfkrt1g,612
|
|
236
236
|
rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
|
|
237
237
|
rio_tiler/mosaic/methods/defaults.py,sha256=z34lna2wGXnAPwculjk_6hDrloqS8wzer68FFoIo7pg,6744
|
|
238
|
-
rio_tiler-7.5.
|
|
239
|
-
rio_tiler-7.5.
|
|
240
|
-
rio_tiler-7.5.
|
|
241
|
-
rio_tiler-7.5.
|
|
242
|
-
rio_tiler-7.5.
|
|
238
|
+
rio_tiler-7.5.1.dist-info/METADATA,sha256=bfMelVekvdymq27sGan75xpgbLgFRQWfuK3suHSOF4U,12230
|
|
239
|
+
rio_tiler-7.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
240
|
+
rio_tiler-7.5.1.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
|
|
241
|
+
rio_tiler-7.5.1.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
|
|
242
|
+
rio_tiler-7.5.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|