Learn R Programming

puff (version 0.1.0)

faceted_time_series_plot2: Alternate version with wind rose at each time step + scatter plot of methane concentration time series

Description

Alternate version with wind rose at each time step + scatter plot of methane concentration time series

Usage

faceted_time_series_plot2(
  sensor_concentrations,
  sensor_coords,
  wind_data,
  start_time,
  end_time,
  output_dt,
  text_size = 12
)

Value

A ggplot object with faceted time series plots of methane concentrations and wind rose data.

Arguments

sensor_concentrations

Data frame. Output from a sensor simulation function, which must include a column named "Group.1" which contains the timestamps (e.g., "YYYY-MM-DD HH:MM:SS") and a column "Sensor_1" for the sensor concentration values.

sensor_coords

A data frame or matrix containing sensor locations.

wind_data

A list containing wind data with components u and v

start_time

POSIXct. Start time of the simulation.

end_time

POSIXct. End time of the simulation.

output_dt

Integer. Desired time resolution (in seconds) for the final output of concentrations.

text_size

Default at 12.

Examples

Run this code
set.seed(123)
sim_dt <- 10
puff_dt <- 10
output_dt <- 60
start_time <- "2024-01-01 12:00:00"
end_time <- "2024-01-01 13:00:00"
emission_rate <- 3.5
wind_data <- data.frame(
  wind_u = runif(3601, min = -3, max = 0.7),
  wind_v = runif(3601, min = -3, max = 1.5)
)
source_coords <- c(0, 0, 2.5)
sensor_coords <- matrix(c(-6.525403221327715e-15, -35.52264, 2.01775), ncol = 3, byrow = TRUE)

out <- simulate_sensor_mode(
  start_time, end_time, source_coords,
  emission_rate, wind_data, sensor_coords, sim_dt, puff_dt, output_dt, puff_duration = 1200
)

faceted_time_series_plot2(out, sensor_coords,
  wind_data, as.POSIXct(start_time), as.POSIXct(end_time),
  output_dt
  )

Run the code above in your browser using DataLab