diff --git a/articles/gtfs2emis_emission_factor.html b/articles/gtfs2emis_emission_factor.html index 60bed02..8410cc6 100644 --- a/articles/gtfs2emis_emission_factor.html +++ b/articles/gtfs2emis_emission_factor.html @@ -88,7 +88,7 @@
vignettes/gtfs2emis_emission_factor.Rmd
gtfs2emis_emission_factor.Rmd
vignettes/gtfs2emis_fleet_data.Rmd
gtfs2emis_fleet_data.Rmd
vignettes/gtfs2emis_intro_vignette.Rmd
gtfs2emis_intro_vignette.Rmd
vignettes/gtfs2emis_non_exhaust_ef.Rmd
gtfs2emis_non_exhaust_ef.Rmd
# \donttest{
-library(gtfstools)
+if (requireNamespace("gtfstools", quietly=TRUE)) {
library(sf)
-#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
@@ -145,14 +144,6 @@ Examples
tp_model <- transport_model(gtfs_data = gtfs_small,
spatial_resolution = 100,
parallel = FALSE)
-#> Converting shapes to sf objects
-#> Processing the data
-#>
-#> Attaching package: ‘data.table’
-#> The following object is masked from ‘package:purrr’:
-#>
-#> transpose
-#> udunits database from /usr/share/xml/udunits/udunits2.xml
# Fleet data, using Brazilian emission model and fleet
fleet_data_ef_cetesb <- data.frame(veh_type = "BUS_URBAN_D",
@@ -167,7 +158,6 @@ Examples
fleet_data = fleet_data_ef_cetesb,
pollutant = c("CO","PM10","CO2","CH4","NOx")
)
-#> Constant emission factor along the route
# create spatial grid
grid <- sf::st_make_grid(
@@ -183,6 +173,17 @@ Examples
plot(grid)
plot(emi_grid["PM10_2010"],add = TRUE)
plot(st_geometry(emi_list$tp_model), add = TRUE,col = "black")
+}
+#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE
+#> Converting shapes to sf objects
+#> Processing the data
+#>
+#> Attaching package: ‘data.table’
+#> The following object is masked from ‘package:purrr’:
+#>
+#> transpose
+#> udunits database from /usr/share/xml/udunits/udunits2.xml
+#> Constant emission factor along the route
# }
# \donttest{
-library(gtfstools)
+if (requireNamespace("gtfstools", quietly=TRUE)) {
# read GTFS
gtfs_file <- system.file("extdata/irl_dub_gtfs.zip", package = "gtfs2emis")
@@ -140,8 +140,6 @@ Examples
tp_model <- transport_model(gtfs_data = gtfs,
spatial_resolution = 100,
parallel = FALSE)
-#> Converting shapes to sf objects
-#> Processing the data
# fleet data
fleet_df <- read.csv(system.file("extdata/irl_dub_fleet.txt"
@@ -151,76 +149,37 @@ Examples
, ef_model = "ef_europe_emep"
, fleet_data = fleet_df
, pollutant = c("CO2","PM10"))
-#> 'CO2' Emission factor not found for 'SCR' Technology and Euro 'IV'.
-#> The package assumes missing Technology entry. Please check `data(ef_europe_emep_db)` for available data.
-#> 'CO2' Emission factor not found for 'DPF+SCR' Technology and Euro 'VI'.
-#> The package assumed 'SCR' Technology entry. Please check `data(ef_europe_emep_db)` for available data.
# Aggregate total emissions by 'pollutant'
emis_summary(emi_list)
-#> Loading required namespace: testthat
-#> pollutant process emi
-#> <char> <char> <units>
-#> 1: CO2 hot_exhaust 1.085255e+04 [g]
-#> 2: PM10 hot_exhaust 3.539287e-01 [g]
# by vehicle type
emis_summary(emi_list, by = "vehicle")
-#> veh_type pollutant process emi
-#> <char> <char> <char> <units>
-#> 1: Ubus Std 15 - 18 t CO2 hot_exhaust 1.085255e+04 [g]
-#> 2: Ubus Std 15 - 18 t PM10 hot_exhaust 3.539287e-01 [g]
emis_summary(emi_list
, by = "vehicle"
, veh_vars = c("euro"))
-#> euro pollutant process emi
-#> <char> <char> <char> <units>
-#> 1: III CO2 hot_exhaust 1.279127e+02 [g]
-#> 2: IV CO2 hot_exhaust 3.641845e+03 [g]
-#> 3: V CO2 hot_exhaust 1.459425e+03 [g]
-#> 4: VI CO2 hot_exhaust 5.623366e+03 [g]
-#> 5: III PM10 hot_exhaust 2.561448e-02 [g]
-#> 6: IV PM10 hot_exhaust 1.700779e-01 [g]
-#> 7: V PM10 hot_exhaust 1.145693e-01 [g]
-#> 8: VI PM10 hot_exhaust 4.366704e-02 [g]
emis_summary(emi_list
, by = "vehicle"
, veh_vars = c("fuel"))
-#> fuel pollutant process emi
-#> <char> <char> <char> <units>
-#> 1: D CO2 hot_exhaust 1.085255e+04 [g]
-#> 2: D PM10 hot_exhaust 3.539287e-01 [g]
emis_summary(emi_list
, by = "vehicle"
, veh_vars = c("veh_type","euro","tech","fuel"))
-#> veh_type euro tech fuel pollutant process
-#> <char> <char> <char> <char> <char> <char>
-#> 1: Ubus Std 15 - 18 t III - D CO2 hot_exhaust
-#> 2: Ubus Std 15 - 18 t IV SCR D CO2 hot_exhaust
-#> 3: Ubus Std 15 - 18 t V SCR D CO2 hot_exhaust
-#> 4: Ubus Std 15 - 18 t VI DPF+SCR D CO2 hot_exhaust
-#> 5: Ubus Std 15 - 18 t III - D PM10 hot_exhaust
-#> 6: Ubus Std 15 - 18 t IV SCR D PM10 hot_exhaust
-#> 7: Ubus Std 15 - 18 t V SCR D PM10 hot_exhaust
-#> 8: Ubus Std 15 - 18 t VI DPF+SCR D PM10 hot_exhaust
-#> emi
-#> <units>
-#> 1: 1.279127e+02 [g]
-#> 2: 3.641845e+03 [g]
-#> 3: 1.459425e+03 [g]
-#> 4: 5.623366e+03 [g]
-#> 5: 2.561448e-02 [g]
-#> 6: 1.700779e-01 [g]
-#> 7: 1.145693e-01 [g]
-#> 8: 4.366704e-02 [g]
# by time of the day
emis_summary(emi_list
, by = "time"
, segment_vars = "slope")
+}
+#> Converting shapes to sf objects
+#> Processing the data
+#> 'CO2' Emission factor not found for 'SCR' Technology and Euro 'IV'.
+#> The package assumes missing Technology entry. Please check `data(ef_europe_emep_db)` for available data.
+#> 'CO2' Emission factor not found for 'DPF+SCR' Technology and Euro 'VI'.
+#> The package assumed 'SCR' Technology entry. Please check `data(ef_europe_emep_db)` for available data.
+#> Loading required namespace: testthat
#> timestamp_hour pollutant process emi
#> <int> <char> <char> <units>
#> 1: 8 CO2 hot_exhaust 1.076303e+04 [g]
diff --git a/reference/emis_to_dt.html b/reference/emis_to_dt.html
index a4cd118..ae8eb0e 100644
--- a/reference/emis_to_dt.html
+++ b/reference/emis_to_dt.html
@@ -133,7 +133,7 @@ See also
Examples
# \donttest{
-library(gtfstools)
+ if (requireNamespace("gtfstools", quietly=TRUE)) {
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
@@ -149,8 +149,6 @@ Examples
new_speed = 20,
spatial_resolution = 100,
parallel = FALSE)
-#> Converting shapes to sf objects
-#> Processing the data
# Example using Brazilian emission model and fleet
fleet_data_ef_cetesb <- data.frame(veh_type = "BUS_URBAN_D",
@@ -165,10 +163,13 @@ Examples
fleet_data = fleet_data_ef_cetesb,
pollutant = c("CO","PM10","CO2","CH4","NOx")
)
-#> Constant emission factor along the route
# convert emission list to data.table
dt <- emis_to_dt(emi_list)
+}
+#> Converting shapes to sf objects
+#> Processing the data
+#> Constant emission factor along the route
# }
diff --git a/reference/emission_model.html b/reference/emission_model.html
index 90d5130..9ea21ec 100644
--- a/reference/emission_model.html
+++ b/reference/emission_model.html
@@ -221,7 +221,7 @@ See also
Examples
# \donttest{
-library(gtfstools)
+ if (requireNamespace("gtfstools", quietly=TRUE)) {
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
@@ -237,8 +237,6 @@ Examples
new_speed = 20,
spatial_resolution = 100,
parallel = FALSE)
-#> Converting shapes to sf objects
-#> Processing the data
# Example using Brazilian emission model and fleet
fleet_data_ef_cetesb <- data.frame(veh_type = "BUS_URBAN_D",
@@ -253,7 +251,6 @@ Examples
fleet_data = fleet_data_ef_cetesb,
pollutant = c("CO","PM10","CO2","CH4","NOx")
))
-#> Constant emission factor along the route
# Example using European emission model and fleet
fleet_data_ef_europe <- data.frame( veh_type = c("Ubus Midi <=15 t",
@@ -305,6 +302,10 @@ Examples
, fleet_data = fleet_data_ef_emfac
, pollutant = c("CO","PM10","CO2","CH4","NOx")
, reference_year = 2020)
+}
+#> Converting shapes to sf objects
+#> Processing the data
+#> Constant emission factor along the route
# }
diff --git a/reference/slope_class_europe_emep.html b/reference/slope_class_europe_emep.html
index 18adcc3..55e680c 100644
--- a/reference/slope_class_europe_emep.html
+++ b/reference/slope_class_europe_emep.html
@@ -126,8 +126,8 @@ Slopes classification:
Examples
- if (FALSE) { # \dontrun{
-library(gtfstools)
+ # \donttest{
+ if (requireNamespace("gtfstools", quietly=TRUE)) {
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
gtfs <- gtfstools::read_gtfs(gtfs_file)
@@ -146,7 +146,10 @@ Examples
raster_cur <- system.file("extdata/bra_cur-srtm.tif", package = "gtfs2emis")
tp_model_slope <- slope_class_europe_emep(tp_model,raster_cur)
-} # }
+}
+#> Converting shapes to sf objects
+#> Processing the data
+# }
diff --git a/reference/transport_model.html b/reference/transport_model.html
index b20073d..0cdf404 100644
--- a/reference/transport_model.html
+++ b/reference/transport_model.html
@@ -176,7 +176,7 @@ See also
Examples
# \donttest{
-library(gtfstools)
+if (requireNamespace("gtfstools", quietly=TRUE)) {
# read GTFS
gtfs_file <- system.file("extdata/bra_cur_gtfs.zip", package = "gtfs2emis")
@@ -192,6 +192,7 @@ Examples
new_speed = 20,
spatial_resolution = 100,
parallel = FALSE)
+ }
#> Converting shapes to sf objects
#> Processing the data
# }