ssb-sgis 1.0.6__py3-none-any.whl → 1.0.8__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.
- sgis/helpers.py +23 -7
- sgis/maps/explore.py +14 -35
- sgis/maps/map.py +5 -1
- sgis/maps/tilesources.py +11 -29
- sgis/raster/base.py +0 -54
- sgis/raster/image_collection.py +936 -580
- sgis/raster/indices.py +2 -5
- sgis/raster/regex.py +7 -2
- sgis/raster/sentinel_config.py +1 -71
- {ssb_sgis-1.0.6.dist-info → ssb_sgis-1.0.8.dist-info}/METADATA +1 -1
- {ssb_sgis-1.0.6.dist-info → ssb_sgis-1.0.8.dist-info}/RECORD +13 -13
- {ssb_sgis-1.0.6.dist-info → ssb_sgis-1.0.8.dist-info}/LICENSE +0 -0
- {ssb_sgis-1.0.6.dist-info → ssb_sgis-1.0.8.dist-info}/WHEEL +0 -0
sgis/raster/indices.py
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
def ndvi(red: np.ndarray, nir: np.ndarray) -> np.ndarray:
|
|
5
|
-
|
|
6
|
-
nir = nir / 255
|
|
7
|
-
|
|
8
|
-
ndvi_values = (nir - red) / (nir + red)
|
|
4
|
+
def ndvi(red: np.ndarray, nir: np.ndarray, padding: int = 0) -> np.ndarray:
|
|
5
|
+
ndvi_values = (nir - red + padding) / (nir + red + padding)
|
|
9
6
|
ndvi_values[(red + nir) == 0] = 0
|
|
10
7
|
|
|
11
8
|
return ndvi_values
|
sgis/raster/regex.py
CHANGED
|
@@ -32,15 +32,20 @@ class _RegexError(ValueError):
|
|
|
32
32
|
pass
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def _any_regex_matches(xml_file: str, regexes: tuple[str]) -> bool:
|
|
35
|
+
def _any_regex_matches(xml_file: str, regexes: tuple[str]) -> bool | None:
|
|
36
|
+
n_matches = 0
|
|
36
37
|
for regex in regexes:
|
|
37
38
|
try:
|
|
38
39
|
if bool(re.search(regex, xml_file)):
|
|
39
40
|
return True
|
|
41
|
+
n_matches += 1
|
|
40
42
|
except (TypeError, AttributeError):
|
|
41
43
|
continue
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
if not n_matches:
|
|
46
|
+
return None
|
|
47
|
+
else:
|
|
48
|
+
return False
|
|
44
49
|
|
|
45
50
|
|
|
46
51
|
def _get_regex_match_from_xml_in_local_dir(
|
sgis/raster/sentinel_config.py
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import re
|
|
2
|
-
|
|
3
1
|
SENTINEL2_FILENAME_REGEX = r"""
|
|
4
2
|
^(?P<tile>T\d{2}[A-Z]{3})
|
|
5
3
|
_(?P<date>\d{8})T\d{6}
|
|
6
|
-
_(?P<band>B[018][\dA])
|
|
4
|
+
_(?P<band>B[018][\dA]|SCL)
|
|
7
5
|
(?:_(?P<resolution>\d+)m)?
|
|
8
6
|
.*
|
|
9
7
|
\..*$
|
|
10
8
|
"""
|
|
11
9
|
|
|
12
10
|
|
|
13
|
-
SENTINEL2_CLOUD_FILENAME_REGEX = r"""
|
|
14
|
-
^(?P<tile>T\d{2}[A-Z]{3})
|
|
15
|
-
_(?P<date>\d{8})T\d{6}
|
|
16
|
-
_(?P<band>SCL)
|
|
17
|
-
(?:_(?P<resolution>\d+)m)?
|
|
18
|
-
.*
|
|
19
|
-
\..*$
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
11
|
SENTINEL2_IMAGE_REGEX = r"""
|
|
23
12
|
^(?P<mission_id>S2[AB])
|
|
24
13
|
_MSI(?P<level>[A-Z]\d{1}[A-Z])
|
|
@@ -54,61 +43,6 @@ SENTINEL2_MOSAIC_IMAGE_REGEX = r"""
|
|
|
54
43
|
"""
|
|
55
44
|
|
|
56
45
|
|
|
57
|
-
# multiple regex searches because there are different xml files with same info, but different naming
|
|
58
|
-
CLOUD_COVERAGE_REGEXES: tuple[str] = (
|
|
59
|
-
r"<Cloud_Coverage_Assessment>([\d.]+)</Cloud_Coverage_Assessment>",
|
|
60
|
-
r"<CLOUDY_PIXEL_OVER_LAND_PERCENTAGE>([\d.]+)</CLOUDY_PIXEL_OVER_LAND_PERCENTAGE>",
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
BOA_QUANTIFICATION_VALUE_REGEXES: tuple[str] = (
|
|
64
|
-
r'<BOA_QUANTIFICATION_VALUE unit="none">(\d+)</BOA_QUANTIFICATION_VALUE>',
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
PROCESSING_BASELINE_REGEXES: tuple[str] = (
|
|
68
|
-
r"<PROCESSING_BASELINE>(.*?)</PROCESSING_BASELINE>",
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
CRS_REGEXES: tuple[str] = (r"<HORIZONTAL_CS_CODE>EPSG:(\d+)</HORIZONTAL_CS_CODE>",)
|
|
73
|
-
|
|
74
|
-
BOUNDS_REGEXES: tuple[dict[str, str]] = (
|
|
75
|
-
{"minx": r"<ULX>(\d+)</ULX>", "maxy": r"<ULY>(\d+)</ULY>"},
|
|
76
|
-
)
|
|
77
|
-
BOUNDS_REGEXES: tuple[re.Pattern] = (
|
|
78
|
-
re.compile(r"<ULX>(?P<minx>\d+)</ULX>"),
|
|
79
|
-
re.compile(r"<ULY>(?P<maxy>\d+)</ULY>"),
|
|
80
|
-
# )
|
|
81
|
-
# SHAPE_PATTERNS: tuple[re.Pattern] = (
|
|
82
|
-
re.compile(
|
|
83
|
-
r'<Size resolution="(?P<resolution>\d+)">\s*<NROWS>(?P<nrows>\d+)</NROWS>\s*<NCOLS>(?P<ncols>\d+)</NCOLS>\s*</Size>'
|
|
84
|
-
),
|
|
85
|
-
re.compile(
|
|
86
|
-
r"<Cloud_Coverage_Assessment>(?P<cloud_coverage_percentage>[\d.]+)</Cloud_Coverage_Assessment>"
|
|
87
|
-
),
|
|
88
|
-
re.compile(
|
|
89
|
-
r"<CLOUDY_PIXEL_OVER_LAND_PERCENTAGE>(?P<cloud_coverage_percentage>[\d.]+)</CLOUDY_PIXEL_OVER_LAND_PERCENTAGE>"
|
|
90
|
-
),
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
SENTINEL2_L2A_BANDS = {
|
|
94
|
-
"B01": 60,
|
|
95
|
-
"B02": 10,
|
|
96
|
-
"B03": 10,
|
|
97
|
-
"B04": 10,
|
|
98
|
-
"B05": 20,
|
|
99
|
-
"B06": 20,
|
|
100
|
-
"B07": 20,
|
|
101
|
-
"B08": 10,
|
|
102
|
-
"B8A": 20,
|
|
103
|
-
"B09": 60,
|
|
104
|
-
"B11": 20,
|
|
105
|
-
"B12": 20,
|
|
106
|
-
}
|
|
107
|
-
SENTINEL2_L1C_BANDS = SENTINEL2_L2A_BANDS | {"B10": 60}
|
|
108
|
-
SENTINEL2_CLOUD_BANDS = {
|
|
109
|
-
"SCL": 20, # SCL: scene classification
|
|
110
|
-
}
|
|
111
|
-
|
|
112
46
|
SENTINEL2_SCL_CLASSES = {
|
|
113
47
|
0: "No Data (Missing data)", # 000000
|
|
114
48
|
1: "Saturated or defective pixel", # ff0000
|
|
@@ -123,7 +57,3 @@ SENTINEL2_SCL_CLASSES = {
|
|
|
123
57
|
10: "Thin cirrus", # 64c8ff
|
|
124
58
|
11: "Snow or ice", # ff96ff
|
|
125
59
|
}
|
|
126
|
-
|
|
127
|
-
SENTINEL2_BANDS = SENTINEL2_L1C_BANDS | SENTINEL2_CLOUD_BANDS
|
|
128
|
-
SENTINEL2_RBG_BANDS = ["B02", "B03", "B04"]
|
|
129
|
-
SENTINEL2_NDVI_BANDS = ["B04", "B08"]
|
|
@@ -17,20 +17,20 @@ sgis/geopandas_tools/point_operations.py,sha256=JM4hvfIVxZaZdGNlGzcCurrKzkgC_b9h
|
|
|
17
17
|
sgis/geopandas_tools/polygon_operations.py,sha256=FJ-dXCxLHRsmp0oXsmBOFRprFFwmhrxqOPZkW2WWWQM,50088
|
|
18
18
|
sgis/geopandas_tools/polygons_as_rings.py,sha256=BX_GZS6F9I4NbEpiOlNBd7zywJjdfdJVi_MkeONBuiM,14941
|
|
19
19
|
sgis/geopandas_tools/sfilter.py,sha256=SLcMYprQwnY5DNo0R7TGXk4m6u26H8o4PRn-RPhmeZY,9345
|
|
20
|
-
sgis/helpers.py,sha256=
|
|
20
|
+
sgis/helpers.py,sha256=3NqPfVBKlZcZTiMJrsTAlDv5tNKDHrJr_8NimutVzQg,8797
|
|
21
21
|
sgis/io/_is_dapla.py,sha256=o_qFD5GOi3dsSGOKmW6R8wZU0htVwFgRbGX7ppJCqT4,431
|
|
22
22
|
sgis/io/dapla_functions.py,sha256=8dfxBtkGUy7vltlKydXkathBsSd9DPHVIDIOe-Ctjsg,18180
|
|
23
23
|
sgis/io/opener.py,sha256=BHyH7L8Ubh9C4Lsb8eBzGI6FLWg8UQFu-1bg3NEy_2k,862
|
|
24
24
|
sgis/io/read_parquet.py,sha256=FvZYv1rLkUlrSaUY6QW6E1yntmntTeQuZ9ZRgCDO4IM,3776
|
|
25
25
|
sgis/maps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
sgis/maps/examine.py,sha256=Pb0dH8JazU5E2svfQrzHO1Bi-sjy5SeyY6zoeMO34jE,9369
|
|
27
|
-
sgis/maps/explore.py,sha256=
|
|
27
|
+
sgis/maps/explore.py,sha256=mbSKFynLklJ3g4YfZJMDUo4K7Lg3sDoXDtnJ0l4L51w,45533
|
|
28
28
|
sgis/maps/httpserver.py,sha256=7Od9JMCtntcIQKk_TchetojMHzFHT9sPw7GANahI97c,1982
|
|
29
29
|
sgis/maps/legend.py,sha256=1ZOhzftq1HRKlHphhfqUm82U-Kjx_xkACieLRevxke8,26232
|
|
30
|
-
sgis/maps/map.py,sha256=
|
|
30
|
+
sgis/maps/map.py,sha256=4znVxefW2wVe_LSmGAVcJQxf3oF_6aAyppNo4EyYJH4,29431
|
|
31
31
|
sgis/maps/maps.py,sha256=HbKG1OHkSFYZ2dpgpag6H-LY1tOtZKaZncNNrBQpkU4,23127
|
|
32
32
|
sgis/maps/thematicmap.py,sha256=bFlZy2xSKmEOHhvM0d1pv8O9JuNjR3P_9colTJnduvE,20729
|
|
33
|
-
sgis/maps/tilesources.py,sha256=
|
|
33
|
+
sgis/maps/tilesources.py,sha256=F4mFHxPwkiPJdVKzNkScTX6xbJAMIUtlTq4mQ83oguw,1746
|
|
34
34
|
sgis/networkanalysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
35
|
sgis/networkanalysis/_get_route.py,sha256=9I3t9pnccUPr4mozy3TJCOpGCCf3UOIojmsbifubZbA,6368
|
|
36
36
|
sgis/networkanalysis/_od_cost_matrix.py,sha256=zkyPX7ObT996ahaFJ2oI0D0SqQWbWyfy_qLtXwValPg,3434
|
|
@@ -48,13 +48,13 @@ sgis/networkanalysis/traveling_salesman.py,sha256=Jjo6bHY4KJ-eK0LycyTy0sWxZjgITs
|
|
|
48
48
|
sgis/parallel/parallel.py,sha256=SlC_mOwvSSyWTKUcxLMGkuWHUkEC6dXTlN0Jn5cAtxA,39687
|
|
49
49
|
sgis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
50
|
sgis/raster/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
|
-
sgis/raster/base.py,sha256=
|
|
52
|
-
sgis/raster/image_collection.py,sha256=
|
|
53
|
-
sgis/raster/indices.py,sha256
|
|
54
|
-
sgis/raster/regex.py,sha256=
|
|
55
|
-
sgis/raster/sentinel_config.py,sha256
|
|
51
|
+
sgis/raster/base.py,sha256=Bdd30DS0iIv7fo93vrFoEBGC7a5PFaBXT46fcHwgORY,6558
|
|
52
|
+
sgis/raster/image_collection.py,sha256=XrQddJgpP-R0KeLEWeqsOBOaMExA9lCt0_5rR7tXku8,118307
|
|
53
|
+
sgis/raster/indices.py,sha256=-J1HYmnT240iozvgagvyis6K0_GHZHRuUrPOgyoeIrY,223
|
|
54
|
+
sgis/raster/regex.py,sha256=I7pTAYNoOFgcPRLllR4jGMhmRk8AkOgm1D38fDSFnlg,3745
|
|
55
|
+
sgis/raster/sentinel_config.py,sha256=nySDqn2R8M6W8jguoBeSAK_zzbAsqmaI59i32446FwY,1268
|
|
56
56
|
sgis/raster/zonal.py,sha256=st2mWiUcdxeEiHBOZSgFOnVcP6pc4EMPJBPw537Z4V8,3837
|
|
57
|
-
ssb_sgis-1.0.
|
|
58
|
-
ssb_sgis-1.0.
|
|
59
|
-
ssb_sgis-1.0.
|
|
60
|
-
ssb_sgis-1.0.
|
|
57
|
+
ssb_sgis-1.0.8.dist-info/LICENSE,sha256=np3IfD5m0ZUofn_kVzDZqliozuiO6wrktw3LRPjyEiI,1073
|
|
58
|
+
ssb_sgis-1.0.8.dist-info/METADATA,sha256=9Q_QyG0VOQAy9uhAi1kX64dVgb6AJ2xWwG91B_r_Nxo,11772
|
|
59
|
+
ssb_sgis-1.0.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
60
|
+
ssb_sgis-1.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|