From 5a6d517c1a6bab506cd11834b6194487a5bce973 Mon Sep 17 00:00:00 2001 From: Thomas Nipen Date: Thu, 16 Jan 2025 14:35:31 +0100 Subject: [PATCH] Don't use Delaunay with fewer than 4 points --- bris/outputs/verif.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bris/outputs/verif.py b/bris/outputs/verif.py index bc42eec..68e5a87 100644 --- a/bris/outputs/verif.py +++ b/bris/outputs/verif.py @@ -80,12 +80,12 @@ def __init__( self.opoints = gridpp.Points(self.obs_lats, self.obs_lons, self.obs_altitudes) self.opoints_tuple = np.column_stack((self.obs_lats, self.obs_lons)) - - if not self._is_gridded_input: + self.triangulation = self.ipoints_tuple + if not self._is_gridded_input and len(self.ipoints_tuple[0]) > 3: + # This speeds up interpolation from irregular points to observation points + # but Delaunay needs enough points for this to work self.triangulation = Delaunay(self.ipoints_tuple) - else: - self.triangulation = None - + # The intermediate will only store the final output locations intermediate_pm = PredictMetadata( [variable],