ssb-sgis 1.2.15__tar.gz → 1.2.17__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.
Files changed (67) hide show
  1. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/PKG-INFO +3 -6
  2. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/README.md +1 -1
  3. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/pyproject.toml +5 -8
  4. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/conversion.py +3 -5
  5. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/io/dapla_functions.py +1 -0
  6. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/examine.py +2 -4
  7. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/map.py +4 -2
  8. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/networkanalysisrules.py +3 -3
  9. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/image_collection.py +23 -19
  10. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/LICENSE +0 -0
  11. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/__init__.py +0 -0
  12. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/conf.py +0 -0
  13. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/debug_config.py +0 -0
  14. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/exceptions.py +0 -0
  15. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/__init__.py +0 -0
  16. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/bounds.py +0 -0
  17. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/buffer_dissolve_explode.py +0 -0
  18. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/centerlines.py +0 -0
  19. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/cleaning.py +0 -0
  20. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/duplicates.py +0 -0
  21. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/general.py +0 -0
  22. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/geocoding.py +0 -0
  23. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/geometry_types.py +0 -0
  24. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/neighbors.py +0 -0
  25. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/overlay.py +0 -0
  26. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/point_operations.py +0 -0
  27. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/polygon_operations.py +0 -0
  28. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/polygons_as_rings.py +0 -0
  29. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/runners.py +0 -0
  30. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/sfilter.py +0 -0
  31. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/geopandas_tools/utils.py +0 -0
  32. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/helpers.py +0 -0
  33. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/io/__init__.py +0 -0
  34. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/io/_is_dapla.py +0 -0
  35. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/io/opener.py +0 -0
  36. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/io/read_parquet.py +0 -0
  37. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/__init__.py +0 -0
  38. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/explore.py +0 -0
  39. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/httpserver.py +0 -0
  40. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/legend.py +0 -0
  41. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/maps.py +0 -0
  42. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/norge_i_bilder.json +0 -0
  43. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/thematicmap.py +0 -0
  44. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/tilesources.py +0 -0
  45. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/maps/wms.py +0 -0
  46. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/__init__.py +0 -0
  47. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/_get_route.py +0 -0
  48. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/_od_cost_matrix.py +0 -0
  49. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/_points.py +0 -0
  50. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/_service_area.py +0 -0
  51. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/closing_network_holes.py +0 -0
  52. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/cutting_lines.py +0 -0
  53. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/directednetwork.py +0 -0
  54. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/finding_isolated_networks.py +0 -0
  55. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/network.py +0 -0
  56. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/networkanalysis.py +0 -0
  57. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/nodes.py +0 -0
  58. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/networkanalysis/traveling_salesman.py +0 -0
  59. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/parallel/__init__.py +0 -0
  60. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/parallel/parallel.py +0 -0
  61. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/py.typed +0 -0
  62. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/__init__.py +0 -0
  63. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/base.py +0 -0
  64. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/indices.py +0 -0
  65. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/regex.py +0 -0
  66. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/sentinel_config.py +0 -0
  67. {ssb_sgis-1.2.15 → ssb_sgis-1.2.17}/src/sgis/raster/zonal.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ssb-sgis
3
- Version: 1.2.15
3
+ Version: 1.2.17
4
4
  Summary: GIS functions used at Statistics Norway.
5
5
  Home-page: https://github.com/statisticsnorway/ssb-sgis
6
6
  License: MIT
@@ -17,7 +17,6 @@ Classifier: Topic :: Scientific/Engineering :: GIS
17
17
  Provides-Extra: all
18
18
  Provides-Extra: bucket
19
19
  Provides-Extra: test
20
- Provides-Extra: torch
21
20
  Provides-Extra: xarray
22
21
  Requires-Dist: affine (>=2.4.0)
23
22
  Requires-Dist: branca (>=0.6.0)
@@ -35,7 +34,7 @@ Requires-Dist: mapclassify (>=2.5.0)
35
34
  Requires-Dist: matplotlib (>=3.7.0)
36
35
  Requires-Dist: networkx (>=3.0)
