Soil Visualization
This module receive processed data (or even raw data if needed) from the API client and data processor, build the Plotly figures, and either return or show them.
- class owimetadatabase_preprocessor.soil.visualization.soil_visualizer.SoilPlot(soil_api: SoilAPI)
Bases:
object
Class to visualize soil data using Plotly.
- plot_soilprofile_fence(soilprofiles_df: DataFrame, start: str, end: str, plotmap: bool = False, fillcolordict: Dict[str, str] = {'CLAY': 'brown', 'SAND': 'yellow', 'SAND/CLAY': 'orange'}, logwidth: float = 100.0, show_annotations: bool = True, general_layout: Dict[Any, Any] = {}, **kwargs) Dict[str, List[DataFrame] | Figure]
Creates a fence diagram for soil profiles.
- Parameters:
soilprofiles_df – Dataframe with summary data for the selected soil profiles
start – Name of the soil profile at the start
end – Name of the soil profile at the end
soil_api – SoilAPI instance to use for data retrieval (overrides instance attribute)
plotmap – Boolean determining whether a map with the locations is shown (default=False)
fillcolordict – Dictionary used for mapping soil types to colors
logwidth – Width of the logs in the fence diagram (default=100)
show_annotations – Boolean determining whether annotations are shown (default=True)
general_layout – Dictionary with general layout options (default = dict())
kwargs – Keyword arguments for the get_soilprofiles method
- Returns:
Dictionary with the following keys: - ‘profiles’: List of SoilProfile objects - ‘diagram’: Plotly figure with the fence diagram
- Raises:
ValueError – If no SoilAPI instance is provided
- static plot_combined_fence(profiles: List[DataFrame], cpts: List[DataFrame], startpoint: str, endpoint: str, band: float = 1000.0, scale_factor: float = 10.0, extend_profile: bool = True, show_annotations: bool = True, general_layout: Dict[Any, Any] = {}, fillcolordict: Dict[str, str] = {'CLAY': 'brown', 'SAND': 'yellow', 'SAND/CLAY': 'orange'}, logwidth: float = 100.0, opacity: float = 0.5, uniformcolor: str | None = None, **kwargs) Dict[str, Figure]
Creates a combined fence diagram with soil profile and CPT data.
- Parameters:
profiles – List with georeferenced soil profiles (run plot_soilprofile_fence first)
cpts – List with georeference CPTs (run plot_cpt_fence first)
startpoint – Name of the CPT location for the start point
endpoint – Name of the CPT location for the end point
band – Thickness of the band (in m, default=1000m)
scale_factor – Width of the CPT axis in the fence diagram (default=10)
extend_profile – Boolean determining whether the profile needs to be extended (default=True)
show_annotations – Boolean determining whether annotations are shown (default=True)
general_layout – Dictionary with general layout options (default = dict())
fillcolordict – Dictionary with colors for soil types
logwidth – Width of the log in the fence diagram
opacity – Opacity of the soil profile logs
uniformcolor – If a valid color is provided (e.g. ‘black’), it is used for all CPT traces
- Returns:
Dictionary with the following keys:
- ’diagram’: Plotly figure with the fence diagram for CPTs and
soil profiles
- plot_testlocations(return_fig: bool = False, **kwargs) None
Retrieves soil test locations and generates a Plotly plot to show them.
- Parameters:
return_fig – Boolean indicating whether the Plotly figure object needs to be returned (default is False which simply shows the plot)
soil_api – SoilAPI instance to use for data retrieval (overrides instance attribute)
kwargs – Keyword arguments for the search (see
get_testlocations
)
- Returns:
Plotly figure object with selected asset locations plotted on OpenStreetMap tiles (if requested)
- plot_cpt_fence(cpt_df: DataFrame, start: str, end: str, band: float = 1000.0, scale_factor: float = 10.0, extend_profile: bool = True, plotmap: bool = False, show_annotations: bool = True, general_layout: Dict[Any, Any] = {}, uniformcolor: str | None = None, **kwargs) Dict[str, List[DataFrame] | Figure]
Creates a fence diagram for CPTs.
- Parameters:
cpt_df – Dataframe with the summary data of the selected CPTs
start – Name of the location for the start point
end – Name of the location for the end point
soil_api – SoilAPI instance to use for data retrieval (overrides instance attribute)
band – Thickness of the band (in m, default=1000m)
scale_factor – Width of the CPT axis in the fence diagram (default=10)
extend_profile – Boolean determining whether the profile needs to be extended
plotmap – Boolean determining whether a map with locations is shown
show_annotations – Boolean determining whether annotations are shown
general_layout – Dictionary with general layout options (default = dict())
uniformcolor – If a valid color is provided, used for all CPT traces
kwargs – Keyword arguments for get_insitutests method
- Returns:
Dictionary with: - ‘cpts’: List of CPT objects - ‘diagram’: Plotly figure with the fence diagram
- Raises:
ValueError – If no SoilAPI instance is provided