Reads the NetCDF files and extracts the variable requested along each flight defined by the edges.
Time: linear interpolation using the resolution requested with
rounding_intervalSpace: nearest neighbour interpolation by default, or bi-linear with
pracma::interp2ifinterp_spatial_linear=TRUE. Note: spatial interpolation is limited to 0.1° for computational reasons.Pressure/altitude: linear interpolation using the exact
pressurevalues
Usage
edge_add_wind(
graph,
edge_s,
edge_t,
pressure = NULL,
variable = c("u", "v"),
rounding_interval = 60,
interp_spatial_linear = FALSE,
return_averaged_variable = lifecycle::deprecated(),
file = function(stap_id, tag_id) {
glue::glue("./data/wind/{tag_id}/{tag_id}_{stap_id}.nc")
},
quiet = FALSE
)Arguments
- graph
either a
tagor agraphGeoPressureR object.- edge_s
a index of the source node of the edge. Either a vector with 3D index or a matrix of 3 columns, one for each dimension.
- edge_t
a index of the target node of the edge. Either a vector with 3D index or a matrix of 3 columns, one for each dimension.
- pressure
pressure measurement of the associated
tagdata used to estimate the pressure level (i.e., altitude) of the bird during the flights. This data.frame needs to containdateas POSIXt andvaluein hPa. If not provided, usesgraph$pressure, assuming that argumentgraphis a GeoPressureRtagobject.- variable
list of the variables to extract from the ERA5 pressure level using the
shortNamenotation:"u","v","t","cc","r","w","ciwc","clwc","q","cswc","d","z","o3","pv","vo".- rounding_interval
temporal resolution on which to query the variable (min). Default is to match ERA5 native resolution (1hr).
- interp_spatial_linear
logical to interpolate the variable linearly over space, if
FALSEtakes the nearest neighbour. ERA5 native resolution is 0.25°- return_averaged_variable
- file
absolute or relative path of the ERA5 wind data file to be downloaded. Function taking as arguments (1) the stationary period identifier and (2) the tag_id.
- quiet
logical to hide messages about the progress
Value
A data.frame with one row per time step, edge, and variable:
edge_idedge indexvalvalue of the variable at each time steppressurepressure at each time stepdatedatetime of each time stepwweight for averagingvarvariable namelatlatitude at each time steplonlongitude at each time step
Examples
if (FALSE) { # \dontrun{
withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
tag <- tag_create("18LX", quiet = TRUE) |>
tag_label(quiet = TRUE) |>
tag_set_map(extent = c(-16, 23, 0, 50), scale = 1) |>
geopressure_map(quiet = TRUE)
})
graph <- graph_create(tag, quiet = TRUE)
wind <- edge_add_wind(graph, edge_s = graph$s, edge_t = graph$t, quiet = TRUE)
} # }