37
36
  Requires-Dist: numpy (>=1.26.4)
38
- Requires-Dist: pandas (>=2.2.1)
37
+ Requires-Dist: pandas (>=2.0.1)
39
38
  Requires-Dist: pyarrow (>=11.0.0)
40
39
  Requires-Dist: pyproj (>=3.6.1)
41
40
  Requires-Dist: rasterio (>=1.3.8)
@@ -44,8 +43,6 @@ Requires-Dist: rioxarray (>=0.15.5) ; extra == "all" or extra == "xarray" or ext
44
43
  Requires-Dist: rtree (>=1.0.1)
45
44
  Requires-Dist: scikit-learn (>=1.2.1)
46
45
  Requires-Dist: shapely (>=2.0.1)
47
- Requires-Dist: torch (>=2.4.0) ; extra == "all" or extra == "torch" or extra == "test"
48
- Requires-Dist: torchgeo (>=0.5.2) ; extra == "all" or extra == "torch" or extra == "test"
49
46
  Requires-Dist: typing-extensions (>=4.11.0)
50
47
  Requires-Dist: xarray (>=2024.3.0) ; extra == "all" or extra == "xarray" or extra == "test"
51
48
  Requires-Dist: xyzservices (>=2023.2.0)
@@ -98,7 +95,7 @@ pip install ssb-sgis
98
95
 
99
96
  The sgis package has the following optional dependencies:
100
97
 
101
- - bucket: For working with files stored in GCP buckets
98
+ - bucket: For working with files stored in GCS buckets
102
99
  - torch: Use functionality from PyTorch and torchgeo
103
100
  - xarray: Use functionality from xarray and rioxarray
104
101
  - test: Packages needed for running pytest
@@ -42,7 +42,7 @@ pip install ssb-sgis
42
42
 
43
43
  The sgis package has the following optional dependencies:
44
44
 
45
- - bucket: For working with files stored in GCP buckets
45
+ - bucket: For working with files stored in GCS buckets
46
46
  - torch: Use functionality from PyTorch and torchgeo
47
47
  - xarray: Use functionality from xarray and rioxarray
48
48
  - test: Packages needed for running pytest
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssb-sgis"
3
- version = "1.2.15"
3
+ version = "1.2.17"
4
4
  description = "GIS functions used at Statistics Norway."
5
5
  authors = ["Morten Letnes <morten.letnes@ssb.no>"]
6
6
  license = "MIT"
@@ -21,7 +21,6 @@ Changelog = "https://github.com/statisticsnorway/ssb-sgis/releases"
21
21
  python = ">=3.10,<4"
22
22
  affine = ">=2.4.0"
23
23
  branca = ">=0.6.0"
24
- dask = { version = ">=2024.1.1", optional = true }
25
24
  folium = ">=0.14.0"
26
25
  geopandas = ">=0.14.0"
27
26
  igraph = ">=0.11.2"
@@ -33,7 +32,7 @@ mapclassify = ">=2.5.0"
33
32
  matplotlib = ">=3.7.0"
34
33
  networkx = ">=3.0"
35
34
  numpy = ">=1.26.4"
36
- pandas = ">=2.2.1"
35
+ pandas = ">=2.0.1"
37
36
  pyarrow = ">=11.0.0"
38
37
  pyproj = ">=3.6.1"
39
38
  rasterio = ">=1.3.8"
@@ -43,19 +42,17 @@ scikit-learn = ">=1.2.1"
43
42
  shapely = ">=2.0.1"
44
43
  typing-extensions = ">=4.11.0"
45
44
  xyzservices = ">=2023.2.0"
45
+ dask = { version = ">=2024.1.1", optional = true }
46
46
  xarray = { version = ">=2024.3.0", optional = true }
47
47
  rioxarray = { version = ">=0.15.5", optional = true }
48
- torch = { version = ">=2.4.0", optional = true }
49
- torchgeo = { version = ">=0.5.2", optional = true }
50
48
  dapla-toolbelt = { version = ">=3.0.1", optional = true }
51
49
  gcsfs = { version = ">=2024.3.1", optional = true }
