ssb-sgis 1.0.2__py3-none-any.whl → 1.0.4__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 (50) hide show
  1. sgis/__init__.py +20 -9
  2. sgis/debug_config.py +24 -0
  3. sgis/exceptions.py +2 -2
  4. sgis/geopandas_tools/bounds.py +33 -36
  5. sgis/geopandas_tools/buffer_dissolve_explode.py +136 -35
  6. sgis/geopandas_tools/centerlines.py +4 -91
  7. sgis/geopandas_tools/cleaning.py +1576 -583
  8. sgis/geopandas_tools/conversion.py +38 -19
  9. sgis/geopandas_tools/duplicates.py +29 -8
  10. sgis/geopandas_tools/general.py +263 -100
  11. sgis/geopandas_tools/geometry_types.py +4 -4
  12. sgis/geopandas_tools/neighbors.py +19 -15
  13. sgis/geopandas_tools/overlay.py +2 -2
  14. sgis/geopandas_tools/point_operations.py +5 -5
  15. sgis/geopandas_tools/polygon_operations.py +510 -105
  16. sgis/geopandas_tools/polygons_as_rings.py +40 -8
  17. sgis/geopandas_tools/sfilter.py +29 -12
  18. sgis/helpers.py +3 -3
  19. sgis/io/dapla_functions.py +238 -19
  20. sgis/io/read_parquet.py +1 -1
  21. sgis/maps/examine.py +27 -12
  22. sgis/maps/explore.py +450 -65
  23. sgis/maps/legend.py +177 -76
  24. sgis/maps/map.py +206 -103
  25. sgis/maps/maps.py +178 -105
  26. sgis/maps/thematicmap.py +243 -83
  27. sgis/networkanalysis/_service_area.py +6 -1
  28. sgis/networkanalysis/closing_network_holes.py +2 -2
  29. sgis/networkanalysis/cutting_lines.py +15 -8
  30. sgis/networkanalysis/directednetwork.py +1 -1
  31. sgis/networkanalysis/finding_isolated_networks.py +15 -8
  32. sgis/networkanalysis/networkanalysis.py +17 -19
  33. sgis/networkanalysis/networkanalysisrules.py +1 -1
  34. sgis/networkanalysis/traveling_salesman.py +1 -1
  35. sgis/parallel/parallel.py +64 -27
  36. sgis/raster/__init__.py +0 -6
  37. sgis/raster/base.py +208 -0
  38. sgis/raster/cube.py +54 -8
  39. sgis/raster/image_collection.py +3257 -0
  40. sgis/raster/indices.py +17 -5
  41. sgis/raster/raster.py +138 -243
  42. sgis/raster/sentinel_config.py +120 -0
  43. sgis/raster/zonal.py +0 -1
  44. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.4.dist-info}/METADATA +6 -7
  45. ssb_sgis-1.0.4.dist-info/RECORD +62 -0
  46. sgis/raster/methods_as_functions.py +0 -0
  47. sgis/raster/torchgeo.py +0 -171
  48. ssb_sgis-1.0.2.dist-info/RECORD +0 -61
  49. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.4.dist-info}/LICENSE +0 -0
  50. {ssb_sgis-1.0.2.dist-info → ssb_sgis-1.0.4.dist-info}/WHEEL +0 -0
sgis/raster/indices.py CHANGED
@@ -7,7 +7,19 @@ 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
+ red = red / 255
17
+ nir = nir / 255
18
+
19
+ ndvi_values = (nir - red) / (nir + red)
20
+ ndvi_values[(red + nir) == 0] = 0
21
+
22
+ return ndvi_values
11
23
 
12
24
 
13
25
  def gndvi(green: np.ndarray, nir: np.ndarray) -> np.ndarray:
@@ -70,13 +82,13 @@ def index_calc_pair(
70
82
  assert isinstance(r1, Raster), r1
71
83
  assert isinstance(r2, Raster), r2
72
84
 
73
- if r1.array is None:
85
+ if r1.values is None:
74
86
  r1 = r1.load()
75
- if r2.array is None:
87
+ if r2.values is None:
76
88
  r2 = r2.load()
77
89
 
78
- r1_arr: np.ndarray = r1.array.astype(np.float16)
79
- r2_arr: np.ndarray = r2.array.astype(np.float16)
90
+ r1_arr: np.ndarray = r1.values.astype(np.float16)
91
+ r2_arr: np.ndarray = r2.values.astype(np.float16)
80
92
 
81
93
  out_array = index_formula(r1_arr, r2_arr)
82
94