gregor.aggregate
¶
aggregate_point_to_polygon(points, polygons, aggfunc='sum')
¶
Aggregate point data to polygons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
GeoDataFrame
|
GeoDataFrame containing data defined on point geometries. |
required |
polygons
|
GeoSeries | GeoDataFrame
|
GeoSeries or GeoDataFrame of polygon geometries. |
required |
aggfunc
|
str
|
Aggregation function, by default "sum". |
'sum'
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
GeoDataFrame containing the original geometries and the aggregated statistics. |
aggregate_raster_to_polygon(raster, polygons, stats='sum')
¶
Aggregate raster data to polygons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster
|
str | Path | DataArray
|
Path to the raster file or xarray DataArray. |
required |
polygons
|
GeoSeries | GeoDataFrame
|
GeoSeries or GeoDataFrame with the spatial units. |
required |
stats
|
str
|
Statistics to compute, by default "sum". |
'sum'
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
GeoDataFrame containing the original geometries and the aggregated statistics. |
gregor.disaggregate
¶
disaggregate_polygon_to_point(data, column, proxy, proxy_column, to_data_crs=False)
¶
Disaggregate polygon data to point data using proxy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
Data to be disaggregated. |
required |
column
|
str
|
Column name of the data to be disaggregated. |
required |
proxy
|
GeoSeries
|
Proxy data with point geometries for disaggregation. |
required |
proxy_column
|
str
|
Column name of the proxy data. |
required |
to_data_crs
|
bool
|
Whether to reproject proxy to |
False
|
disaggregate_polygon_to_raster(data, column, proxy, to_data_crs=False)
¶
Disaggregate polygon data to raster data using proxy. Normalization of the proxy happens internally.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
GeoDataFrame
|
Data to be disaggregated. |
required |
column
|
str
|
Column name of the data to be disaggregated. |
required |
proxy
|
Dataset
|
Proxy data for disaggregation. |
required |
to_data_crs
|
bool
|
Whether to reproject proxy to |
False
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Disaggregated raster data. |
get_belongs_to_matrix(raster, polygons)
¶
Get a matrix which indicates which polygon each raster point belongs to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster
|
Dataset
|
Raster data to get the matrix for. |
required |
polygons
|
GeoSeries
|
Polygons to compute the matrix for. |
required |
Returns:
| Type | Description |
|---|---|
Dataset
|
Matrix which indicates which polygon each raster point belongs to. |
get_uniform_proxy(polygons, raster_resolution)
¶
Get a uniform proxy which sums to one for each region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polygons
|
GeoSeries
|
Polygons to compute the proxy for. |
required |
raster_resolution
|
tuple[int, int]
|
Resolution of the desired raster proxy. |
required |
Returns:
| Type | Description |
|---|---|
Dataset
|
Uniform proxy which sums to 1 in each region. |
gregor.raster
¶
clip(raster, minx, miny, maxx, maxy, destination=None)
¶
Clip raster to bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster
|
str | Path | DataArray
|
Path to the raster file or xarray DataArray. |
required |
minx
|
float
|
Minimum x-coordinate of the bounding box. |
required |
miny
|
float
|
Minimum y-coordinate of the bounding box. |
required |
maxx
|
float
|
Maximum x-coordinate of the bounding box. |
required |
maxy
|
float
|
Maximum y-coordinate of the bounding box. |
required |
destination
|
str | Path
|
Path to save the clipped raster, by default None. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray
|
Clipped raster. |