rasterize_numeric#

geobricks.rasterize_numeric(data_gdf, grid_gdf, var_name, mode, *, is_polygon=False, is_point=False)[source]#

Rasterize a numeric column of a geopandas.GeoDataFrame, according to a vector grid.

Parameters#

data_gdfgeopandas.GeoDataFrame

Input frame containing the column to rasterize.

grid_gdfgeopandas.GeoDataFrame

Vector grid composed: one rectangle will correspond to one raster cell.

var_namestr

Numeric variable column to rasterize.

mode{‘mean’, ‘sum’, ‘count’}

Rasterization mode:

  • ‘mean’:

    • if is_polygon = True: sum of polygon values weighted by their relative coverage on each cell (appropriate for intensive quantities)

    • if is_point = True: average value of points on each cell

  • ‘sum’:

    • if is_polygon = True: sum of polygon values downscaled to each cell (appropriate for extensive quantities)

    • if is_point = True: summed value of points in each cell

  • ‘count’: number of points or polygons intersecting each cell

is_polygonbool

Whether the input frame is a polygon vector dataset or not.

is_pointbool

Whether the input frame is a point vector dataset or not.

Returns#

coverxarray.DataArray

DataArray containing the results.