ssb-sgis 1.0.1__py3-none-any.whl → 1.0.2__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 (59) hide show
  1. sgis/__init__.py +97 -115
  2. sgis/exceptions.py +3 -1
  3. sgis/geopandas_tools/__init__.py +1 -0
  4. sgis/geopandas_tools/bounds.py +75 -38
  5. sgis/geopandas_tools/buffer_dissolve_explode.py +38 -34
  6. sgis/geopandas_tools/centerlines.py +53 -44
  7. sgis/geopandas_tools/cleaning.py +87 -104
  8. sgis/geopandas_tools/conversion.py +149 -101
  9. sgis/geopandas_tools/duplicates.py +31 -17
  10. sgis/geopandas_tools/general.py +76 -48
  11. sgis/geopandas_tools/geometry_types.py +21 -7
  12. sgis/geopandas_tools/neighbors.py +20 -8
  13. sgis/geopandas_tools/overlay.py +136 -53
  14. sgis/geopandas_tools/point_operations.py +9 -8
  15. sgis/geopandas_tools/polygon_operations.py +48 -56
  16. sgis/geopandas_tools/polygons_as_rings.py +121 -78
  17. sgis/geopandas_tools/sfilter.py +14 -14
  18. sgis/helpers.py +114 -56
  19. sgis/io/dapla_functions.py +32 -23
  20. sgis/io/opener.py +13 -6
  21. sgis/io/read_parquet.py +1 -1
  22. sgis/maps/examine.py +39 -26
  23. sgis/maps/explore.py +112 -66
  24. sgis/maps/httpserver.py +12 -12
  25. sgis/maps/legend.py +124 -65
  26. sgis/maps/map.py +66 -41
  27. sgis/maps/maps.py +31 -29
  28. sgis/maps/thematicmap.py +46 -33
  29. sgis/maps/tilesources.py +3 -8
  30. sgis/networkanalysis/_get_route.py +5 -4
  31. sgis/networkanalysis/_od_cost_matrix.py +44 -1
  32. sgis/networkanalysis/_points.py +10 -4
  33. sgis/networkanalysis/_service_area.py +5 -2
  34. sgis/networkanalysis/closing_network_holes.py +20 -62
  35. sgis/networkanalysis/cutting_lines.py +55 -43
  36. sgis/networkanalysis/directednetwork.py +15 -7
  37. sgis/networkanalysis/finding_isolated_networks.py +4 -3
  38. sgis/networkanalysis/network.py +15 -13
  39. sgis/networkanalysis/networkanalysis.py +72 -54
  40. sgis/networkanalysis/networkanalysisrules.py +20 -16
  41. sgis/networkanalysis/nodes.py +2 -3
  42. sgis/networkanalysis/traveling_salesman.py +5 -2
  43. sgis/parallel/parallel.py +337 -127
  44. sgis/raster/__init__.py +6 -0
  45. sgis/raster/base.py +9 -3
  46. sgis/raster/cube.py +280 -208
  47. sgis/raster/cubebase.py +15 -29
  48. sgis/raster/indices.py +3 -7
  49. sgis/raster/methods_as_functions.py +0 -124
  50. sgis/raster/raster.py +313 -127
  51. sgis/raster/torchgeo.py +58 -37
  52. sgis/raster/zonal.py +38 -13
  53. {ssb_sgis-1.0.1.dist-info → ssb_sgis-1.0.2.dist-info}/LICENSE +1 -1
  54. {ssb_sgis-1.0.1.dist-info → ssb_sgis-1.0.2.dist-info}/METADATA +87 -16
  55. ssb_sgis-1.0.2.dist-info/RECORD +61 -0
  56. {ssb_sgis-1.0.1.dist-info → ssb_sgis-1.0.2.dist-info}/WHEEL +1 -1
  57. sgis/raster/bands.py +0 -48
  58. sgis/raster/gradient.py +0 -78
  59. ssb_sgis-1.0.1.dist-info/RECORD +0 -63
sgis/raster/__init__.py CHANGED
@@ -0,0 +1,6 @@
1
+ try:
2
+ from .torchgeo import SENTINEL2_FILENAME_REGEX
3
+ from .torchgeo import SENTINEL_2_BANDS
4
+ from .torchgeo import SENTINEL_2_RBG_BANDS
5
+ except ImportError:
6
+ pass
sgis/raster/base.py CHANGED
@@ -1,10 +1,13 @@
1
1
  from contextlib import contextmanager
2
2
 
3
+ import numpy as np
4
+ import pandas as pd
3
5
  import rasterio
4
6
 
5
7
 
6
8
  @contextmanager
7
- def memfile_from_array(array, **profile):
9
+ def memfile_from_array(array: np.ndarray, **profile) -> rasterio.MemoryFile:
10
+ """Yield a memory file from a numpy array."""
8
11
  with rasterio.MemoryFile() as memfile:
9
12
  with memfile.open(**profile) as dataset:
10
13
  dataset.write(array, indexes=profile["indexes"])
@@ -12,7 +15,8 @@ def memfile_from_array(array, **profile):
12
15
  yield dataset
13
16
 
14
17
 
15
- def get_index_mapper(df):
18
+ def get_index_mapper(df: pd.DataFrame) -> tuple[dict[int, int], str]:
19
+ """Get a dict of index mapping and the name of the index."""
16
20
  idx_mapper = dict(enumerate(df.index))
17
21
  idx_name = df.index.name
18
22
  return idx_mapper, idx_name
@@ -42,5 +46,7 @@ PROFILE_ATTRS = [
42
46
  ]
43
47
 
44
48
  ALLOWED_KEYS = (
45
- NESSECARY_META + PROFILE_ATTRS + ["array", "res", "transform", "name", "date"]
49
+ NESSECARY_META
50
+ + PROFILE_ATTRS
51
+ + ["array", "res", "transform", "name", "date", "regex"]
46
52
  )