ssb-sgis 1.3.4__py3-none-any.whl → 1.3.5__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/parallel/parallel.py +6 -34
- {ssb_sgis-1.3.4.dist-info → ssb_sgis-1.3.5.dist-info}/METADATA +2 -2
- {ssb_sgis-1.3.4.dist-info → ssb_sgis-1.3.5.dist-info}/RECORD +5 -5
- {ssb_sgis-1.3.4.dist-info → ssb_sgis-1.3.5.dist-info}/LICENSE +0 -0
- {ssb_sgis-1.3.4.dist-info → ssb_sgis-1.3.5.dist-info}/WHEEL +0 -0
sgis/parallel/parallel.py
CHANGED
|
@@ -21,6 +21,7 @@ import joblib
|
|
|
21
21
|
import numpy as np
|
|
22
22
|
import pandas as pd
|
|
23
23
|
from geopandas import GeoDataFrame
|
|
24
|
+
from geopandas import sjoin
|
|
24
25
|
from pandas import DataFrame
|
|
25
26
|
from pandas import Series
|
|
26
27
|
|
|
@@ -170,47 +171,18 @@ def parallel_sjoin(
|
|
|
170
171
|
Returns:
|
|
171
172
|
A GeoDataFrame containing the result of the overlay operation.
|
|
172
173
|
"""
|
|
174
|
+
df1 = df1.assign(_df1_range_idx=range(len(df1)))
|
|
175
|
+
df2 = df2.assign(_df2_range_idx=range(len(df2)), _from_df2=1)
|
|
173
176
|
return pd.concat(
|
|
174
177
|
chunkwise(
|
|
175
|
-
|
|
178
|
+
sjoin,
|
|
176
179
|
df1,
|
|
177
|
-
kwargs={
|
|
178
|
-
"df2": df2,
|
|
179
|
-
"to_print": to_print,
|
|
180
|
-
}
|
|
181
|
-
| kwargs,
|
|
180
|
+
kwargs={"right_df": df2, **kwargs},
|
|
182
181
|
processes=processes,
|
|
183
182
|
max_rows_per_chunk=max_rows_per_chunk,
|
|
184
183
|
backend=backend,
|
|
185
184
|
),
|
|
186
|
-
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
def _sjoin_within_first(
|
|
191
|
-
df1, df2, to_print: str | None = None, predicate: str = "intersects", **kwargs
|
|
192
|
-
):
|
|
193
|
-
if to_print:
|
|
194
|
-
print(to_print, "- sjoin chunk len:", len(df1))
|
|
195
|
-
|
|
196
|
-
df2 = df2.reset_index(drop=True)
|
|
197
|
-
df2["_from_df2"] = 1
|
|
198
|
-
df1["_range_idx"] = range(len(df1))
|
|
199
|
-
joined = df1.sjoin(df2, predicate="within", how="left")
|
|
200
|
-
within = joined.loc[joined["_from_df2"].notna()].drop(
|
|
201
|
-
columns=["_from_df2", "_range_idx", "index_right"], errors="raise"
|
|
202
|
-
)
|
|
203
|
-
not_within = df1.loc[
|
|
204
|
-
df1["_range_idx"].isin(joined.loc[joined["_from_df2"].isna(), "_range_idx"])
|
|
205
|
-
]
|
|
206
|
-
|
|
207
|
-
return pd.concat(
|
|
208
|
-
[
|
|
209
|
-
within,
|
|
210
|
-
not_within.sjoin(df2, predicate=predicate, **kwargs),
|
|
211
|
-
],
|
|
212
|
-
ignore_index=True,
|
|
213
|
-
)
|
|
185
|
+
).drop(columns=["_df1_range_idx", "_df2_range_idx", "_from_df2"], errors="raise")
|
|
214
186
|
|
|
215
187
|
|
|
216
188
|
def _clip_rowwise(df1, df2, to_print: str | None = None):
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ssb-sgis
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.5
|
|
4
4
|
Summary: GIS functions used at Statistics Norway.
|
|
5
5
|
Home-page: https://github.com/statisticsnorway/ssb-sgis
|
|
6
6
|
License: MIT
|
|
7
7
|
Author: Morten Letnes
|
|
8
8
|
Author-email: morten.letnes@ssb.no
|
|
9
|
-
Requires-Python: >=3.11
|
|
9
|
+
Requires-Python: >=3.11,<4
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -52,7 +52,7 @@ sgis/networkanalysis/networkanalysisrules.py,sha256=na26iZTpnlwwIEEGswoqMH4W1ZOL
|
|
|
52
52
|
sgis/networkanalysis/nodes.py,sha256=atFSpqz-_uJHMrf6MC0zhrrcWIydRMFZrsaHC2xr1GU,3374
|
|
53
53
|
sgis/networkanalysis/traveling_salesman.py,sha256=Jjo6bHY4KJ-eK0LycyTy0sWxZjgITs5MBllZ_G9FhTE,5655
|
|
54
54
|
sgis/parallel/__init__.py,sha256=fw_Fl3IJk1bKzrRBhZIoOpznJqwd09NVHJJFj2ZLeIU,32
|
|
55
|
-
sgis/parallel/parallel.py,sha256=
|
|
55
|
+
sgis/parallel/parallel.py,sha256=3Nq7cgvkVmg-2TEyNCEiqBshYOHt6Qf6xg6rrcnzf78,39394
|
|
56
56
|
sgis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
sgis/raster/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
58
|
sgis/raster/base.py,sha256=8JdXXDj8CgJQt5WIkkNbpM5U0pYyQrWQY9dszfUaUQ4,7743
|
|
@@ -61,7 +61,7 @@ sgis/raster/indices.py,sha256=efJmgfPg_VuSzXFosXV661IendF8CwPFWtMhyP4TMUg,222
|
|
|
61
61
|
sgis/raster/regex.py,sha256=4idTJ9vFtsGtbxcjJrx2VrpJJuDMP3bLdqF93Vc_cmY,3752
|
|
62
62
|
sgis/raster/sentinel_config.py,sha256=nySDqn2R8M6W8jguoBeSAK_zzbAsqmaI59i32446FwY,1268
|
|
63
63
|
sgis/raster/zonal.py,sha256=D4Gyptw-yOLTCO41peIuYbY-DANsJCG19xXDlf1QAz4,2299
|
|
64
|
-
ssb_sgis-1.3.
|
|
65
|
-
ssb_sgis-1.3.
|
|
66
|
-
ssb_sgis-1.3.
|
|
67
|
-
ssb_sgis-1.3.
|
|
64
|
+
ssb_sgis-1.3.5.dist-info/LICENSE,sha256=np3IfD5m0ZUofn_kVzDZqliozuiO6wrktw3LRPjyEiI,1073
|
|
65
|
+
ssb_sgis-1.3.5.dist-info/METADATA,sha256=TbqucBYChWXB_Xw2eFf9PZwQoguEWeKGav18lFbhUfI,11495
|
|
66
|
+
ssb_sgis-1.3.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
67
|
+
ssb_sgis-1.3.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|