resample_sim | R Documentation |
resamples the input data.frame to only have rows corresponding to matches between
df$DateTime and t_out. Both df$DateTime and t_out are of type POSIXct, and the
precision of the match is passed in through the precision
argument.
The order of t_out, not df$DateTime is retained.
resample_sim(df, t_out, method = "match", precision = "days")
df |
a data.frame with DateTime and potentially other columns |
t_out |
a vector of POSIXct dates (or character array that can be coerced into POSIXct) for matching to df$DateTime |
method |
'match' for exact match or 'interp' for temporal interpolation |
precision |
matching precision (must be 'secs', 'mins','hours', 'days', or 'exact'). |
a data.frame with DateTime other original columns, resampled according to t_out
Jordan S. Read
get_temp, get_wind, get_surface_height, get_evaporation, get_ice
sim_folder <- run_example_sim(verbose = FALSE)
nc_file <- file.path(sim_folder, 'output/output.nc')
temp_surf <- get_temp(nc_file, reference = 'surface', z_out = c(0,1,2))
t_out <- as.POSIXct(c("2011-04-01", "2011-06-14", "2011-04-05", "2011-07-28"))
temp_out <- resample_sim(df = temp_surf, t_out = t_out)
t_out <- c("2011-04-01 10:00", "2011-04-05 08:15",
"2011-06-14 10:30", "2011-04-05 10:21",
"2011-07-28 10:00")
temp_out <- resample_sim(df = temp_surf, t_out = t_out, precision = 'days')
temp_out <- resample_sim(df = temp_surf, t_out = t_out, method = 'interp', precision = 'hours')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.