From 02595acf5101faa4d57cb526c846010628fb19fe Mon Sep 17 00:00:00 2001 From: "Paul M. Gurniak" Date: Fri, 17 Apr 2020 15:17:03 -0400 Subject: [PATCH] Fix for coordinate pair validation --- theto/coordinate_utils.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/theto/coordinate_utils.py b/theto/coordinate_utils.py index 335c820..4be8364 100644 --- a/theto/coordinate_utils.py +++ b/theto/coordinate_utils.py @@ -252,21 +252,28 @@ def validate_latlon_pair(value): """ if len(value) != 2: - raise ValueError('List inputs are assumed to be coordinate pairs. This list has more than two elements.') + raise ValueError( + ' '.join([ + 'List inputs are assumed to be coordinate pairs,', + 'but this list has more than two elements:', + str(value) + ]) if not (-180.0 <= value[0] <= 180.0): raise ValueError( ' '.join([ 'The first element of the list is assumed to be longitude (x-coordinates),', - 'but this element is outside acceptable bounds (-180.0, 180.0)' + 'but this element is outside acceptable bounds (-180.0, 180.0):', + str(value[0]) ]) ) - if not (-90.0 <= value[0] <= 90.0): + if not (-90.0 <= value[1] <= 90.0): raise ValueError( ' '.join([ 'The second element of the list is assumed to be latitude (y-coordinates),', - 'but this element is outside acceptable bounds (-90.0, 90.0)' + 'but this element is outside acceptable bounds (-90.0, 90.0):', + str(value[1]) ]) )