diff --git a/map2loop/data_checks.py b/map2loop/data_checks.py index 68ca13b3..73aee9e9 100644 --- a/map2loop/data_checks.py +++ b/map2loop/data_checks.py @@ -669,7 +669,7 @@ def check_keys(d: dict, parent_key=""): logger.error("minimum_fault_length must be a number.") raise ValueError(f"minimum_fault_length must be a number, instead got: {type(mfl)}") - +@beartype.beartype def validate_geometry( geodata: geopandas.GeoDataFrame, expected_geom_types: List[type], @@ -690,7 +690,7 @@ def validate_geometry( # 1. Check if all geometries are valid if not geodata.geometry.is_valid.all(): logger.error(f"Invalid geometries found in datatype {datatype_name}. Please fix them before proceeding.") - return True, f"Invalid geometries found in datatype {datatype_name}." + return True, f"Invalid geometries found in datatype {datatype_name}" # 2. Check if all geometries are of the expected types if not geodata.geometry.apply(lambda geom: isinstance(geom, tuple(expected_geom_types))).all(): @@ -707,5 +707,5 @@ def validate_geometry( ) # If all checks pass - logger.debug(f"Geometry validation passed for datatype {datatype_name}.") + logger.debug(f"Geometry validation passed for datatype {datatype_name}") return False, "" \ No newline at end of file diff --git a/tests/data_checks/test_input_data_faults.py b/tests/data_checks/test_input_data_faults.py index cf668889..2f70176a 100644 --- a/tests/data_checks/test_input_data_faults.py +++ b/tests/data_checks/test_input_data_faults.py @@ -34,7 +34,7 @@ }, {"structtype_column": "FEATURE", "fault_text": "Fault", "objectid_column": "ID"}, True, - "Invalid geometries found in FAULT data." + "Invalid geometries found in datatype FAULT" ), # Non-string FEATURE column diff --git a/tests/data_checks/test_input_data_fold.py b/tests/data_checks/test_input_data_fold.py index cb92ad2e..75051e56 100644 --- a/tests/data_checks/test_input_data_fold.py +++ b/tests/data_checks/test_input_data_fold.py @@ -27,7 +27,7 @@ ( { "geometry": [ - shapely.geometry.Point(0, 0), # Invalid type + shapely.geometry.LineString([(0,0), (0,0)]), # Invalid type shapely.geometry.LineString([(0, 0), (1, 1)]) ], "FEATURE": ["fold A", "fold B"], @@ -36,7 +36,7 @@ }, {"structtype_column": "FEATURE", "fold_text": "fold", "objectid_column": "ID", "description_column": "description"}, True, - "Invalid geometry types found in FOLD data." + "Invalid geometries found in datatype FOLD" ), # Non-string FEATURE column (