fortplot_coordinate_validation Module

Input validation for coordinate arrays and edge case handling

This module provides comprehensive validation for coordinate data to prevent silent failures and ensure robust plotting across all backends. Addresses Issue #436 - single point plotting failures.



Derived Types

type, public ::  coordinate_validation_result_t

Components

Type Visibility Attributes Name Initial
logical, public :: is_valid = .false.
logical, public :: is_single_point = .false.
logical, public :: is_empty = .false.
logical, public :: has_precision_issues = .false.
logical, public :: has_large_values = .false.
logical, public :: should_use_markers = .false.
character(len=256), public :: message = ""
character(len=32), public :: suggested_marker = ""

Functions

public function validate_coordinate_arrays(x, y, context) result(validation)

Comprehensive validation of coordinate arrays for plotting Returns validation result with detailed information about the data

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)
character(len=*), intent(in), optional :: context

Return Value type(coordinate_validation_result_t)

public function validate_coordinate_ranges(x, y, validation) result(is_valid)

Validate that coordinate values are finite and reasonable

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)
type(coordinate_validation_result_t), intent(inout) :: validation

Return Value logical

public function has_machine_precision_issues(x, y) result(has_issues)

Check if coordinates are too close together for reliable rendering

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)

Return Value logical

public function is_valid_single_point(x, y) result(is_single)

Check if arrays represent a valid single point

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)

Return Value logical

public function is_empty_array(x, y) result(is_empty)

Check if arrays are empty

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)
real(kind=wp), intent(in) :: y(:)

Return Value logical

public function suggest_marker_for_single_point(backend_type) result(marker)

Suggest appropriate marker type for single point based on backend

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: backend_type

Return Value character(len=8)