From 419a33b96d201d37b9aadff4a089cc27f86df6c5 Mon Sep 17 00:00:00 2001 From: James Brown <64858662+james-d-brown@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:17:02 +0100 Subject: [PATCH 1/2] Warn, rather than error, when an evaluation declares an instantaneous 'time_scale', #48. --- .../src/wres/config/yaml/DeclarationValidator.java | 12 +++++++----- .../wres/config/yaml/DeclarationValidatorTest.java | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/wres-config/src/wres/config/yaml/DeclarationValidator.java b/wres-config/src/wres/config/yaml/DeclarationValidator.java index 44e573b113..faf2f60a7f 100644 --- a/wres-config/src/wres/config/yaml/DeclarationValidator.java +++ b/wres-config/src/wres/config/yaml/DeclarationValidator.java @@ -4023,11 +4023,13 @@ private static List evaluationTimeScaleIsValid( TimeScale { EvaluationStatusEvent event = EvaluationStatusEvent.newBuilder() - .setStatusLevel( StatusLevel.ERROR ) - .setEventMessage( "The evaluation 'time_scale' is prescriptive and " - + "cannot be instantaneous. Please remove the " - + "evaluation 'time_scale' or increase it and try " - + AGAIN ) + .setStatusLevel( StatusLevel.WARN ) + .setEventMessage( "The evaluation 'time_scale' is instantaneous. If the " + + "datasets all contain instantaneous values, this " + + "declaration is redundant and should be removed. " + + "Otherwise, the declaration is invalid because " + + "the smallest possible time scale is " + + "instantaneous and downscaling is not supported." ) .build(); events.add( event ); } diff --git a/wres-config/test/wres/config/yaml/DeclarationValidatorTest.java b/wres-config/test/wres/config/yaml/DeclarationValidatorTest.java index 8cacd54406..8d60796614 100644 --- a/wres-config/test/wres/config/yaml/DeclarationValidatorTest.java +++ b/wres-config/test/wres/config/yaml/DeclarationValidatorTest.java @@ -701,7 +701,7 @@ void testEvaluateDatasetTimeScaleIsValidResultsinError() } @Test - void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInErrors() + void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInWarningsAndErrors() { TimeScale timeScaleInnerSource = TimeScale.newBuilder() .setPeriod( Duration.newBuilder() @@ -754,8 +754,9 @@ void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInErrors() List events = DeclarationValidator.validate( declaration ); - assertAll( () -> assertTrue( DeclarationValidatorTest.contains( events, "cannot be instantaneous", - StatusLevel.ERROR ) ), + assertAll( () -> assertTrue( DeclarationValidatorTest.contains( events, "The evaluation 'time_scale' " + + "is instantaneous", + StatusLevel.WARN ) ), () -> assertTrue( DeclarationValidatorTest.contains( events, "is smaller than the " + "evaluation 'time_scale'", StatusLevel.ERROR ) ), From 368a0966e52f2a4f76bce60291aabb9dbbdf1200 Mon Sep 17 00:00:00 2001 From: James Brown <64858662+james-d-brown@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:35:25 +0100 Subject: [PATCH 2/2] Adjust a warning message, #48. --- wres-config/src/wres/config/yaml/DeclarationValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wres-config/src/wres/config/yaml/DeclarationValidator.java b/wres-config/src/wres/config/yaml/DeclarationValidator.java index faf2f60a7f..11d8852e43 100644 --- a/wres-config/src/wres/config/yaml/DeclarationValidator.java +++ b/wres-config/src/wres/config/yaml/DeclarationValidator.java @@ -4028,7 +4028,7 @@ private static List evaluationTimeScaleIsValid( TimeScale + "datasets all contain instantaneous values, this " + "declaration is redundant and should be removed. " + "Otherwise, the declaration is invalid because " - + "the smallest possible time scale is " + + "the smallest possible 'time_scale' is " + "instantaneous and downscaling is not supported." ) .build(); events.add( event );