Add an argument to get_ts* functions in order to complete the time series with the missing time step
By default, the get_ts_* functions (actually the PHyC database) do not return time steps that correspond to missing values in the time series. Therefore, currently, the calculation of % of NA values is always equal to 0.
ts_flow <- get_ts_hydro(code = "B435201001", metric = "QmnJ",
date_start = "1967-12-10",
date_end = "1967-12-30", step = 1)
ts_flow
QmnJ (l/s) time series of 10 timesteps (0.0 % of NAs)
Feature code: B435201001
Requested period: start: 1967-12-10 end: 1967-12-30
v t md s q m c
1 3450 1967-12-19 <NA> 16 20 10 1
2 3240 1967-12-20 <NA> 16 20 10 0
3 3130 1967-12-21 <NA> 16 20 10 0
4 31500 1967-12-24 <NA> 16 12 10 4
5 24200 1967-12-25 <NA> 16 12 10 0
6 17500 1967-12-26 <NA> 16 20 10 0
7 12600 1967-12-27 <NA> 16 20 10 0
8 9070 1967-12-28 <NA> 16 20 10 0
9 8140 1967-12-29 <NA> 16 20 10 0
10 7610 1967-12-30 <NA> 16 20 10 0
It would be nice to provide an argument that automatically completes time series for regular metrics.
This would require using the type of 'metric' and the value of the 'step' argument.
The % of NA values should only be calculated in this case.