Learn R Programming

eixport (version 0.6.2)

wrf_profile: Create a spatial profile from a wrf emission file and a data frame with

Description

returns a traffic intensity profile (based on wrf file Times) and a traffic intensity data frame

Usage

wrf_profile(x, file, adjust = 0, verbose = T)

Format

a numeric vector

Arguments

x

data.frame of intenticy of traffic by hours (rows) and weekdays (columns)

file

emission file name

adjust

numer of hours to advance (positive value) or delay (negative value)

verbose

display additional information

Author

Daniel Schuch

See Also

wrf_create and to_wrf

Examples

Run this code
if (FALSE) {

# Profile based on Sao Paulo tunnel experiments
data(rawprofile)
rawprofile  <- matrix(rawprofile, nrow = 24, byrow = TRUE)
rawprofile <- as.data.frame(rawprofile)
names(rawprofile) <- c("Sunday","Monday","Tuesday","Wednesday","Thursday",
                       "Friday","Saturday")
row.names(rawprofile) <- c("00:00","01:00","02:00","03:00","04:00","05:00",
                           "06:00","07:00","08:00","09:00","10:00","11:00",
                           "12:00","13:00","14:00","15:00","16:00","17:00",
                           "18:00","19:00","20:00","21:00","22:00","23:00")

print(rawprofile)

# create the folder and emission file
dir.create(file.path(tempdir(), "EMISS"))
wrf_create(wrfinput_dir = system.file("extdata", package = "eixport"),
          wrfchemi_dir = file.path(tempdir(), "EMISS"),
          frames_per_auxinput5 = 24)

files <- list.files(path = file.path(tempdir(), "EMISS"),
                    pattern = "wrfchemi",
                    full.names = TRUE)

profile <- wrf_profile(rawprofile,files[1])

plot(profile,
     ty="l",
     lty = 2,
     axe = FALSE,
     main = "Traffic Intensity for Sao Paulo", xlab = "hour")
axis(2)
axis(1,
     at = 0.5 + c(0, 6, 12, 18, 24),
    labels = c("00:00","06:00","12:00","18:00", "00:00"))
}

Run the code above in your browser using DataLab