Assertion on 'speed' failed when building emission model #102
-
Hi, i tried to use the package to build emission model using Transjakarta GTFS (BRT in Indonesia). Afterwards i generated emission model using code below: The code resulted in error below: Any help would be really appreciated. Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @nadiaqamilla , library(gtfstools)
library(data.table)
library(gtfs2gps)
library(magrittr)
library(gtfs2emis)
# run transport model (for only shape_id "xwq4")
tp_model_fix_speed <- gtfs_data %>%
gtfstools::filter_by_shape_id("xwq4") %>%
gtfs2gps::gtfs2gps() %>%
gtfs2gps::adjust_speed(new_speed = units::set_units(36,"km/h")) %>%
gtfs2gps::gps_as_sflinestring()
# emissions from fix shape_id
emi_list_fix <- emission_model(tp_model = tp_model_fix_speed,
ef_model = "ef_europe_emep"
, fleet_data = fleet_df,
pollutant = c("CO2","PM10")
, reference_year = 2020 )
# run transport model (for all shape_id`s except "xwq4")
all_shapeids <- setdiff(unique(gtfs_small$shapes$shape_id),"xwq4")
new_gtfs <- gtfstools::filter_by_shape_id(gtfs_small,all_shapeids)
new_tp_model <- gtfs2emis::transport_model(gtfs_data = new_gtfs
, spatial_resolution = 100,
parallel = TRUE)
# emissions model (for all shape_id's except "xwq4")
new_emi_list <- emission_model(tp_model = new_tp_model
, ef_model = "ef_europe_emep"
, fleet_data = fleet_df
, pollutant = c("CO2","PM10")
, reference_year = 2020 )
|
Beta Was this translation helpful? Give feedback.
Hi @nadiaqamilla ,
Thanks for bringing this up. I don't have the Transjakarta GTFS to reproduce the results, but it seems a familiar issue. This probably happens because there is an invalid speed being input into the emissions model (which could be NA, Inf, or NaN). One possible workaround is fixing the speed of the shape_id
xwq4
. In the example below, I changed the speed values to 36 km/h. Let me know if this works for you.