From 2a3a7831eaa3678677501a842e9697cd6f3b37f7 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 18 Apr 2019 10:43:49 +0100 Subject: [PATCH] Added error message when using #geometry_objects_read & a data value is greater than index of specified materials. --- gprMax/input_cmds_geometry.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gprMax/input_cmds_geometry.py b/gprMax/input_cmds_geometry.py index 22688803..bad0d6a7 100644 --- a/gprMax/input_cmds_geometry.py +++ b/gprMax/input_cmds_geometry.py @@ -121,6 +121,10 @@ def process_geometrycmds(geometry, G): if data.dtype != 'int16': data = data.astype('int16') + # Check that there are no values in the data greater than the maximum index for the specified materials + if np.amax(data) > len(materials) - 1: + raise CmdInputError("'" + ' '.join(tmp) + "'" + ' found data value(s) ({}) in the geometry objects file greater than the maximum index for the specified materials ({})'.format(np.amax(data), len(materials) - 1)) + # Look to see if rigid and ID arrays are present (these should be # present if the original geometry objects were written from gprMax) try: