Redistribute values between geographies (direct area-weighted and parcel-weighted)
Project description
sdc-redistribute
Redistribute values between geographies — direct area-weighted interpolation and parcel-weighted redistribution.
Part of the Social Data Commons
toolkit. Extracted from sdc_core.redistribute; used by SDC pipelines to move
measures from one geographic vintage/level onto another (e.g. 2010 tracts → 2020
block groups), producing _geo10/_geo20-suffixed measures.
Install
uv add sdc-redistribute # or: pip install sdc-redistribute
Quickstart
Split a tract's count onto two equal-area block groups (geometries generated inline so the example is self-contained):
import tempfile, pathlib
import geopandas as gpd
import pandas as pd
from shapely.geometry import box
from sdc_redistribute import redistribute_direct
tmp = pathlib.Path(tempfile.mkdtemp())
gpd.GeoDataFrame({"geoid": ["T1"]}, geometry=[box(0, 0, 2, 2)], crs="EPSG:4326").to_file(tmp / "tract.geojson", driver="GeoJSON")
gpd.GeoDataFrame({"geoid": ["BG1", "BG2"]}, geometry=[box(0, 0, 1, 2), box(1, 0, 2, 2)], crs="EPSG:4326").to_file(tmp / "bg.geojson", driver="GeoJSON")
source_df = pd.DataFrame({"geoid": ["T1"], "year": [2020], "measure": ["pop"], "value": [100.0]})
out = redistribute_direct(source_df, source_geo=tmp / "tract.geojson",
target_geos={"block_group": tmp / "bg.geojson"}, count_cols=["pop"])
print(out[["geoid", "measure", "value"]].to_string(index=False))
# geoid measure value
# BG1 pop_direct 50.0
# BG2 pop_direct 50.0
Public API
redistribute_direct— area-proportional redistribution between two geographies.redistribute_parcels— parcel-centroid-weighted redistribution.run_redistribution— high-level wrapper driven by a pipeline.yaml config block.
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sdc_redistribute-0.1.1.tar.gz.
File metadata
- Download URL: sdc_redistribute-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a87e2f99bedac121bd93f8161b20ddc4843f82a1fa8e7f3a436bd113c9f165eb
|
|
| MD5 |
dd9435b0be69e0d3aded223c5ef0dd6d
|
|
| BLAKE2b-256 |
27620f535185b84e1b463eeaea99b124bfc2c997ea1face197c89b535ac124c1
|
Provenance
The following attestation bundles were made for sdc_redistribute-0.1.1.tar.gz:
Publisher:
publish-redistribute.yml on dads2busy/Social-Data-Commons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdc_redistribute-0.1.1.tar.gz -
Subject digest:
a87e2f99bedac121bd93f8161b20ddc4843f82a1fa8e7f3a436bd113c9f165eb - Sigstore transparency entry: 1711203209
- Sigstore integration time:
-
Permalink:
dads2busy/Social-Data-Commons@7c450154e9a3e3754971f99433168be1bae765a9 -
Branch / Tag:
refs/tags/redistribute-v0.1.1 - Owner: https://github.com/dads2busy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-redistribute.yml@7c450154e9a3e3754971f99433168be1bae765a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sdc_redistribute-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sdc_redistribute-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8184d4e3fbbbc126c82d24ac00f3946c7bf67842b2bd37f9171e5de00c5185e1
|
|
| MD5 |
ae7efd27a4b4acc10a728a2f0f7244ed
|
|
| BLAKE2b-256 |
3533d05d2e16487046ab6b38c2df5ec43a137d3ecb32055e21c0b91f7e1d1c42
|
Provenance
The following attestation bundles were made for sdc_redistribute-0.1.1-py3-none-any.whl:
Publisher:
publish-redistribute.yml on dads2busy/Social-Data-Commons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdc_redistribute-0.1.1-py3-none-any.whl -
Subject digest:
8184d4e3fbbbc126c82d24ac00f3946c7bf67842b2bd37f9171e5de00c5185e1 - Sigstore transparency entry: 1711203421
- Sigstore integration time:
-
Permalink:
dads2busy/Social-Data-Commons@7c450154e9a3e3754971f99433168be1bae765a9 -
Branch / Tag:
refs/tags/redistribute-v0.1.1 - Owner: https://github.com/dads2busy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-redistribute.yml@7c450154e9a3e3754971f99433168be1bae765a9 -
Trigger Event:
push
-
Statement type: