wolfhece.report.compare_cs_dem

Module Contents

class wolfhece.report.compare_cs_dem.CSvsDEM_MainLayout(title: str, filename='', ox=0, oy=0, tx=0, ty=0, parent=None, is2D=True, idx='', plotted=True, mapviewer=None, need_for_wx=False, bbox=None, find_minmax=True, shared=False, colors=None)[source]

Bases: wolfhece.report.common.DefaultLayoutA4

Inheritance diagram of wolfhece.report.compare_cs_dem.CSvsDEM_MainLayout

Layout for comparing cross-sections, array and Lidar LAZ in a report.

1 cadre pour la zone traitée avec photo de fond ign + contour vectoriel 1 cadre avec zoom plus large min 250m 1 cadre avec matrice ref + contour vectoriel 1 cadre avec matrice à comparer + contour vectoriel 1 cadre avec différence 1 cadre avec valeurs de synthèse

1 cadre avec histogramme 1 cadre avec histogramme des différences

_map[source]
_summaries[source]
_tables[source]
_histogram[source]
class wolfhece.report.compare_cs_dem.CSvsDEM_IndividualLayout(title: str, filename='', ox=0, oy=0, tx=0, ty=0, parent=None, is2D=True, idx='', plotted=True, mapviewer=None, need_for_wx=False, bbox=None, find_minmax=True, shared=False, colors=None)[source]

Bases: wolfhece.report.common.DefaultLayoutA4

Inheritance diagram of wolfhece.report.compare_cs_dem.CSvsDEM_IndividualLayout

Global layout for A4 report.

This class inherits from Zones and defines a standard layout for A4 reports. It includes predefined areas for the title, versions, logo, and footer.

_maps[source]
_cs[source]
_dem[source]
_compare_cs[source]
class wolfhece.report.compare_cs_dem.CSvsDEM(data_group: list, idx: int, dem: wolfhece.wolf_array.WolfArray, title: str = '', index_group: int = 0, index_cs: int = 0, rebinned_dem: wolfhece.wolf_array.WolfArray = None)[source]

Class to manage the difference between a unique cross-section and a DEM.

_dpi = 600[source]
default_size_hitograms = (12, 6)[source]
default_size_arrays = (10, 10)[source]
_fontsize = 6[source]
_data_group[source]
_idx[source]
dem[source]
_rebinned_dem: wolfhece.wolf_array.WolfArray = None[source]
_cs: wolfhece.PyCrosssections.profile[source]
title = ''[source]
index_cs = 0[source]
index_group = 0[source]
_background = 'IGN'[source]
property differences: tuple[float, float][source]

Get the difference between the cross-section and the DEM at extremities.

set_palette_distribute(minval: float, maxval: float, step: int = 0)[source]

Set the palette for both arrays.

set_palette(values: list[float], colors: list[tuple[int, int, int]])[source]

Set the palette for both arrays based on specific values.

plot_position_grey(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, size_around: float = 250) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array with a background.

plot_position(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, width: int = 3, color: int = 16711680) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the dem array.

plot_position_around(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, size_around: float = 50.0, width: int = 3, color: int = 16711680, s_extremities: int = 50, colors_extremities: tuple[str, str] = ('blue', 'green')) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the dem array.

plot_cs_in_group(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, width: int = 2, color: int = 255) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the others cross-sections in the group if exists.

plot_dem_around(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, size_around: float = 10.0, width: int = 3, color: int = 16711680, s_extremities: int = 50, colors_extremities: tuple[str, str] = ('blue', 'green')) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the dem array.

plot_position_scaled(scale=4, figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, width: int = 3, color: int = 16711680) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array.

Parameters:
  • scale – Scale factor to apply to the extent of the DEM. For example, scale=1 will double the extent, scale=2 will triple it, etc.

  • figax – Tuple of (Figure, Axes) to plot on. If None, a new figure and axes will be created.

