ssb-sgis 1.0.2__py3-none-any.whl → 1.0.3__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.
Files changed (42) hide show
  1. sgis/__init__.py +10 -6
  2. sgis/exceptions.py +2 -2
  3. sgis/geopandas_tools/bounds.py +17 -15
  4. sgis/geopandas_tools/buffer_dissolve_explode.py +24 -5
  5. sgis/geopandas_tools/conversion.py +15 -6
  6. sgis/geopandas_tools/duplicates.py +2 -2
  7. sgis/geopandas_tools/general.py +9 -5
  8. sgis/geopandas_tools/geometry_types.py +3 -3
  9. sgis/geopandas_tools/neighbors.py +3 -3
  10. sgis/geopandas_tools/point_operations.py +2 -2
  11. sgis/geopandas_tools/polygon_operations.py +5 -5
  12. sgis/geopandas_tools/sfilter.py +3 -3
  13. sgis/helpers.py +3 -3
  14. sgis/io/read_parquet.py +1 -1
  15. sgis/maps/examine.py +16 -2
  16. sgis/maps/explore.py +370 -57
  17. sgis/maps/legend.py +164 -72
  18. sgis/maps/map.py +184 -90
  19. sgis/maps/maps.py +92 -90
  20. sgis/maps/thematicmap.py +236 -83
  21. sgis/networkanalysis/closing_network_holes.py +2 -2
  22. sgis/networkanalysis/cutting_lines.py +3 -3
  23. sgis/networkanalysis/directednetwork.py +1 -1
  24. sgis/networkanalysis/finding_isolated_networks.py +2 -2
  25. sgis/networkanalysis/networkanalysis.py +7 -7
  26. sgis/networkanalysis/networkanalysisrules.py +1 -1
  27. sgis/networkanalysis/traveling_salesman.py +1 -1
  28. sgis/parallel/parallel.py +39 -19
  29. sgis/raster/__init__.py +0 -6
  30. sgis/raster/cube.py +51 -5
  31. sgis/raster/image_collection.py +2560 -0
  32. sgis/raster/indices.py +14 -5
  33. sgis/raster/raster.py +131 -236
  34. sgis/raster/sentinel_config.py +104 -0
  35. sgis/raster/zonal.py +0 -1
  36. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.3.dist-info}/METADATA +1 -1
  37. ssb_sgis-1.0.3.dist-info/RECORD +61 -0
  38. sgis/raster/methods_as_functions.py +0 -0
  39. sgis/raster/torchgeo.py +0 -171
  40. ssb_sgis-1.0.2.dist-info/RECORD +0 -61
  41. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.3.dist-info}/LICENSE +0 -0
  42. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.3.dist-info}/WHEEL +0 -0
sgis/raster/indices.py CHANGED
@@ -7,7 +7,16 @@ from .raster import Raster
7
7
 
8
8
 
9
9
  def ndvi(red: np.ndarray, nir: np.ndarray) -> np.ndarray:
10
- return np.where((red + nir) == 0, 0, (nir - red) / (nir + red))
10
+ # normalize red and nir arrays to 0-1 scale if needed
11
+ if red.max() > 1 and nir.max() > 1:
12
+ red = red / 255
13
+ nir = nir / 255
14
+ elif red.max() > 1 or nir.max() > 1:
15
+ raise ValueError()
16
+
17
+ ndvi_values = np.where((red + nir) == 0, 0, (nir - red) / (nir + red))
18
+
19
+ return ndvi_values
11
20
 
12
21
 
13
22
  def gndvi(green: np.ndarray, nir: np.ndarray) -> np.ndarray:
@@ -70,13 +79,13 @@ def index_calc_pair(
70
79
  assert isinstance(r1, Raster), r1
71
80
  assert isinstance(r2, Raster), r2
72
81
 
73
- if r1.array is None:
82
+ if r1.values is None:
74
83
  r1 = r1.load()
75
- if r2.array is None:
84
+ if r2.values is None:
76
85
  r2 = r2.load()
77
86
 
78
- r1_arr: np.ndarray = r1.array.astype(np.float16)
79
- r2_arr: np.ndarray = r2.array.astype(np.float16)
87
+ r1_arr: np.ndarray = r1.values.astype(np.float16)
88
+ r2_arr: np.ndarray = r2.values.astype(np.float16)
80
89
 
81
90
  out_array = index_formula(r1_arr, r2_arr)
82
91