sec_interp.core.validation.project_validator module

sec_interp.core.validation.project_validator.validate_reasonable_ranges(values: Dict[str, Any]) List[str]

Check for unreasonable or potentially erroneous parameter values.

This function does not return hard errors, but a list of warning strings to inform the user about extreme values (e.g., vertical exaggeration > 10).

Parameters:

values – Dictionary containing parameter names and their current values.

Returns:

A list of warning messages. If empty, all values are reasonable.

Return type:

list[str]

class sec_interp.core.validation.project_validator.ValidationParams(raster_layer: qgis.core.QgsRasterLayer | None = None, band_number: int | None = None, line_layer: qgis.core.QgsVectorLayer | None = None, output_path: str = '', scale: float = 1.0, vert_exag: float = 1.0, buffer_dist: float = 0.0, outcrop_layer: qgis.core.QgsVectorLayer | None = None, outcrop_field: str | None = None, struct_layer: qgis.core.QgsVectorLayer | None = None, struct_dip_field: str | None = None, struct_strike_field: str | None = None, dip_scale_factor: float = 1.0)

Bases: object

Data container for all parameters that need cross-layer validation.

raster_layer: qgis.core.QgsRasterLayer | None = None
band_number: int | None = None
line_layer: qgis.core.QgsVectorLayer | None = None
output_path: str = ''
scale: float = 1.0
vert_exag: float = 1.0
buffer_dist: float = 0.0
outcrop_layer: qgis.core.QgsVectorLayer | None = None
outcrop_field: str | None = None
struct_layer: qgis.core.QgsVectorLayer | None = None
struct_dip_field: str | None = None
struct_strike_field: str | None = None
dip_scale_factor: float = 1.0
class sec_interp.core.validation.project_validator.ProjectValidator

Bases: object

Orchestrates validation of project parameters independent of the GUI.

static validate_all(params: ValidationParams) Tuple[bool, str]

Perform a comprehensive validation of all project parameters.

This includes checking for required files, geometry types, field existence, and numeric range constraints.

Parameters:

params – The parameters to validate.

Returns:

(is_valid, error_message)
  • is_valid (bool): True if all checks passed.

  • error_message (str): Newline-separated list of all found errors.

Return type:

tuple

static validate_preview_requirements(params: ValidationParams) Tuple[bool, str]

Validate only the minimum requirements needed to generate a preview.

Parameters:

params – The parameters containing at least raster and line layers.

Returns:

(is_valid, error_message)
  • is_valid (bool): True if the core preview can be generated.

  • error_message (str): Description of missing core components.

Return type:

tuple