From f467032cd386911afb5bdc4931fe4bd4bf3cca45 Mon Sep 17 00:00:00 2001 From: Ole Nielsen Date: Sun, 14 Aug 2011 19:53:40 +0700 Subject: [PATCH] Wrapped interpolation function in try-except to provide better error message than that mentioned in issue #19 --- impact/engine/interpolation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/impact/engine/interpolation.py b/impact/engine/interpolation.py index 47b36e5..02d8b7e 100644 --- a/impact/engine/interpolation.py +++ b/impact/engine/interpolation.py @@ -34,7 +34,11 @@ def raster_spline(longitudes, latitudes, values): A = numpy.flipud(values) # Call underlying spline - F = RectBivariateSpline(latitudes, longitudes, A) + try: + F = RectBivariateSpline(latitudes, longitudes, A) + except: + msg = 'Interpolation failed. Please zoom out a bit and try again' + raise Exception(msg) # Return interpolator return Interpolator(F, longitudes, latitudes)