Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When this interface is implemented the method useUnreliables() must be specified. A boolean must be returned which defines whether or not unreliable data should be included in the input.

Unfortunately it is not possible to use a configured option to determine if unreliables are allowed, because the usage of unreliables are handled before the configured options are processed. 

Code Block
languagejava
titleExample Java class for custom transformation processing location attributes
package nl.wldelft.fews.openapi.transformationmodule;

import nl.wldelft.util.timeseries.TimeSeriesArray;

public class CustomIncludeUnreliablesTestFunction implements Calculation, UseUnreliableInputValueFunction {

    @Input
    TimeSeriesArray inputSeries = null;
    @Output
    TimeSeriesArray outputSeries = null;

    @Override
    public boolean useUnreliables() {
        return true;
    }

    @Override
    public void calculate() throws Exception {
        for (int i = 0, size = inputSeries.size(); i < size; i++) {
            long time = inputSeries.getTime(i);
            outputSeries.putValue(time, inputSeries.getValue(i));
            int indexOfTime = outputSeries.indexOfTime(time);
            outputSeries.setFlag(indexOfTime, inputSeries.getFlag(i));
        }
    }
}

...