Closed Joaobazzo closed 4 years ago
Indeed, this happens because iTime only accepts integer values so the smaller unit is seconds
. This idea of using round()
seems like a good suggestion to me. @pedro-andrade-inpe , what do you think ?
> data.table::as.ITime(1) + data.table::as.ITime(1)
[1] "00:00:02"
>
>
> data.table::as.ITime(0) + data.table::as.ITime(1)
[1] "00:00:01"
>
>
> data.table::as.ITime(.5) + data.table::as.ITime(.5)
[1] "00:00:00"
I thing round()
is a good idea. My only concern is that, as we are going to compute the average speed, having zero values for time is always unwanted, as it will produce infinite speeds. Additionally, if considering a distance of 15 meters, the maximum speed will be 54km/h if the travel time takes one second, but there are speeds higher than this value in some gtfs data that we use. Possibly it will be better to compute the speeds using the original values before converting to ITime
.
Arredondar dentro do parenteses na linha 189 desse script https://github.com/ipeaGIT/gtfs2gps/blob/9fb6909aeedd1001bef6731e5cf00280db07309f/R/gtfs2gps_dt_parallel.R
Every convertion to ITimes
in mod_updates
that involves an arithmetical operation already uses round
. Therefore this issue can be considered finished.
The
as.ITime
function seems to have an issue with non-integer valuesPerhaps we should use in all scripts (such as
gtfs2gps_dt_parellel.R
) the functionround
inside it