Skip to content

Commit

Permalink
Merge pull request #126 from Rafnuss/v3.3.2
Browse files Browse the repository at this point in the history
V3.3.2
  • Loading branch information
Rafnuss authored Dec 2, 2024
2 parents c5ee167 + d95d080 commit e5f540e
Show file tree
Hide file tree
Showing 34 changed files with 373 additions and 156 deletions.
67 changes: 41 additions & 26 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ message: 'To cite package "GeoPressureR" in publications use:'
type: software
license: GPL-3.0-or-later
title: 'GeoPressureR: Global Positioning by Atmospheric Pressure'
version: 3.3.1
doi: 10.1111/2041-210X.14043
version: 3.3.2
doi: 10.5281/zenodo.7754457
abstract: R package to determine the position and trajectory of a bird based on light-weight
data-logger measuring at lease atmospheric pressure.
authors:
Expand All @@ -22,8 +22,8 @@ authors:
email: mathieu@mgravey.com
orcid: https://orcid.org/0000-0002-0871-1507
preferred-citation:
type: article
title: Global positioning with animal-borne pressure sensors
type: manual
title: 'GeoPressureR: Global positioning by atmospheric pressure'
authors:
- family-names: Nussbaumer
given-names: Raphael
Expand All @@ -33,21 +33,9 @@ preferred-citation:
given-names: Mathieu
email: mathieu@mgravey.com
orcid: https://orcid.org/0000-0002-0871-1507
- family-names: Briedis
given-names: Martins
email: martins.briedis@vogelwarte.ch
orcid: https://orcid.org/0000-0002-9434-9056
- family-names: Liechti
given-names: Felix
email: felix.liechti@vogelwarte.ch
orcid: https://orcid.org/0000-0001-9473-0837
doi: 10.1111/2041-210X.14043
url: https://doi.org/10.1111/2041-210X.14043
year: '2023'
journal: Methods in Ecology and Evolution
volume: '14'
issue: '4'
start: 1104-1117
doi: 10.5281/zenodo.7754457
url: https://github.com/Rafnuss/GeoPressureR
year: '2022'
repository-code: https://github.com/Rafnuss/GeoPressureR
url: https://raphaelnussbaumer.com/GeoPressureR/
contact:
Expand All @@ -66,6 +54,32 @@ keywords:
- tracker
- windspeed
references:
- type: article
title: Global positioning with animal-borne pressure sensors
authors:
- family-names: Nussbaumer
given-names: Raphael
email: rafnuss@gmail.com
orcid: https://orcid.org/0000-0002-8185-1020
- family-names: Gravey
given-names: Mathieu
email: mathieu@mgravey.com
orcid: https://orcid.org/0000-0002-0871-1507
- family-names: Briedis
given-names: Martins
email: martins.briedis@vogelwarte.ch
orcid: https://orcid.org/0000-0002-9434-9056
- family-names: Liechti
given-names: Felix
email: felix.liechti@vogelwarte.ch
orcid: https://orcid.org/0000-0001-9473-0837
doi: 10.1111/2041-210X.14043
url: https://doi.org/10.1111/2041-210X.14043
year: '2023'
journal: Methods in Ecology and Evolution
volume: '14'
issue: '4'
start: 1104-1117
- type: article
title: Reconstructing bird trajectories from pressure and wind data using a highly
optimised hidden Markov model
Expand Down Expand Up @@ -98,18 +112,19 @@ references:
start: '1'
end: '32'
- type: manual
title: 'GeoPressureR: Global positioning by atmospheric pressure'
title: 'GeoPressureManual: Learn how to use GeoPressureR with examples.'
authors:
- family-names: Nussbaumer
given-names: Raphael
email: rafnuss@gmail.com
orcid: https://orcid.org/0000-0002-8185-1020
- family-names: Gravey
given-names: Mathieu
email: mathieu@mgravey.com
orcid: https://orcid.org/0000-0002-0871-1507
url: https://github.com/Rafnuss/GeoPressureR
year: '2022'
- family-names: Nussbaumer
given-names: Améline
email: ameline.nussbaumer@gmail.com
orcid: https://orcid.org/0000-0003-1308-4154
doi: 10.5281/zenodo.10799355
url: https://github.com/Rafnuss/GeoPressureManual
year: '2024'
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GeoPressureR
Title: Global Positioning by Atmospheric Pressure
Version: 3.3.1
Version: 3.3.2
Authors@R: c(
person("Raphaël", "Nussbaumer", , "rafnuss@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8185-1020")),
Expand Down
35 changes: 32 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,39 @@
# GeoPressureR v3.3.2

