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 ERA5 grid cell
Pressure/altitude: linear interpolation using the exact
pressurevalues
Positions follow the straight edge flown at constant groundspeed, or with constant_speed = "airspeed" the track drifted by the wind when flying at constant airspeed, as in
graph_add_wind().
Usage
edge_add_wind(
graph,
edge_s,
edge_t,
pressure = NULL,
variable = c("u_component_of_wind", "v_component_of_wind"),
rounding_interval = 60,
interp_spatial_linear = lifecycle::deprecated(),
return_averaged_variable = lifecycle::deprecated(),
file = wind_file_default,
quiet = FALSE,
constant_speed = NULL
)Arguments
- graph
either a
tagor agraphGeoPressureR object.- edge_s
an 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
an 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
variables to extract, named exactly as in
tag_download_wind()— the files must of course contain them. The NetCDF stores its arrays under GRIB short names ("u"for"u_component_of_wind") and this function translates; passing those short names still works but is deprecated.- rounding_interval
temporal resolution on which to query the variable (min). Default is to match ERA5 native resolution (1hr).
- interp_spatial_linear
- return_averaged_variable
- file
function returning the path of the wind file of a flight from (1) the stationary period identifier and (2) the
tag_id. The default,wind_file_default, gives./data/wind/{tag_id}/{tag_id}_{stap_id}.nc.- quiet
logical to hide messages about the progress
- constant_speed
speed held constant during each flight:
"groundspeed"(straight edge flown at constant groundspeed) or"airspeed"(track drifted by the wind when flying at constant airspeed). Defaults to the value used bygraph_add_wind()for thisgraph, otherwise"groundspeed".
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 averaging over the edge (weights of an edge sum to 1, flights spanned by the edge weighted by their duration)varvariable name, as passed tovariablelatlatitude 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)
} # }
