From 3443b2af57dd30b25e73cbe098c9723e0a4b09c2 Mon Sep 17 00:00:00 2001 From: huikyole Date: Wed, 11 Nov 2015 10:56:33 -0800 Subject: [PATCH] CLIMATE-704 - Sensitivity of spatial boundary check in dataset_processor - ocw.dataset_processor._are_bounds_contained_by_dataset has been updated to make it less sensitive to very small differences in spatial boundary limits --- ocw/dataset_processor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py index 90e644ec..ea086801 100755 --- a/ocw/dataset_processor.py +++ b/ocw/dataset_processor.py @@ -1093,19 +1093,19 @@ def _are_bounds_contained_by_dataset(bounds, dataset): errors = [] # TODO: THIS IS TERRIBLY inefficent and we need to use a geometry lib instead in the future - if not lat_min <= bounds.lat_min <= lat_max: + if not np.round(lat_min,3) <= np.round(bounds.lat_min,3) <= np.round(lat_max,3): error = "bounds.lat_min: %s is not between lat_min: %s and lat_max: %s" % (bounds.lat_min, lat_min, lat_max) errors.append(error) - if not lat_min <= bounds.lat_max <= lat_max: + if not np.round(lat_min,3) <= np.round(bounds.lat_max,3) <= np.round(lat_max,3): error = "bounds.lat_max: %s is not between lat_min: %s and lat_max: %s" % (bounds.lat_max, lat_min, lat_max) errors.append(error) - if not lon_min <= bounds.lon_min <= lon_max: + if not np.round(lon_min,3) <= np.round(bounds.lon_min,3) <= np.round(lon_max,3): error = "bounds.lon_min: %s is not between lon_min: %s and lon_max: %s" % (bounds.lon_min, lon_min, lon_max) errors.append(error) - if not lon_min <= bounds.lon_max <= lon_max: + if not np.round(lon_min,3) <= np.round(bounds.lon_max,3) <= np.round(lon_max,3): error = "bounds.lon_max: %s is not between lon_min: %s and lon_max: %s" % (bounds.lon_max, lon_min, lon_max) errors.append(error)