plot_dem(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array.

plot_cs(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the cross section to compare.

plot_cs_min_at_x0(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the cross section to compare.

plot_cs_limited(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, tolerance: float = 1.0) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the cross section to compare.

plot_up_down_min_at_x0(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, n_iter=2) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the cross section to compare.

_complete_report(page: CSvsDEM_IndividualLayout)[source]

Complete the report with the arrays and histograms.

create_report(output_file: str | pathlib.Path = None) pathlib.Path[source]

Create a page report for the array difference.

class wolfhece.report.compare_cs_dem.CompareMultipleCSvsDEM(cross_sections: wolfhece.PyCrosssections.crosssections | pathlib.Path | str, dem: wolfhece.wolf_array.WolfArray | str | pathlib.Path, laz_directory: pathlib.Path | str = None, support: pathlib.Path | str | wolfhece.PyVertexvectors.vector = None, threshold_z: float = 0.5, distance_threshold: float = 50.0)[source]
_dpi = 600[source]
default_size_arrays = (10, 10)[source]
_fontsize = 6[source]
_dirlaz = None[source]
_cs[source]
dem: wolfhece.wolf_array.WolfArray[source]
_rebinned_dem: wolfhece.wolf_array.WolfArray = None[source]
subpages: dict[int, CSvsDEM][source]
_pdf_path = None[source]
_background = 'IGN'[source]
_groups: list[list[dict['section_id':int, 'x':float, 'y':float, 'diff_left':float, 'diff_right':float, 's':float]]][source]
_threshold_z = 0.5[source]
_distance_threshold = 50.0[source]
find_differences(tolerance: float = 0.5, distance_threshold: float = 50.0)[source]

Find differences between cross-sections and DEM.

Store the differences in self._diffs as a list of lists of dictionaries with keys: section_id, x, y, diff_left, diff_right.

We need to group the closest cross-sections that have differences. So, we start from the upstream cross-section and go downstream, grouping cross-sections which have differences and are close to each other (less than distance_threshold m apart).

Parameters:

tolerance – Tolerance in meters to consider a difference. If the absolute difference between the cross-section and the DEM is greater than this value, it is considered a difference.

property count_groups: int[source]

How many groups of differences are there?

property count_differences: int[source]

Count total number of differences.

count_groups_greater_than(threshold: int) int[source]

How many groups of differences are greater than a given threshold?

_diff_to_dict()[source]

Compile dict in list of lists to a single dictionary

_diff_to_dataframe()[source]

Compile dict in list of lists to a single pandas DataFrame.

Dataframe columns: x, y, diff Dataframe index: profile

property _all_XY_diff[source]

Get all X and Y coordinates of the differences.

property _all_differences_as_np: numpy.ndarray[source]

Get all differences as a single array.

property _all_left_differences_as_np: numpy.ndarray[source]

Get all left differences as a single array.

property _all_right_differences_as_np: numpy.ndarray[source]

Get all right differences as a single array.

plot_histogram_differences(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, density=True, alpha=0.3, **kwargs) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot histogram of all differences.

_read_differences_json(differences: pathlib.Path | str) list[list[dict['section_id':int, 'x':float, 'y':float, 'diff':float]]][source]

Differences file is a JSON file with the following structure:

List of lists with: “section_id”, “x”, “y”, “diff”.

List of lists because we want to store groups of cross-sections that are close to each other.

plot_dem_with_background(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array with a background.

plot_cartoweb(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array with a background.

plot_background_grey(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array with a background.

plot_dem(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, use_rebin_if_exists: bool = True) tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the reference array.

plot_XY(figax: tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes] = None, s: float = 10, alpha: float = 0.5, colorized_diff: bool = False, default_color=('blue', 'red'), which_ones: Literal['left', 'right', 'all'] = 'all') tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the XY of the differences.

Parameters:
  • figax – Tuple of (Figure, Axes) to plot on. If None, a new figure and axes will be created.

  • s – Size of the points.

  • alpha – Alpha of the points.

  • colorized_diff – If True, the points will be colored based on the difference value.

  • default_color – If colorized_diff is False, the points will be colored with these colors for left and right.

  • which_ones – Which points to plot. Can be ‘left’, ‘right’, or ‘all’.

plot_mainpage_map() tuple[matplotlib.pyplot.Figure, matplotlib.pyplot.Axes][source]

Plot the main page map with all differences.

_summary_dem() list[source]

Summary of the DEM.

_summary_differences() list[source]

Summary of the differences.

get_group_info(i_group: int) str[source]

Get information about a specific group of differences.

print_left_differences() str[source]

Print all left differences.

print_right_differences() str[source]

Print all right differences.

_complete_report_mainpage(page: CSvsDEM_MainLayout)[source]

Complete the report with the global summary and individual differences.

_sort_groups_by_inverse_deltaz()[source]

Sort the groups by the maximum difference in descending order.

_create_subpages()[source]

Complete the report with the individual sections.

create_report(output_file: str | pathlib.Path = None, append_subpages: bool = True, nb_max_pages: int = -1) None[source]

Create a page report for the array comparison.

property pdf_path: pathlib.Path[source]

Return the path to the generated PDF report.

class wolfhece.report.compare_cs_dem.CompareCSvsDEM_wx(cross_sections: wolfhece.PyCrosssections.crosssections | pathlib.Path | str, dem: wolfhece.wolf_array.WolfArray | str | pathlib.Path, laz_directory: pathlib.Path | str = None, support: pathlib.Path | str | wolfhece.PyVertexvectors.vector = None, threshold_z: float = 0.5, distance_threshold: float = 50.0, dpi: int = 150, nb_max_groups: int = -1, **kwargs)[source]

Bases: wolfhece.report.pdf.PDFViewer

Inheritance diagram of wolfhece.report.compare_cs_dem.CompareCSvsDEM_wx

A sized frame.

Controls added to its content pane will automatically be added to the panes sizer.

_report[source]
on_close(event)[source]

Handle the close event to clean up resources