dea-tools 0.3.5.dev13__tar.gz → 0.3.5.dev21__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.
- {dea_tools-0.3.5.dev13/dea_tools.egg-info → dea_tools-0.3.5.dev21}/PKG-INFO +2 -2
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/classification.py +35 -12
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21/dea_tools.egg-info}/PKG-INFO +2 -2
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools.egg-info/requires.txt +1 -1
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/setup.py +1 -1
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/.gitignore +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/LICENSE +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/MANIFEST.in +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/README.rst +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/__init__.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/__main__.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/__init__.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/animations.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/changefilmstrips.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/crophealth.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/deacoastlines.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/geomedian.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/imageexport.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/miningrehab.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/app/widgetconstructors.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/bandindices.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/bom.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/climate.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/coastal.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/dask.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/datahandling.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/landcover.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/maps.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/plotting.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/pyfes_model.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/spatial.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/temporal.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/validation.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/waterbodies.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools/wetlands.py +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools.egg-info/SOURCES.txt +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools.egg-info/dependency_links.txt +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/dea_tools.egg-info/top_level.txt +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/index.rst +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/mock_imports.txt +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/pyproject.toml +0 -0
- {dea_tools-0.3.5.dev13 → dea_tools-0.3.5.dev21}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dea-tools
|
|
3
|
-
Version: 0.3.5.
|
|
3
|
+
Version: 0.3.5.dev21
|
|
4
4
|
Summary: Functions and algorithms for analysing Digital Earth Australia data.
|
|
5
5
|
Home-page: https://github.com/GeoscienceAustralia/dea-notebooks
|
|
6
6
|
Author: Geoscience Australia
|
|
@@ -44,7 +44,7 @@ Requires-Dist: pyproj
|
|
|
44
44
|
Requires-Dist: pystac-client
|
|
45
45
|
Requires-Dist: planetary-computer
|
|
46
46
|
Requires-Dist: python-dateutil
|
|
47
|
-
Requires-Dist: pyTMD
|
|
47
|
+
Requires-Dist: pyTMD<2.1.5,>=2.0.0
|
|
48
48
|
Requires-Dist: pytz
|
|
49
49
|
Requires-Dist: rasterio
|
|
50
50
|
Requires-Dist: rasterstats
|
|
@@ -226,6 +226,7 @@ def predict_xr(
|
|
|
226
226
|
chunk_size=None,
|
|
227
227
|
persist=False,
|
|
228
228
|
proba=False,
|
|
229
|
+
max_proba=True,
|
|
229
230
|
clean=False,
|
|
230
231
|
return_input=False,
|
|
231
232
|
):
|
|
@@ -255,6 +256,11 @@ def predict_xr(
|
|
|
255
256
|
distributed RAM.
|
|
256
257
|
proba : bool
|
|
257
258
|
If True, predict probabilities
|
|
259
|
+
max_proba : bool
|
|
260
|
+
If True, the probabilities array will be flattened to contain
|
|
261
|
+
only the probabiltiy for the "Predictions" class. If False,
|
|
262
|
+
the "Probabilities" object will be an array of prediction
|
|
263
|
+
probaiblities for each classes
|
|
258
264
|
clean : bool
|
|
259
265
|
If True, remove Infs and NaNs from input and output arrays
|
|
260
266
|
return_input : bool
|
|
@@ -282,7 +288,7 @@ def predict_xr(
|
|
|
282
288
|
input_xr.chunks["y"][0]
|
|
283
289
|
)
|
|
284
290
|
|
|
285
|
-
def _predict_func(model, input_xr, persist, proba, clean, return_input):
|
|
291
|
+
def _predict_func(model, input_xr, persist, proba, max_proba, clean, return_input):
|
|
286
292
|
x, y, crs = input_xr.x, input_xr.y, input_xr.geobox.crs
|
|
287
293
|
|
|
288
294
|
input_data = []
|
|
@@ -330,18 +336,35 @@ def predict_xr(
|
|
|
330
336
|
print(" probabilities...")
|
|
331
337
|
out_proba = model.predict_proba(input_data_flattened)
|
|
332
338
|
|
|
333
|
-
#
|
|
334
|
-
|
|
339
|
+
# return either one band with the max probability, or the whole probability array
|
|
340
|
+
if max_proba == True:
|
|
341
|
+
print(" returning single probability band.")
|
|
342
|
+
out_proba = da.max(out_proba, axis=1) * 100.0
|
|
343
|
+
out_proba = out_proba.reshape(len(y), len(x))
|
|
344
|
+
out_proba = xr.DataArray(
|
|
345
|
+
out_proba, coords={"x": x, "y": y}, dims=["y", "x"]
|
|
346
|
+
)
|
|
347
|
+
output_xr["Probabilities"] = out_proba
|
|
348
|
+
else:
|
|
349
|
+
print(" returning class probability array.")
|
|
350
|
+
out_proba = out_proba * 100.0
|
|
351
|
+
class_names = model.classes_ # Get the unique class names from the fitted classifier
|
|
352
|
+
|
|
353
|
+
# Loop through each class (band)
|
|
354
|
+
probabilities_dataset = xr.Dataset()
|
|
355
|
+
for i, class_name in enumerate(class_names):
|
|
356
|
+
reshaped_band = out_proba[:, i].reshape(len(y), len(x))
|
|
357
|
+
reshaped_da = xr.DataArray(
|
|
358
|
+
reshaped_band, coords={"x": x, "y": y}, dims=["y", "x"]
|
|
359
|
+
)
|
|
360
|
+
probabilities_dataset[f"prob_{class_name}"] = reshaped_da
|
|
335
361
|
|
|
362
|
+
# merge in the probabilities
|
|
363
|
+
output_xr = xr.merge([output_xr, probabilities_dataset])
|
|
364
|
+
|
|
336
365
|
if clean == True:
|
|
337
366
|
out_proba = da.where(da.isfinite(out_proba), out_proba, 0)
|
|
338
|
-
|
|
339
|
-
out_proba = out_proba.reshape(len(y), len(x))
|
|
340
|
-
|
|
341
|
-
out_proba = xr.DataArray(
|
|
342
|
-
out_proba, coords={"x": x, "y": y}, dims=["y", "x"]
|
|
343
|
-
)
|
|
344
|
-
output_xr["Probabilities"] = out_proba
|
|
367
|
+
|
|
345
368
|
|
|
346
369
|
if return_input == True:
|
|
347
370
|
print(" input features...")
|
|
@@ -391,12 +414,12 @@ def predict_xr(
|
|
|
391
414
|
model = ParallelPostFit(model)
|
|
392
415
|
with joblib.parallel_backend("dask"):
|
|
393
416
|
output_xr = _predict_func(
|
|
394
|
-
model, input_xr, persist, proba, clean, return_input
|
|
417
|
+
model, input_xr, persist, proba, max_proba, clean, return_input
|
|
395
418
|
)
|
|
396
419
|
|
|
397
420
|
else:
|
|
398
421
|
output_xr = _predict_func(
|
|
399
|
-
model, input_xr, persist, proba, clean, return_input
|
|
422
|
+
model, input_xr, persist, proba, max_proba, clean, return_input
|
|
400
423
|
).compute()
|
|
401
424
|
|
|
402
425
|
return output_xr
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dea-tools
|
|
3
|
-
Version: 0.3.5.
|
|
3
|
+
Version: 0.3.5.dev21
|
|
4
4
|
Summary: Functions and algorithms for analysing Digital Earth Australia data.
|
|
5
5
|
Home-page: https://github.com/GeoscienceAustralia/dea-notebooks
|
|
6
6
|
Author: Geoscience Australia
|
|
@@ -44,7 +44,7 @@ Requires-Dist: pyproj
|
|
|
44
44
|
Requires-Dist: pystac-client
|
|
45
45
|
Requires-Dist: planetary-computer
|
|
46
46
|
Requires-Dist: python-dateutil
|
|
47
|
-
Requires-Dist: pyTMD
|
|
47
|
+
Requires-Dist: pyTMD<2.1.5,>=2.0.0
|
|
48
48
|
Requires-Dist: pytz
|
|
49
49
|
Requires-Dist: rasterio
|
|
50
50
|
Requires-Dist: rasterstats
|
|
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
|