NOAA-OWP / wres

Code and scripts for the Water Resources Evaluation Service
Other
2 stars 1 forks source link

As a user, I don't want index out of bound exceptions when asking for sampling uncertainty in a NWRFC evaluation of RFC forecasts spanning a year #323

Closed HankHerr-NOAA closed 1 month ago

HankHerr-NOAA commented 1 month ago

The exception is below. The declaration will be in the first comment. I'm going to try to reproduce the error using a smaller evaluation.

Hank

====================================================

wres.pipeline.InternalWresException: Could not complete project execution
    at wres.pipeline.Evaluator.evaluate(Evaluator.java:406)
    at wres.pipeline.Evaluator.evaluate(Evaluator.java:178)
    at wres.Functions.evaluate(Functions.java:135)
    at wres.server.EvaluationService.lambda$startEvaluation$2(EvaluationService.java:695)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: wres.pipeline.WresProcessingException: Encountered an error while processing evaluation 'NHdKnQhBdZ3_INE3ziSXKkrVBJY': 
    at wres.pipeline.Evaluator.evaluate(Evaluator.java:835)
    at wres.pipeline.Evaluator.evaluate(Evaluator.java:377)
    ... 7 common frames omitted
Caused by: java.util.concurrent.CompletionException: wres.datamodel.bootstrap.ResamplingException: Encountered an error while attempting to resample a time-series.
    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770)
    ... 3 common frames omitted
Caused by: wres.datamodel.bootstrap.ResamplingException: Encountered an error while attempting to resample a time-series.
    at wres.datamodel.bootstrap.StationaryBootstrapResampler.resample(StationaryBootstrapResampler.java:705)
    at wres.datamodel.bootstrap.StationaryBootstrapResampler.resample(StationaryBootstrapResampler.java:159)
    at wres.pipeline.pooling.PoolProcessor.getSamplingUncertaintyStatistics(PoolProcessor.java:597)
    at wres.pipeline.pooling.PoolProcessor.createStatistics(PoolProcessor.java:492)
    at wres.pipeline.pooling.PoolProcessor.get(PoolProcessor.java:151)
    at wres.pipeline.pooling.PoolProcessor.get(PoolProcessor.java:60)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    ... 3 common frames omitted
Caused by: java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 1 Size: 1
    at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
    at wres.datamodel.bootstrap.StationaryBootstrapResampler.resample(StationaryBootstrapResampler.java:693)
    ... 9 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 1 Size: 1
    at java.base/java.util.ImmutableCollections$AbstractImmutableList.outOfBounds(ImmutableCollections.java:333)
    at java.base/java.util.ImmutableCollections$List12.get(ImmutableCollections.java:585)
    at wres.datamodel.bootstrap.StationaryBootstrapResampler.lambda$getTimeSeriesResampler$1(StationaryBootstrapResampler.java:745)
    at wres.datamodel.bootstrap.StationaryBootstrapResampler.lambda$resample$0(StationaryBootstrapResampler.java:683)
    ... 4 common frames omitted
2024-09-25T12:28:28.206+0000  [qtp1888639813-30] INFO EvaluationService - Closing Evaluation
HankHerr-NOAA commented 1 month ago

Full size declaration:

label: RFC_AHPS_Flow_90day_CSV
observed:
  label: USGS NWIS Streamflow Observations
  sources:
    uri: https://nwis.waterservices.usgs.gov/nwis/iv
    interface: usgs nwis
  variable: "00060"
  type: observations
predicted:
  label: RFC_AHPS_Flow_90day_CSV
  sources:
    uri: http://[WRDS]/api/rfc_forecast/v2.0/forecast/streamflow
    interface: wrds ahps
  variable: QR
  type: single valued forecasts
feature_service:
  uri: https://[WRDS]/api/location/v3.0/metadata
  group: rfc
  value: nwrfc
unit: ft3/s
reference_dates:
  minimum: 2023-06-26T00:00:00Z
  maximum: 2024-06-26T00:00:00Z
valid_dates:
  minimum: 2023-06-26T00:00:00Z
  maximum: 2024-06-26T00:00:00Z
lead_times:
  minimum: 0
  maximum: 240
  unit: hours
lead_time_pools:
  period: 6
  frequency: 6
  unit: hours
sampling_uncertainty:
  sample_size: 1000
  quantiles: [0.05,0.5,0.95]
metrics:
  - volumetric efficiency
  - mean absolute error
  - mean error
  - coefficient of determination
  - root mean square error
  - mean square error
  - bias fraction
  - sample size
  - root mean square error normalized
  - mean square error skill score normalized
output_formats:
  - csv2
  - png
HankHerr-NOAA commented 1 month ago

I found the problematic feature. This declaration below reproduces the exception. I've attached the RFC forecast data:

GitHub323_SRPW1_rfc_forecast_data.json.gz

Hank

==========

label: RFC_AHPS_Flow_90day_CSV
observed:
  label: USGS NWIS Streamflow Observations
  sources:
    uri: https://nwis.waterservices.usgs.gov/nwis/iv
    interface: usgs nwis
  variable: "00060"
  type: observations
predicted:
  label: RFC_AHPS_Flow_90day_CSV
  sources:
    uri: http://[WRDS]/api/rfc_forecast/v2.0/forecast/streamflow
    interface: wrds ahps
  variable: QR
  type: single valued forecasts
features:
  - {observed: '12061500', predicted: 'SRPW1'}
feature_service:
  uri: https://[WRDS]/api/location/v3.0/metadata
#  group: rfc
# value: nwrfc
unit: ft3/s
reference_dates:
  minimum: 2023-06-26T00:00:00Z
  maximum: 2024-06-26T00:00:00Z
valid_dates:
  minimum: 2023-06-26T00:00:00Z
  maximum: 2024-06-26T00:00:00Z
lead_times:
  minimum: 0
  maximum: 240
  unit: hours
lead_time_pools:
  period: 6
  frequency: 6
  unit: hours
sampling_uncertainty:
  sample_size: 1000
  quantiles: [0.05,0.5,0.95]
metrics:
  - volumetric efficiency
  - mean absolute error
  - mean error
  - coefficient of determination
  - root mean square error
  - mean square error
  - bias fraction
  - sample size
  - root mean square error normalized
  - mean square error skill score normalized
output_formats:
  - csv2
  - png
james-d-brown commented 1 month ago

Looking at this one.

james-d-brown commented 1 month ago

Will attempt to reproduce and then estimate.

james-d-brown commented 1 month ago

Same issue, different manifestation, but this was also fixed with the most recent commit for #318.

james-d-brown commented 1 month ago

Closed, pending UAT.

epag commented 3 weeks ago

UAT of the above job passes in 7774567139419290328