Skip to content

Commit

Permalink
Merge pull request #49 from NOAA-OWP/issue48
Browse files Browse the repository at this point in the history
Issue48
  • Loading branch information
james-d-brown authored Jul 19, 2024
2 parents b1820f2 + 368a096 commit 4b80685
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 7 additions & 5 deletions wres-config/src/wres/config/yaml/DeclarationValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4023,11 +4023,13 @@ private static List<EvaluationStatusEvent> 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 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void testEvaluateDatasetTimeScaleIsValidResultsinError()
}

@Test
void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInErrors()
void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInWarningsAndErrors()
{
TimeScale timeScaleInnerSource = TimeScale.newBuilder()
.setPeriod( Duration.newBuilder()
Expand Down Expand Up @@ -754,8 +754,9 @@ void testEvaluationTimeScaleIsConsistentWithDatasetTimeScalesResultsInErrors()

List<EvaluationStatusEvent> 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 ) ),
Expand Down

0 comments on commit 4b80685

Please sign in to comment.