dea-tools 0.3.4.dev25__tar.gz → 0.3.4.dev47__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.4.dev25/dea_tools.egg-info → dea_tools-0.3.4.dev47}/PKG-INFO +1 -1
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/spatial.py +75 -5
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/wetlands.py +1 -1
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47/dea_tools.egg-info}/PKG-INFO +1 -1
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/index.rst +1 -1
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/.gitignore +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/LICENSE +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/MANIFEST.in +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/README.rst +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/__init__.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/__main__.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/__init__.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/animations.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/changefilmstrips.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/crophealth.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/deacoastlines.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/geomedian.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/imageexport.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/miningrehab.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/app/widgetconstructors.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/bandindices.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/bom.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/classification.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/climate.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/coastal.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/dask.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/datahandling.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/landcover.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/maps.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/plotting.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/pyfes_model.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/temporal.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/validation.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools/waterbodies.py +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools.egg-info/SOURCES.txt +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools.egg-info/dependency_links.txt +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools.egg-info/requires.txt +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/dea_tools.egg-info/top_level.txt +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/mock_imports.txt +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/pyproject.toml +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/setup.cfg +0 -0
- {dea_tools-0.3.4.dev25 → dea_tools-0.3.4.dev47}/setup.py +0 -0
|
@@ -16,7 +16,7 @@ here: https://gis.stackexchange.com/questions/tagged/open-data-cube).
|
|
|
16
16
|
If you would like to report an issue with this script, file one on
|
|
17
17
|
GitHub: https://github.com/GeoscienceAustralia/dea-notebooks/issues/new
|
|
18
18
|
|
|
19
|
-
Last modified:
|
|
19
|
+
Last modified: July 2024
|
|
20
20
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
@@ -33,8 +33,6 @@ import geopandas as gpd
|
|
|
33
33
|
import rasterio.features
|
|
34
34
|
import scipy.interpolate
|
|
35
35
|
import multiprocessing as mp
|
|
36
|
-
from odc.geo.geom import Geometry
|
|
37
|
-
from odc.geo.crs import CRS
|
|
38
36
|
from scipy import ndimage as nd
|
|
39
37
|
from scipy.spatial import cKDTree as KDTree
|
|
40
38
|
from skimage.measure import label
|
|
@@ -42,9 +40,74 @@ from rasterstats import zonal_stats
|
|
|
42
40
|
from skimage.measure import find_contours
|
|
43
41
|
from geopy.geocoders import Nominatim
|
|
44
42
|
from geopy.exc import GeocoderUnavailable, GeocoderServiceError
|
|
43
|
+
from shapely.geometry import (
|
|
44
|
+
MultiPoint,
|
|
45
|
+
MultiLineString,
|
|
46
|
+
LineString,
|
|
47
|
+
Polygon,
|
|
48
|
+
MultiPolygon,
|
|
49
|
+
Point,
|
|
50
|
+
shape,
|
|
51
|
+
mapping,
|
|
52
|
+
)
|
|
45
53
|
|
|
46
54
|
from datacube.utils.cog import write_cog
|
|
47
|
-
from
|
|
55
|
+
from odc.geo.geom import Geometry
|
|
56
|
+
from odc.geo.crs import CRS
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _geom_to_multipoint(geom):
|
|
60
|
+
"""
|
|
61
|
+
Convert a LineString, MultiLineString, Polygon, MultiPolygon or
|
|
62
|
+
Point to a MultiPoint geometry.
|
|
63
|
+
"""
|
|
64
|
+
if isinstance(geom, LineString):
|
|
65
|
+
points = list(geom.coords)
|
|
66
|
+
elif isinstance(geom, MultiLineString):
|
|
67
|
+
points = [point for line in geom.geoms for point in line.coords]
|
|
68
|
+
elif isinstance(geom, Polygon):
|
|
69
|
+
points = list(geom.boundary.coords)
|
|
70
|
+
elif isinstance(geom, MultiPolygon):
|
|
71
|
+
points = [point for poly in geom.boundary.geoms for point in poly.coords]
|
|
72
|
+
elif isinstance(geom, Point):
|
|
73
|
+
points = [geom]
|
|
74
|
+
elif isinstance(geom, MultiPoint):
|
|
75
|
+
points = [point for point in geom.geoms]
|
|
76
|
+
|
|
77
|
+
return MultiPoint(points)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def extract_vertices(gdf, explode=True, ignore_index=True):
|
|
81
|
+
"""
|
|
82
|
+
Extract vertices from any GeoDataFrame features, returning Point or
|
|
83
|
+
MultiPoint geometries.
|
|
84
|
+
|
|
85
|
+
Parameters
|
|
86
|
+
----------
|
|
87
|
+
gdf : geopandas.GeoDataFrame
|
|
88
|
+
Input GeoDataFrame containing geometries to be converted.
|
|
89
|
+
explode : bool, optional
|
|
90
|
+
By default, MultiPoint geometries will be exploded into individual
|
|
91
|
+
Points. If False, geometries will be returned as MultiPoints.
|
|
92
|
+
ignore_index : bool, optional
|
|
93
|
+
If True and explode=True, the resulting GeoDataFrame will have a
|
|
94
|
+
new index.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
geopandas.GeoDataFrame
|
|
99
|
+
Updated GeoDataFrame with geometries converted to Points or
|
|
100
|
+
MultiPoints.
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
# Convert all input features to MultiPoints
|
|
104
|
+
gdf["geometry"] = gdf["geometry"].apply(_geom_to_multipoint)
|
|
105
|
+
|
|
106
|
+
# Optionally break MultiPoints into individual Points
|
|
107
|
+
if explode:
|
|
108
|
+
gdf = gdf.explode(ignore_index=ignore_index)
|
|
109
|
+
|
|
110
|
+
return gdf
|
|
48
111
|
|
|
49
112
|
|
|
50
113
|
def points_on_line(gdf, index, distance=30):
|
|
@@ -850,7 +913,7 @@ def xr_interpolate(
|
|
|
850
913
|
|
|
851
914
|
# Run interpolation on values from each numeric column,
|
|
852
915
|
for col, z_values in numeric_gdf.items():
|
|
853
|
-
|
|
916
|
+
|
|
854
917
|
# Apply scipy.interpolate.griddata interpolation methods
|
|
855
918
|
if method in ("linear", "nearest", "cubic"):
|
|
856
919
|
# Interpolate x, y and z values
|
|
@@ -1047,6 +1110,13 @@ def contours_to_arrays(gdf, col):
|
|
|
1047
1110
|
of each vertex in the input GeoDataFrame.
|
|
1048
1111
|
|
|
1049
1112
|
"""
|
|
1113
|
+
|
|
1114
|
+
warnings.warn(
|
|
1115
|
+
"This function is deprecated and will be retired in a future "
|
|
1116
|
+
"release. Please use `extract_vertices` instead.",
|
|
1117
|
+
DeprecationWarning,
|
|
1118
|
+
stacklevel=2,
|
|
1119
|
+
)
|
|
1050
1120
|
|
|
1051
1121
|
coords_zvals = []
|
|
1052
1122
|
|
|
@@ -274,7 +274,7 @@ def display_wit_stack_with_df(
|
|
|
274
274
|
["open water", "wet", "green veg", "dry veg", "bare soil"][::-1],
|
|
275
275
|
loc="lower left",
|
|
276
276
|
)
|
|
277
|
-
handles = legend.
|
|
277
|
+
handles = legend.legend_handles
|
|
278
278
|
|
|
279
279
|
for i, handle in enumerate(handles):
|
|
280
280
|
handle.set_facecolor(pal[::-1][i])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
DEA Tools Package
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
``dea_tools`` is
|
|
4
|
+
``dea_tools`` is an open-source Python package containing functions and algorithms to assist in analysing DEA data.
|
|
5
5
|
|
|
6
6
|
This package is installed by default in the DEA Sandbox. You can install it to your own environment from `PyPi <https://pypi.org/project/dea-tools/>`_ by running ``pip install dea-tools``. Learn more in the `DEA Tools Readme <https://github.com/GeoscienceAustralia/dea-notebooks/tree/develop/Tools/>`_.
|
|
7
7
|
|
|
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
|