52
50
 
53
51
  [tool.poetry.extras]
54
- all = ["pyogrio", "xarray", "rioxarray", "torch", "torchgeo", "dapla-toolbelt", "gcsfs", "dask"]
52
+ all = ["pyogrio", "xarray", "rioxarray", "dapla-toolbelt", "gcsfs", "dask"]
55
53
  bucket = ["dapla-toolbelt", "gcsfs"]
56
- torch = ["torch", "torchgeo"]
57
54
  xarray = ["xarray", "rioxarray"]
58
- test = ["xarray", "rioxarray", "torch", "torchgeo", "dask"]
55
+ test = ["xarray", "rioxarray", "dask"]
59
56
 
60
57
  [tool.poetry.group.dev.dependencies]
61
58
  pygments = ">=2.10.0"
@@ -507,7 +507,7 @@ def to_gdf(
507
507
  geoseries = GeoSeries(_make_shapely_geoms(obj.iloc[:, 0]), index=index)
508
508
  return GeoDataFrame({key: geoseries}, geometry=key, crs=crs, **kwargs)
509
509
 
510
- if geometry and geom_col not in obj or isinstance(obj, pd.DataFrame):
510
+ if (geometry and geom_col not in obj) or isinstance(obj, pd.DataFrame):
511
511
  raise ValueError("Cannot find geometry column(s)", geometry)
512
512
 
513
513
  # geojson, __geo_interface__
@@ -595,10 +595,8 @@ def is_nested_geojson(obj: Any) -> bool:
595
595
 
596
596
  def get_crs_from_dict(obj: Any) -> CRS | None | Any:
597
597
  """Try to extract the 'crs' attribute of the object or an object in the object."""
598
- if (
599
- not hasattr(obj, "__iter__")
600
- or not is_dict_like(obj)
601
- and not is_dict_like(obj[0])
598
+ if not hasattr(obj, "__iter__") or (
599
+ not is_dict_like(obj) and not is_dict_like(obj[0])
602
600
  ):
603
601
  return None
604
602
 
@@ -932,6 +932,7 @@ def _get_files_in_subfolders(folderinfo: list[dict]) -> list[tuple]:
932
932
 
933
933
 
934
934
  def _maybe_strip_prefix(path, file_system):
935
+ """Strip gcs prefix only if file_system is GCS."""
935
936
  if isinstance(file_system, GCSFileSystem) and path.startswith("gs://"):
936
937
  return path.replace("gs://", "")
937
938
  return path
@@ -121,10 +121,8 @@ class Examine:
121
121
  )
122
122
 
123
123
  if sort_values is not None:
124
- if (
125
- sort_values == "area"
126
- or not isinstance(sort_values, str)
127
- and "area" in sort_values
124
+ if sort_values == "area" or (
125
+ not isinstance(sort_values, str) and "area" in sort_values
128
126
  ):
129
127
  self.mask_gdf["area"] = self.mask_gdf.area
130
128
  self.mask_gdf = self.mask_gdf.sort_values(sort_values)
@@ -543,8 +543,10 @@ class Map:
543
543
  def is_maybe_km2():
544
544
  if "area" in self._column and (
545
545
  "km2" in self._column
546
- or "kilomet" in self._column
547
- and ("sq" in self._column or "2" in self._column)
546
+ or (
547
+ "kilomet" in self._column
548
+ and ("sq" in self._column or "2" in self._column)
549
+ )
548
550
  ):
549
551
  return True
550
552
  else:
@@ -209,15 +209,15 @@ class NetworkAnalysisRules:
209
209
  return True
210
210
 
211
211
  def _validate_weight(self, gdf: GeoDataFrame) -> GeoDataFrame:
212
- if "meter" in self.weight or "metre" in self.weight and unit_is_meters(gdf):
212
+ if "meter" in self.weight or ("metre" in self.weight and unit_is_meters(gdf)):
213
213
  if self.nodedist_kmh:
214
214
  raise ValueError("Cannot set 'nodedist_kmh' when 'weight' is meters.")
215
215
  gdf[self.weight] = gdf.length
216
216
  return gdf
217
217
 
218
218
  # allow abbreviation of 'minutes' to be nice
219
- elif (
220
- self.weight == "min" or "minut" in self.weight and "minutes" in gdf.columns
219
+ elif self.weight == "min" or (
220
+ "minut" in self.weight and "minutes" in gdf.columns
221
221
  ):
222
222
  if self.nodedist_multiplier:
223
223
  raise ValueError(
@@ -629,6 +629,8 @@ class _ImageBase:
629
629
  for key, value in self.__dict__.items():
630
630
  if key.startswith("_"):
631
631
  continue
632
+ if key == "file_system" and type(value) is type(getattr(other, key)):
633
+ continue
632
634
  if value != getattr(other, key):
633
635
  print(key, value, getattr(other, key))
634
636
  return False
@@ -747,9 +749,8 @@ class _ImageBandBase(_ImageBase):
747
749
  continue
748
750
  if results is not None:
749
751
  break
750
- elif (
751
- isinstance(value, str)
752
- or hasattr(value, "__iter__")
752
+ elif isinstance(value, str) or (
753
+ hasattr(value, "__iter__")
753
754
  and all(isinstance(x, str | re.Pattern) for x in value)
754
755
  ):
755
756
  try:
@@ -1538,9 +1539,8 @@ class Image(_ImageBandBase):
1538
1539
  else:
1539
1540
  self._all_file_paths = None
1540
1541
 
1541
- if (
1542
- self.metadata is None
1543
- or not len(self.metadata)
1542
+ if self.metadata is None or (
1543
+ not len(self.metadata)
1544
1544
  and "metadata.json" in {Path(x).name for x in self._all_file_paths}
1545
1545
  ):
1546
1546
  with _open_func(
@@ -1845,7 +1845,8 @@ class Image(_ImageBandBase):
1845
1845
  if (
1846
1846
  self.filename_patterns
1847
1847
  and any(_get_non_optional_groups(pat) for pat in self.filename_patterns)
1848
- or self.image_patterns
1848
+ ) or (
1849
+ self.image_patterns
1849
1850
  and any(_get_non_optional_groups(pat) for pat in self.image_patterns)
1850
1851
  ):
1851
1852
  self._bands = [band for band in self._bands if band.band_id is not None]
@@ -1882,8 +1883,7 @@ class Image(_ImageBandBase):
1882
1883
  for group in sort_groups
1883
1884
  for pat in self.filename_patterns
1884
1885
  )
1885
- or all(band.band_id is not None for band in self)
1886
- )
1886
+ ) or all(band.band_id is not None for band in self)
1887
1887
 
1888
1888
  @property
1889
1889
  def tile(self) -> str:
@@ -2846,17 +2846,21 @@ class ImageCollection(_ImageBase):
2846
2846
  """True if the ImageCollection has regexes that should make it sortable by date."""
2847
2847
  sort_group = "date"
2848
2848
  return (
2849
- self.filename_patterns
2850
- and any(
2851
- sort_group in pat.groupindex
2852
- and sort_group in _get_non_optional_groups(pat)
2853
- for pat in self.filename_patterns
2849
+ (
2850
+ self.filename_patterns
2851
+ and any(
2852
+ sort_group in pat.groupindex
2853
+ and sort_group in _get_non_optional_groups(pat)
2854
+ for pat in self.filename_patterns
2855
+ )
2854
2856
  )
2855
- or self.image_patterns
2856
- and any(
2857
- sort_group in pat.groupindex
2858
- and sort_group in _get_non_optional_groups(pat)
2859
- for pat in self.image_patterns
2857
+ or (
2858
+ self.image_patterns
2859
+ and any(
2860
+ sort_group in pat.groupindex
2861
+ and sort_group in _get_non_optional_groups(pat)
2862
+ for pat in self.image_patterns
2863
+ )
2860
2864
  )
2861
2865
  or all(getattr(img, sort_group) is not None for img in self)
2862
2866
  )
File without changes
File without changes
File without changes
File without changes