cars.applications.rasterization.rasterization_wrappers

This module is responsible for the rasterization step: - it contains all functions related to 3D representation on a 2D raster grid TODO: refactor in several files and remove too-many-lines

Functions

compute_xy_starts_and_sizes(→ Tuple[float, float, int, ...)

Compute xstart, ystart, xsize and ysize

compute_values_1d(→ Tuple[numpy.ndarray, numpy.ndarray])

Compute the x and y values as 1d arrays

substring_in_list(src_list, substring)

Check if the list contains substring

phased_dsm(start, phase, resolution)

Phased the dsm

find_indexes_in_point_cloud(→ List[str])

Find all indexes in point cloud that contains the key tag

create_raster_dataset(→ xarray.Dataset)

Create final raster xarray dataset

classify_performance_map(performance_map_raw, ...)

Classify performance map with given classes

update_weights(old_weights, weights)

Update weights

update_data(old_data, current_data, weights, ...[, method])

Update current data with old data and weigths

Module Contents

cars.applications.rasterization.rasterization_wrappers.compute_xy_starts_and_sizes(resolution: float, cloud: pandas.DataFrame) Tuple[float, float, int, int][source]

Compute xstart, ystart, xsize and ysize of the rasterization grid from a set of points

Parameters:
  • resolution – Resolution of rasterized cells, expressed in cloud CRS units

  • cloud – set of points as returned by the create_combined_cloud function

Returns:

a tuple (xstart, ystart, xsize, ysize)

cars.applications.rasterization.rasterization_wrappers.compute_values_1d(x_start: float, y_start: float, x_size: int, y_size: int, resolution: float) Tuple[numpy.ndarray, numpy.ndarray][source]

Compute the x and y values as 1d arrays

Parameters:
  • x_start – x start of the rasterization grid

  • y_start – y start of the rasterization grid

  • x_size – x size of the rasterization grid

  • y_size – y size of the rasterization grid

  • resolution – Resolution of rasterized cells, in cloud CRS units or None.

Returns:

a tuple composed of the x and y 1d arrays

cars.applications.rasterization.rasterization_wrappers.substring_in_list(src_list, substring)[source]

Check if the list contains substring

cars.applications.rasterization.rasterization_wrappers.phased_dsm(start: float, phase: float, resolution: float)[source]

Phased the dsm

Parameters:
  • start – start of the roi

  • phase – the point for phasing

  • resolution – resolution of the dsm

cars.applications.rasterization.rasterization_wrappers.find_indexes_in_point_cloud(cloud: pandas.DataFrame, tag: str, list_computed_layers: List[str] = None) List[str][source]

Find all indexes in point cloud that contains the key tag if it needs to be computed :param cloud: Combined cloud :param tag: substring of desired columns in cloud :param list_computed_layers: list of computed output data

cars.applications.rasterization.rasterization_wrappers.create_raster_dataset(raster: numpy.ndarray, weights_sum: numpy.ndarray, x_start: float, y_start: float, x_size: int, y_size: int, resolution: float, hgt_no_data: int, texture_no_data: int, msk_no_data: int, epsg: int, mean: numpy.ndarray, stdev: numpy.ndarray, n_pts: numpy.ndarray, n_in_cell: numpy.ndarray, msk: numpy.ndarray = None, band_im: List[str] = None, classif: numpy.ndarray = None, band_classif: List[str] = None, ambiguity: numpy.ndarray = None, layers_inf_sup: numpy.ndarray = None, layers_inf_sup_stat_index: List[int] = None, layer_inf_sup_indexes: List[str] = None, source_pc: numpy.ndarray = None, source_pc_names: List[str] = None, filling: numpy.ndarray = None, band_filling: List[str] = None, performance_map: numpy.ndarray = None, performance_map_classified: numpy.ndarray = None, performance_map_classified_index: list = None, band_performance_map: List[str] = None) xarray.Dataset[source]

Create final raster xarray dataset

Parameters:
  • raster – height and colors

  • x_start – x start of the rasterization grid

  • y_start – y start of the rasterization grid

  • x_size – x size of the rasterization grid

  • y_size – y size of the rasterization grid

  • resolution – Resolution of rasterized cells, expressed in cloud CRS units or None.

  • hgt_no_data – no data value to use for height

  • texture_no_data – no data value to use for color

  • msk_no_data – no data value to use for mask and classif

  • epsg – epsg code for the CRS of the final raster

  • mean – mean of height and colors

  • stdev – standard deviation of height and colors

  • n_pts – number of points that are stricty in a cell

  • n_in_cell – number of points which contribute to a cell

  • msk – raster msk

  • classif – raster classif

  • ambiguity – raster containing the ambiguity

  • layers_inf_sup – raster containing intervals inf and sup

  • layers_inf_sup_stat_index – list containing index of intervals in mean and stdev rasters

  • layer_inf_sup_indexes – list of band names

  • source_pc – binary raster with source point cloud information

  • source_pc_names – list of names of point cloud before merging : name of sensors pair or name of point cloud file

  • performance_map – raster containing the raw performance map

  • performance_map_classified – raster containing the classified performance map

  • performance_map_classified_index – indexes of performance_map_classified

  • band_performance_map – list of band names : max 2 bands: risk / interval

Returns:

the raster xarray dataset

cars.applications.rasterization.rasterization_wrappers.classify_performance_map(performance_map_raw, performance_map_classes, msk_no_data)[source]

Classify performance map with given classes

cars.applications.rasterization.rasterization_wrappers.update_weights(old_weights, weights)[source]

Update weights

Parameters:
  • weights – current weights

  • old_weights – old weights

Returns:

updated weights

cars.applications.rasterization.rasterization_wrappers.update_data(old_data, current_data, weights, old_weights, nodata, method='basic')[source]

Update current data with old data and weigths

Parameters:
  • old_data – old data

  • current_data – current data

  • weights – current weights

  • old_weights – old weights

  • nodata – nodata associated to tag

Returns:

updated current data