## Major update
* Change the computation of distance of edges in the graph by removing the fix that added 1 resolution to the distance to account for large grid square and short flight distance. Instead, add warning message in case there might be such an issue (flight distance < grid resolution) [ddbd07d](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/ddbd07db195440005f7f1ff96dd134dd43bdd8ae).
* Add `zero_speed_threshold` parameter that allow to encourage bird to stay at the same location. This is typically the case for short flight that don't seems to affect the position. Quite similar to a `stap_elev` [2060790](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/2060790f8508c447a00877c2fc1d86c9d52bfe2e)
* Add other type of pressurepath in interim [8d7f1d1](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/8d7f1d12665608d37f5eafa53fb251554e7f5cdd)

## Minor
* Plenty of small fixes and minor improvements [834155e](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/834155eeffcf04b33effce8d9b9d193c5554cbdf), [152c6e7](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/152c6e7a2091970b444a47a3ceb0a367a42a9c2a), [54aa995](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/54aa99589f8e709089a08ae02c5aace821ab7cea), [3a5ff95](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/3a5ff95774b353c853a32ed63327dad8df82fbbe), [6eedd83](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/6eedd83802f9377db43cba06c2e4b684b2154452), [8797533](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/8797533b49c9cc76a3d81a90824a8ceaabd48692), [1e68260](https://github.com/Rafnuss/GeoPressureR/pull/126/commits/1e68260c39bc49816c95095d0f3c3541986a50df)

**Full Changelog**: https://github.com/Rafnuss/GeoPressureR/compare/v3.3.1...v3.3.2


# GeoPressureR v3.3.1

## Major update
* [Update of param structure to function_name$param_name](https://github.com/Rafnuss/GeoPressureR/commit/2235e9ec0bceef3b49d8e1887a309b2048353552). The structure of the param has been reorganised: this named list stored inside of tag and graph stores parameters used during the building of tag and graph. We standardized this structure as param${function_name}${argument_name}. [See the migration instructions in the GeoPressureR wiki](https://github.com/Rafnuss/GeoPressureR/wiki/Migration-v3.x-%E2%80%90--v3.3). This will mean you'll need to update your config.yml structure - sorry for that.
* [Add geopressuretemplate() functions](https://github.com/Rafnuss/GeoPressureR/commit/b000764ff3c2179eefb48bbf9178c5323c89aa7d). The main improvement is related to the use of a single function to run the entire workflow: geopressuretemplate. Read more about this in the [corresponding chapter of the GeoPressureManual](https://raphaelnussbaumer.com/GeoPressureManual/geopressuretemplate-workflow.html).

## Minor
* [replace species_name by scientific_name](https://github.com/Rafnuss/GeoPressureR/commit/5e1b15fd025f355107a90229779969ad2030d7c7)
* [crop date UTC](https://github.com/Rafnuss/GeoPressureR/commit/0707ae6041383bff704a4c78511ab2dbd16305ce)
* [fix new variable name in netcdf](https://github.com/Rafnuss/GeoPressureR/commit/6c12362128c569c05ae49bb0ed40b8a31adc5980)

## New Contributors
* @PabloCapilla made their first contribution in https://github.com/Rafnuss/GeoPressureR/pull/125

**Full Changelog**: https://github.com/Rafnuss/GeoPressureR/compare/v3.3.0...v3.3.1

# GeoPressureR v3.3

## Major
- Read all sensors type and allow reading sensor without pressure `assert_pressure = FALSE` (https://github.com/Rafnuss/GeoPressureR/pull/123/commits/d11f8cc4774b4c91c27318c43d438823b681066e, https://github.com/Rafnuss/GeoPressureR/pull/123/commits/85ffe940ec46af8cd56592c2d641f25d19712129)
- [Update to ecmwfr v2. Change to cds_token](https://github.com/Rafnuss/GeoPressureR/pull/123/commits/4253e04f9ed16e3b06d45edfda0b2a0900d31d0c)
- [Improvement of tag_label_auto() with post-processing step](https://github.com/Rafnuss/GeoPressureR/commit/69c26adf559fc1bc7c2690346de41f6732f9eda5)
- [Create path2twilight.R](https://github.com/Rafnuss/GeoPressureR/commit/eff97315c5eca3dff03736e7d40efad30b209819) and [Add twilight_line in plot_twilight](https://github.com/Rafnuss/GeoPressureR/commit/b21aa06ceff257ec4473a3af530a8ba7cef5e225)
- [Update to ecmwfr v2. Change to cds_token](https://github.com/Rafnuss/GeoPressureR/pull/123/commits/4253e04f9ed16e3b06d45edfda0b2a0900d31d0c). We use the Climate Data Store to download the wind data during the flight. They have recently [updated their infrastructure](https://confluence.ecmwf.int/display/CKB/Please+read%3A+CDS+and+ADS+migrating+to+new+infrastructure%3A+Common+Data+Store+%28CDS%29+Engine) and their login procedure has changed. You’ll need an ECMF login with an Access Token. See updated procedure in the chapter [Trajectory with wind of the GeoPressureManual](https://raphaelnussbaumer.com/GeoPressureManual/trajectory-with-wind.html#download-wind-data).
- [Improvement of tag_label_auto() with post-processing step](https://github.com/Rafnuss/GeoPressureR/commit/69c26adf559fc1bc7c2690346de41f6732f9eda5). Based on a simple classification of prolonged high activity, migratory flight classification was often not very performant, e.g. when a bird was gliding during the flight. I have now added a post-processing step in the automatic classification to fix this. Read more in [the detail section of tag_label_auto().](https://raphaelnussbaumer.com/GeoPressureR/reference/tag_label_auto.html#details).
- [Create path2twilight.R](https://github.com/Rafnuss/GeoPressureR/commit/eff97315c5eca3dff03736e7d40efad30b209819) and [Add twilight_line in plot_twilight](https://github.com/Rafnuss/GeoPressureR/commit/b21aa06ceff257ec4473a3af530a8ba7cef5e225). You can now compute the theoretical twilight of a path, or more interestingly, of a pressurepath. It's also used in [pressurepath_create()](https://raphaelnussbaumer.com/GeoPressureR/reference/pressurepath_create.html), returning a column with sunrise and sunset. Its original purpose was to be able to check the twilight labeling by comparing it to a path generated, e.g., with GeoPressureviz. See the [last section of the light map chapter](https://raphaelnussbaumer.com/GeoPressureManual/light-map.html#check-light-label) for more info.

## Minor:
- [Fix issue with tag_plot_twilight() when twilight was not yet computed](https://github.com/Rafnuss/GeoPressureR/pull/123/commits/6de3af2a97e27763c5a70a0e570c91921b699f01)
Expand Down
18 changes: 11 additions & 7 deletions R/bird_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ bird_create <- function(scientific_name,
}
if (is.null(mass) || (is.null(wing_aspect) + is.null(wing_area) + is.null(wing_span) > 1)) {
# Mass, wing length and secondary length are retrieve from the AVONET
sp_id <- grep(scientific_name, avonet$species, ignore.case = TRUE)
sp_id <- grep(scientific_name, avonet$species, ignore.case = FALSE, fixed = TRUE)
if (length(sp_id) == 0) {
cli::cli_abort("No match for {.val scientific_name}. Please use the exact scientific name.
Closest matches are:
{avonet$species[agrep(scientific_name, avonet$species, ignore.case = TRUE)]}")
} else if (length(sp_id) > 1) {
cli::cli_abort("Multiple match for {.val scientific_name}. Please use the exact scientific
name. {avonet$species[sp_id]}")
sp_id <- grep(scientific_name, avonet$species, ignore.case = TRUE)
if (length(sp_id) == 0) {
cli::cli_abort(
"No match for {.val scientific_name}. Please use the exact scientific name. Closest
matches are: {avonet$species[agrep(scientific_name, avonet$species, ignore.case = TRUE)]}"
)
} else if (length(sp_id) > 1) {
cli::cli_abort("Multiple match for {.val scientific_name}. Please use the exact scientific
name. {avonet$species[sp_id]}")
}
}
b <- avonet[sp_id, ]
b$mass <- b$mass / 1000 # g -> kg
Expand Down
8 changes: 5 additions & 3 deletions R/edge_add_wind.R
Original file line number Diff line number Diff line change
Expand Up @@ -510,16 +510,18 @@ edge_add_wind_check <- function(
# Check if spatial extend match
lat <- ncdf4::ncvar_get(nc, "latitude")
lon <- ncdf4::ncvar_get(nc, "longitude")
nc_extent <- c(min(lon), max(lon), min(lat), max(lat)) # nolint
if (min(g$lat) < min(lat) || max(g$lat) > max(lat) ||
min(g$lon) < min(lon) || max(g$lon) > max(lon)) {
cli::cli_abort(c(x = "Spatial extend not matching for {.file {file(i_s)}}"))
cli::cli_abort(c(x = "Spatial extend of the grid ({tag_graph$param$tag_set_map$extent}) is
not included in the extent of {.file {file(i_s)}} ({nc_extent})"))
}

# Check if flight duration is
if (fl_s$start[i_fl] >= fl_s$end[i_fl]) {
cli::cli_abort(c(
x = "Flight starting on stap {fl_s$stap_s[i_fl]} has a start time equal or greater than \\
the end time. Please review your labelling file."
x = "Flight starting on stap {fl_s$stap_s[i_fl]} has a start time equal or greater than
the end time. Please review your labelling file."
))
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/geopressure_timeseries.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ geopressure_timeseries <- function(lat,

# Check for change in position
if (resp_data$distInter > 0) {
cli::cli_inform(c("!" = "Requested position is on water and will be move to the closet point \\
cli::cli_bullets(c("!" = "Requested position is on water and will be move to the closet point \\
on shore \\
({.url https://www.google.com/maps/dir/{lat},{lon}/{resp_data$lat},{resp_data$lon}}) \\
located {round(resp_data$distInter / 1000)} km away."))
Expand Down
6 changes: 3 additions & 3 deletions R/geopressuretemplate_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ geopressuretemplate_graph <- function(
}
},
error = function(e) {
cli::cli_inform(c(
cli::cli_bullets(c(
"x" = "{e$message}",
"i" = "Error while defining the movement model.{.var graph} is return.",
">" = "Debug line by line by opening {.code edit(geopressuretemplate_graph)}"
Expand Down Expand Up @@ -132,7 +132,7 @@ geopressuretemplate_graph <- function(
}
},
error = function(e) {
cli::cli_inform(c(
cli::cli_bullets(c(
"x" = "{e$message}",
"x" = "Error while computing the outputs. {.var graph} is returned.",
">" = "Debug line by line by opening {.code edit(geopressuretemplate_graph)}"
Expand All @@ -144,7 +144,7 @@ geopressuretemplate_graph <- function(

dir_file <- dirname(file)
if (!dir.exists(dir_file)) {
cli::cli_inform(c("!" = "The directory {.file {dir_file}} does not exists."))
cli::cli_bullets(c("!" = "The directory {.file {dir_file}} does not exists."))
res <- utils::askYesNo("Do you want to create it?")
if (res) {
dir.create(dir_file)
Expand Down
26 changes: 26 additions & 0 deletions R/geopressuretemplate_pressurepath.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@ geopressuretemplate_pressurepath <- function(
save_list <- c(save_list, "pressurepath_geopressureviz")
}

if ("pressurepath_tag" %in% config$geopressuretemplate$pressurepath &&
"path_tag" %in% save_list) {
path_tag <- get("path_tag")
pressurepath_geopressureviz <- pressurepath_create( # nolint
tag,
path = path_tag,
variable = config$pressurepath_create$variable,
solar_dep = config$pressurepath_create$solar_dep,
quiet = quiet
)
save_list <- c(save_list, "pressurepath_tag")
}

if ("pressurepath_simulation" %in% config$geopressuretemplate$pressurepath &&
"path_simulation" %in% save_list) {
path_simulation <- get("path_tag")
pressurepath_geopressureviz <- pressurepath_create( # nolint
tag,
path = path_simulation,
variable = config$pressurepath_create$variable,
solar_dep = config$pressurepath_create$solar_dep,
quiet = quiet
)
save_list <- c(save_list, "pressurepath_simulation")
}

# Save the outputs to the specified file
save(
list = save_list,
Expand Down
2 changes: 1 addition & 1 deletion R/geopressuretemplate_tag.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ geopressuretemplate_tag <- function(
# Check if folder exist
dir_file <- dirname(file)
if (!dir.exists(dir_file)) {
cli::cli_inform(c("!" = "The directory {.file {dir_file}} does not exists."))
cli::cli_bullets(c("!" = "The directory {.file {dir_file}} does not exists."))
res <- utils::askYesNo("Do you want to create it?")
if (res) {
dir.create(dir_file)
Expand Down
Loading

0 comments on commit e5f540e

Please sign in to comment.