Conversion
Aggregation and disaggregation are one operation. Values are projected down to atoms and aggregated up to the target, so direction follows the geoframe ranks and cross-cutting geoframes need no special handling.
recast_geoscale
recast_geoscale(
x: Any,
gs: GeoScale,
source: str | None = None,
target: str | GeoScale | None = None,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: Any = None,
na_action: NaAction = "drop",
parent: str | None = None,
collect: bool | None = None,
) -> Any
Recast region data between geoframes (or onto another GeoScale's atoms,
matched on shared region keys).
recast_to_geoatoms
recast_to_geoatoms(
x: Any,
gs: GeoScale,
source: str | None = None,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: Any = None,
attach_weight: bool = True,
collect: bool | None = None,
) -> Any
Project region data DOWN to the atoms: sum columns split by the weight
share, others repeated; a weight column attached. Keyed by region.
recast_from_geoatoms
recast_from_geoatoms(
x: Any,
gs: GeoScale,
target: str,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: str | None = None,
na_rm: bool = False,
na_action: NaAction = "drop",
collect: bool | None = None,
) -> Any
Aggregate atom-keyed rows UP to target. Returns the OBSERVED target
regions only, in member order.
recast_pairs
recast_pairs(
x: Any,
gs: GeoScale,
target: str,
source: str | None = None,
src: str = "src",
dst: str = "dst",
values: Any = None,
rule: Any = None,
weight: str | None = None,
na_rm: bool = False,
directed: bool = True,
drop_internal: bool = True,
collect: bool | None = None,
) -> Any
Aggregate origin-destination pairs (columns src, dst at source)
to target codes. Aggregation only; internal pairs are dropped.
recast
recast_geoscale() and the geoatom halves (port of R/recast.R and R/recast-pairs.R).
recast_geoscale() is nestedscales' recast_scale() on a GeoScale. The
halves are kept local, as in R: recast_from_geoatoms() returns the
OBSERVED target regions only (no completion to the full vocabulary), unlike
nestedscales' recast_from_atoms().
recast_from_geoatoms
recast_from_geoatoms(
x: Any,
gs: GeoScale,
target: str,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: str | None = None,
na_rm: bool = False,
na_action: NaAction = "drop",
collect: bool | None = None,
) -> Any
Aggregate atom-keyed rows UP to target. Returns the OBSERVED target
regions only, in member order.
recast_geoscale
recast_geoscale(
x: Any,
gs: GeoScale,
source: str | None = None,
target: str | GeoScale | None = None,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: Any = None,
na_action: NaAction = "drop",
parent: str | None = None,
collect: bool | None = None,
) -> Any
Recast region data between geoframes (or onto another GeoScale's atoms,
matched on shared region keys).
recast_pairs
recast_pairs(
x: Any,
gs: GeoScale,
target: str,
source: str | None = None,
src: str = "src",
dst: str = "dst",
values: Any = None,
rule: Any = None,
weight: str | None = None,
na_rm: bool = False,
directed: bool = True,
drop_internal: bool = True,
collect: bool | None = None,
) -> Any
Aggregate origin-destination pairs (columns src, dst at source)
to target codes. Aggregation only; internal pairs are dropped.
recast_to_geoatoms
recast_to_geoatoms(
x: Any,
gs: GeoScale,
source: str | None = None,
key: str | None = None,
values: Any = None,
rule: Any = None,
weight: Any = None,
attach_weight: bool = True,
collect: bool | None = None,
) -> Any
Project region data DOWN to the atoms: sum columns split by the weight
share, others repeated; a weight column attached. Keyed by region.
geoscale_map
geoscale_map(
gs: GeoScale,
source: str,
target: str,
weight: str | None = None,
) -> pa.Table
Crosswalk between two geoframes of one GeoScale.
geoscale_map_between
geoscale_map_between(
source: GeoScale,
target: GeoScale,
weight: str | None = None,
) -> pa.Table
Crosswalk between two GeoScales through their shared atoms.
register_geoscale_map
register_geoscale_map(
gs: GeoScale | str, source: str, target: str, map: Any
) -> str
register_geoscale_map_between
register_geoscale_map_between(
source: GeoScale | str, target: GeoScale | str, map: Any
) -> str
get_geoscale_map
get_geoscale_map(
gs: GeoScale | str, source: str, target: str
)
get_geoscale_map_between
get_geoscale_map_between(
source: GeoScale | str, target: GeoScale | str
)
list_geoscale_maps
list_geoscale_maps() -> pa.Table
clear_geoscale_maps
clear_geoscale_maps(
name: str | Sequence[str] | None = None,
) -> None
join_geoscale
join_geoscale(
x: Any,
gs: GeoScale,
key: str | None = None,
geoframe: str | None = None,
geoframes: bool | str | Sequence[str] | None = None,
meta: bool = False,
weight: str | None = None,
as_factor: bool = True,
collect: bool | None = None,
) -> Any
Attach the GeoScale's label, coarser codes (<name>.<geoframe>) and
share/weight to x.
GEOSCALE_RULES
module-attribute
GEOSCALE_RULES = (
"sum",
"weighted_mean",
"mean",
"copy",
"sd",
"share",
"logshare",
)
register_geoscale_rule
register_geoscale_rule(
param: str, rule: str, weight: str | None = None
) -> dict
Record the recast rule (and weight) for a value column.
get_geoscale_rule
get_geoscale_rule(param: str) -> dict | None
list_geoscale_rules
list_geoscale_rules() -> pa.Table
clear_geoscale_rules
clear_geoscale_rules(
name: str | Sequence[str] | None = None,
) -> None
Remove geoscale rules: the named value columns, or all of them.