sampling=custom is used within calculations
We have examined data_capture from the analysis service.
The analysis service calls calculate_statistics from toarstats.metrics, BUT the given data range is not forwarded to metrics at all!
To calculate the data_capture, a reference time column is created -- the reference starts at the first data point of the time series and ends with the last data point of the time series (without knowing anything about a possibly existing date range for a custom sampling). This also made sense for the previous calculations (where no date range was given), because you (probably) wanted to know how good a time series is covered in its measurement interval (i.e. as long as the measurements were taken at a station).
However, if a date range is specified in the query, you want to know the coverage of the time series in this particular date range.
Therefore, if a date range is available, this date range must be forwarded to the calculate_statistics method,
and the reference time column must be generated matching this date range.