diff --git a/wres-config/nonsrc/schema.yml b/wres-config/nonsrc/schema.yml index 8232558304..6f7da2758b 100644 --- a/wres-config/nonsrc/schema.yml +++ b/wres-config/nonsrc/schema.yml @@ -1489,13 +1489,16 @@ definitions: is present, evaluates common events by reference time and valid time. If absent, retains all events of each type. With fuzzy matching, each time- series is matched with its nearest, corresponding, time-series according to - the total duration between all reference times of a corresponding type. In - other words, if there is an exact match, that will be used, else the time- - series whose reference times are nearest overall. Once a time-series has - been matched, it cannot be re-used. Always uses exact matching for valid - times. The scope of the cross-pairing always includes the predicted and - baseline datasets, where defined, and may be further controlled using the - 'scope' parameter." + the total duration between all reference times across the candidate time- + series. In other words, if there is an exact match, that will be used, else + the time-series whose reference times are nearest overall. With exact + matching, both the type of reference time and the time itself must + correspond. With fuzzy matching, all types of reference time are considered + equal and hence used to calculate the total duration between all reference + times of the candidate series. Once a time-series has been matched, it + cannot be re-used. Always uses exact matching for valid times. The scope of + the cross-pairing always includes the predicted and baseline datasets, where + defined, and may be further controlled using the 'scope' parameter." type: string enum: - exact diff --git a/wres-datamodel/src/wres/datamodel/time/TimeSeriesCrossPairer.java b/wres-datamodel/src/wres/datamodel/time/TimeSeriesCrossPairer.java index 5091cddbbd..6ee5a37910 100644 --- a/wres-datamodel/src/wres/datamodel/time/TimeSeriesCrossPairer.java +++ b/wres-datamodel/src/wres/datamodel/time/TimeSeriesCrossPairer.java @@ -359,9 +359,31 @@ private
Duration getTotalDurationBetweenCommonTimeTypes( TimeSeries
fi
Set Duration getTotalDurationBetweenCommonTimeTypes( TimeSeries fi
.collect( Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue ) );
}
- if ( firstTimes.isEmpty() || secondTimes.isEmpty() )
- {
- String append = "";
- if ( method != CrossPairMethod.FUZZY )
- {
- append = "For lenient cross-pairing that considers all types of reference time equivalent, declare the "
- + "'fuzzy' cross-pairing method. ";
- }
-
- throw new PairingException( "Encountered an error while inspecting time-series to cross-pair. Attempted to "
- + "calculate the total duration between the commonly typed "
- + "reference times of two time-series, but no commonly typed reference times "
- + "were discovered, which is not allowed. "
- + append
- + "The first time-series was: "
- + first.getMetadata()
- + ". The second time-series was: "
- + second.getMetadata()
- + ". The first time-series had reference time types of: "
- + first.getReferenceTimes()
- .keySet()
- + ". The second time-series had reference time types of: "
- + second.getReferenceTimes()
- .keySet()
- + "." );
- }
-
// The neutral difference
Duration returnMe = Duration.ZERO;
+ // Iterate through the differences and sum them
for ( Instant firstInstant : firstTimes.values() )
{
for ( Instant secondInstant : secondTimes.values() )
diff --git a/wres-datamodel/test/wres/datamodel/time/TimeSeriesCrossPairerTest.java b/wres-datamodel/test/wres/datamodel/time/TimeSeriesCrossPairerTest.java
index 23b4dfa9ea..2c6c420f4c 100644
--- a/wres-datamodel/test/wres/datamodel/time/TimeSeriesCrossPairerTest.java
+++ b/wres-datamodel/test/wres/datamodel/time/TimeSeriesCrossPairerTest.java
@@ -9,6 +9,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -57,7 +58,7 @@ void runBeforeEachTest()
}
@Test
- void testCrossPairTwoTimeSeriesWithEqualReferenceTimesThatEachAppearTwice()
+ void testCrossPairTwoTimeSeriesWithEqualReferenceTimesThatEachAppearTwiceAndFuzzyMatching()
{
Event