diff --git a/HISTORY.rst b/HISTORY.rst index f2a00d535..3a5d95fa9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -64,10 +64,8 @@ Unreleased Changes has been merged into ``utils.read_csv_to_dataframe`` (`#1319 `_), (`#1327 `_) -* Coastal Blue Carbon - * Added validation for the transition table, raising a validation error if - unexpected values are encountered. - (`#729 `_) + * Improved the validation message that is returned when not all spatial + inputs overlap (`#502 `_) * Workbench * Fixed a bug where sampledata downloads failed silently (and progress bar became innacurate) if the Workbench did not have write permission to @@ -85,6 +83,10 @@ Unreleased Changes * Middle clicking an InVEST model tab was opening a blank window. Now middle clicking will close that tab as expected. (`#1261 `_) +* Coastal Blue Carbon + * Added validation for the transition table, raising a validation error if + unexpected values are encountered. + (`#729 `_) * Forest Carbon * The biophysical table is now case-insensitive. * HRA diff --git a/src/natcap/invest/validation.py b/src/natcap/invest/validation.py index 0b0da62c7..6391ca682 100644 --- a/src/natcap/invest/validation.py +++ b/src/natcap/invest/validation.py @@ -56,7 +56,8 @@ 'NOT_AN_INTEGER': gettext('Value "{value}" does not represent an integer'), 'NOT_BOOLEAN': gettext("Value must be either True or False, not {value}"), 'NO_PROJECTION': gettext('Spatial file {filepath} has no projection'), - 'BBOX_NOT_INTERSECT': gettext("Bounding boxes do not intersect: {bboxes}"), + 'BBOX_NOT_INTERSECT': gettext('Not all of the spatial layers overlap each ' + 'other. All bounding boxes must intersect: {bboxes}'), 'NEED_PERMISSION': gettext('You must have {permission} access to this file'), } diff --git a/tests/test_habitat_quality.py b/tests/test_habitat_quality.py index 2c4d9a4d6..fc9ceab06 100644 --- a/tests/test_habitat_quality.py +++ b/tests/test_habitat_quality.py @@ -1934,7 +1934,7 @@ def test_habitat_quality_argspec_spatial_overlap(self): self.assertTrue( validate_result, "expected failed validations instead didn't get any.") - self.assertIn("Bounding boxes do not intersect", validate_result[0][1]) + self.assertIn("bounding boxes must intersect", validate_result[0][1]) def test_habitat_quality_argspec_missing_projection(self): """Habitat Quality: raise error on missing projection.""" diff --git a/workbench/src/renderer/components/SetupTab/ArgInput/index.jsx b/workbench/src/renderer/components/SetupTab/ArgInput/index.jsx index b6166a92a..e19041909 100644 --- a/workbench/src/renderer/components/SetupTab/ArgInput/index.jsx +++ b/workbench/src/renderer/components/SetupTab/ArgInput/index.jsx @@ -30,7 +30,8 @@ const { ipcRenderer } = window.Workbench.electron; * @returns {string} - the filtered and formatted part of the message */ function filterSpatialOverlapFeedback(message, filepath) { - const newPrefix = i18n.t('Bounding box does not intersect at least one other:'); + const newPrefix = i18n.t( + 'Not all of the spatial layers overlap each other. Bounding box:'); const bbox = message.split(`${filepath}:`).pop().split('|')[0]; const bboxFormatted = bbox.split(' ').map( (str) => str.padEnd(22, ' ') @@ -167,7 +168,7 @@ export default function ArgInput(props) { // Messages with this pattern include validation feedback about // multiple inputs, but the whole message is repeated for each input. // It's more readable if filtered on the individual input. - const pattern = 'Bounding boxes do not intersect'; + const pattern = 'Not all of the spatial layers overlap each other'; if (validationMessage.startsWith(pattern)) { validationMessage = filterSpatialOverlapFeedback( validationMessage, value diff --git a/workbench/tests/renderer/setuptab.test.js b/workbench/tests/renderer/setuptab.test.js index 843aba394..4806ad0b2 100644 --- a/workbench/tests/renderer/setuptab.test.js +++ b/workbench/tests/renderer/setuptab.test.js @@ -592,8 +592,8 @@ describe('Misc form validation stuff', () => { const rasterValue = './raster.tif'; const expectedVal2 = '-79.0198012081401'; const rasterBox = `[${expectedVal2}, 26.481559513537064, -78.37173806200593, 27.268061760228512]`; - const message = `Bounding boxes do not intersect: ${vectorValue}: ${vectorBox} | ${rasterValue}: ${rasterBox}`; - const newPrefix = 'Bounding box does not intersect at least one other:'; + const message = `Not all of the spatial layers overlap each other. All bounding boxes must intersect: ${vectorValue}: ${vectorBox} | ${rasterValue}: ${rasterBox}`; + const newPrefix = 'Not all of the spatial layers overlap each other. Bounding box:'; const vectorMessage = new RegExp(`${newPrefix}\\s*\\[${expectedVal1}`); const rasterMessage = new RegExp(`${newPrefix}\\s*\\[${expectedVal2}`);