Reads the downloaded NetCDF files and interpolates the average windspeed experienced by the bird on each possible edge, as well as the corresponding airspeed.
In addition, the graph can be further pruned based on a threshold of airspeed thr_as.
pressure (the tag pressure, e.g. tag$pressure) is required to interpolate the wind at the
flight altitude.
With constant_speed = "groundspeed" (default), the wind is averaged at the nearest ERA5 grid
cell along the straight edge flown at constant groundspeed. With constant_speed = "airspeed",
the bird flies a constant air velocity (speed and heading), so its track is curved by the wind
between the two nodes. This track is approximated by the straight edge plus the drift by the
wind anomaly along it, and the wind is averaged along that track. This mostly matters for long
flights (> 8 h) and takes about 1.5–3 times longer. The choice is stored in graph$param and
used by default in edge_add_wind(). To keep the graph fast, you can also use the default here
and compute the wind along a path with edge_add_wind(constant_speed = "airspeed").
See section 2.2.4 in Nussbaumer et al. (2023b) for more technical details and the GeoPressureManual for an illustration on how to use it.
Usage
graph_add_wind(
graph,
thr_as = Inf,
variable = lifecycle::deprecated(),
constant_speed = c("groundspeed", "airspeed"),
interp_spatial_linear = lifecycle::deprecated(),
...
)Arguments
- graph
a GeoPressureR
graphobject.- thr_as
threshold of airspeed (km/h).
- variable
- constant_speed
speed held constant during each flight:
"groundspeed"(straight edge) or"airspeed"(track drifted by the wind).- interp_spatial_linear
- ...
Arguments passed on to
edge_add_windpressurepressure 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.rounding_intervaltemporal resolution on which to query the variable (min). Default is to match ERA5 native resolution (1hr).
quietlogical to hide messages about the progress
filefunction 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.
References
Nussbaumer, Raphaël, Mathieu Gravey, Martins Briedis, Felix Liechti, and Daniel Sheldon. 2023. Reconstructing bird trajectories from pressure and wind data using a highly optimized hidden Markov model. Methods in Ecology and Evolution, 14, 1118–1129 doi:10.1111/2041-210X.14082 .
Examples
if (FALSE) {
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)
graph <- graph_add_wind(graph, pressure = tag$pressure, quiet = TRUE)
}
