Skip to content

Commit 3072e10

Browse files
committed
Fix long standing issue with cmd check failed because of example
1 parent 285c00d commit 3072e10

File tree

90 files changed

+714
-640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+714
-640
lines changed

CITATION.cff

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ references:
121121
address: Vienna, Austria
122122
year: '2024'
123123
version: '>= 4.1.0'
124-
- type: software
125-
title: assertthat
126-
abstract: 'assertthat: Easy Pre and Post Assertions'
127-
notes: Imports
128-
repository: https://CRAN.R-project.org/package=assertthat
129-
authors:
130-
- family-names: Wickham
131-
given-names: Hadley
132-
email: hadley@rstudio.com
133-
year: '2024'
134-
doi: 10.32614/CRAN.package.assertthat
135124
- type: software
136125
title: cli
137126
abstract: 'cli: Helpers for Developing Command Line Interfaces'
@@ -167,9 +156,9 @@ references:
167156
given-names: Koen
168157
email: koen.hufkens@gmail.com
169158
orcid: https://orcid.org/0000-0002-5070-8109
159+
year: '2024'
170160
doi: 10.32614/CRAN.package.ecmwfr
171161
version: '>= 2.0.0'
172-
year: '2024'
173162
- type: software
174163
title: EBImage
175164
abstract: 'EBImage: Image processing and analysis toolbox for R'
@@ -296,7 +285,7 @@ references:
296285
authors:
297286
- family-names: Ooms
298287
given-names: Jeroen
299-
email: jeroen@berkeley.edu
288+
email: jeroenooms@gmail.com
300289
orcid: https://orcid.org/0000-0002-4035-0289
301290
year: '2024'
302291
doi: 10.32614/CRAN.package.jsonlite
@@ -322,6 +311,22 @@ references:
322311
year: '2024'
323312
doi: 10.32614/CRAN.package.leaflet
324313
version: '>= 2.2.0'
314+
- type: software
315+
title: lifecycle
316+
abstract: 'lifecycle: Manage the Life Cycle of your Package Functions'
317+
notes: Imports
318+
url: https://lifecycle.r-lib.org/
319+
repository: https://CRAN.R-project.org/package=lifecycle
320+
authors:
321+
- family-names: Henry
322+
given-names: Lionel
323+
email: lionel@posit.co
324+
- family-names: Wickham
325+
given-names: Hadley
326+
email: hadley@posit.co
327+
orcid: https://orcid.org/0000-0003-4757-117X
328+
year: '2024'
329+
doi: 10.32614/CRAN.package.lifecycle
325330
- type: software
326331
title: Matrix
327332
abstract: 'Matrix: Sparse and Dense Matrix Classes and Methods'
@@ -468,21 +473,16 @@ references:
468473
address: Vienna, Austria
469474
year: '2024'
470475
- type: software
471-
title: lifecycle
472-
abstract: 'lifecycle: Manage the Life Cycle of your Package Functions'
473-
notes: Imports
474-
url: https://lifecycle.r-lib.org/
475-
repository: https://CRAN.R-project.org/package=lifecycle
476+
title: assertthat
477+
abstract: 'assertthat: Easy Pre and Post Assertions'
478+
notes: Suggests
479+
repository: https://CRAN.R-project.org/package=assertthat
476480
authors:
477-
- family-names: Henry
478-
given-names: Lionel
479-
email: lionel@posit.co
480481
- family-names: Wickham
481482
given-names: Hadley
482-
email: hadley@posit.co
483-
orcid: https://orcid.org/0000-0003-4757-117X
483+
email: hadley@rstudio.com
484484
year: '2024'
485-
doi: 10.32614/CRAN.package.lifecycle
485+
doi: 10.32614/CRAN.package.assertthat
486486
- type: software
487487
title: BiocManager
488488
abstract: 'BiocManager: Access the Bioconductor Project Package Repository'
@@ -668,4 +668,29 @@ references:
668668
year: '2024'
669669
doi: 10.32614/CRAN.package.testthat
670670
version: '>= 3.0.0'
671+
- type: software
672+
title: withr
673+
abstract: 'withr: Run Code ''With'' Temporarily Modified Global State'
674+
notes: Suggests
675+
url: https://withr.r-lib.org
676+
repository: https://CRAN.R-project.org/package=withr
677+
authors:
678+
- family-names: Hester
679+
given-names: Jim
680+
- family-names: Henry
681+
given-names: Lionel
682+
email: lionel@posit.co
683+
- family-names: Müller
684+
given-names: Kirill
685+
email: krlmlr+r@mailbox.org
686+
- family-names: Ushey
687+
given-names: Kevin
688+
email: kevinushey@gmail.com
689+
- family-names: Wickham
690+
given-names: Hadley
691+
email: hadley@posit.co
692+
- family-names: Chang
693+
given-names: Winston
694+
year: '2024'
695+
doi: 10.32614/CRAN.package.withr
671696

DESCRIPTION

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ BugReports: https://github.com/Rafnuss/GeoPressureR/issues
1515
Depends:
1616
R (>= 4.1.0)
1717
Imports:
18-
assertthat,
1918
cli,
2019
config,
2120
ecmwfr (>= 2.0.0),
@@ -27,6 +26,7 @@ Imports:
2726
httr2 (>= 1.0.0),
2827
jsonlite,
2928
leaflet (>= 2.2.0),
29+
lifecycle,
3030
Matrix,
3131
methods,
3232
ncdf4,
@@ -36,9 +36,9 @@ Imports:
3636
stats,
3737
suntools,
3838
terra,
39-
utils,
40-
lifecycle
39+
utils
4140
Suggests:
41+
assertthat,
4242
BiocManager,
4343
covr,
4444
knitr,
@@ -49,7 +49,8 @@ Suggests:
4949
shiny,
5050
shinyjs,
5151
shinyWidgets,
52-
testthat (>= 3.0.0)
52+
testthat (>= 3.0.0),
53+
withr
5354
biocViews:
5455
Config/testthat/edition: 3
5556
Encoding: UTF-8

R/edge_add_wind.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
#' @param pressure pressure measurement of the associated `tag` data used to estimate the pressure
1717
#' level (i.e., altitude) of the bird during the flights. This data.frame needs to contain `date` as
1818
#' POSIXt and `value` in hPa.
19-
#' @param variable list of the variables to extract from [the ERA5 pressure level](
20-
#' https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Table9) # nolint
21-
#' using the `shortName` notation: `"u"`, `"v"`, `"t"`, `"cc"`, `"r"`, , `"w"`, `"ciwc"`, `"clwc"`,
22-
#' `"q"`, `"cswc"`, `"d"`, `"z"`, `"o3"`, `"pv"`, `'vo"`.
19+
#' @param variable list of the variables to extract from [the ERA5 pressure level
20+
#' ](https://bit.ly/3BrwLBM) using the `shortName` notation: `"u"`, `"v"`, `"t"`, `"cc"`, `"r"`,
21+
#' `"w"`, `"ciwc"`, `"clwc"`, `"q"`, `"cswc"`, `"d"`, `"z"`, `"o3"`, `"pv"`, `'vo"`.
2322
#' @param rounding_interval temporal resolution on which to query the variable (min). Default is to
2423
#' macth ERA5 native resolution (1hr).
2524
#' @param interp_spatial_linear logical to interpolate the variable linearly over space, if `FALSE`
@@ -173,7 +172,9 @@ edge_add_wind <- function(
173172
# Read data from netCDF file and convert the time of data to posixt
174173
# Fix to use the correct time variable ("time" until the new CDS, then "valid_time")
175174
if ("time" %in% names(nc$dim)) {
176-
time <- as.POSIXct(ncdf4::ncvar_get(nc, "time") * 60 * 60, origin = "1900-01-01", tz = "UTC")
175+
time <- as.POSIXct(ncdf4::ncvar_get(nc, "time") * 60 * 60,
176+
origin = "1900-01-01", tz = "UTC"
177+
)
177178
} else if ("valid_time" %in% names(nc$dim)) {
178179
time <- as.POSIXct(ncdf4::ncvar_get(nc, "valid_time"), origin = "1970-01-01", tz = "UTC")
179180
} else {
@@ -472,7 +473,9 @@ edge_add_wind_check <- function(
472473

473474
# Check that the time is matching
474475
if ("time" %in% names(nc$dim)) {
475-
time <- as.POSIXct(ncdf4::ncvar_get(nc, "time") * 60 * 60, origin = "1900-01-01", tz = "UTC")
476+
time <- as.POSIXct(ncdf4::ncvar_get(nc, "time") * 60 * 60,
477+
origin = "1900-01-01", tz = "UTC"
478+
)
476479
} else if ("valid_time" %in% names(nc$dim)) {
477480
time <- as.POSIXct(ncdf4::ncvar_get(nc, "valid_time"), origin = "1970-01-01", tz = "UTC")
478481
} else {

R/geolight_map.R

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#'
1919
#' Instead of calibrating the twilight errors in terms of duration, we directly model the zenith
2020
#' angle error. We use a kernel distribution to fit the zenith angle during the known stationary
21-
#' period(s). The `twl_calib_adjust` parameter allows to manually adjust how smooth you want the
21+
#' period(s). The `twl_calib_adjust` parameter allows to mararnually adjust how smooth you want the
2222
#' fit of the zenith angle to be. Because the zenith angle error model is fitted with data from the
2323
#' calibration site only, and we are using it for all locations of the bird’s journey, it is safer
2424
#' to assume a broader/smoother distribution.
@@ -33,25 +33,26 @@
3333
#' @return a `tag` with the likelihood of light as `tag$map_light`
3434
#'
3535
#' @examples
36-
#' setwd(system.file("extdata", package = "GeoPressureR"))
37-
#' # Read geolocator data and build twilight
38-
#' tag <- tag_create("18LX", quiet = TRUE) |>
39-
#' tag_label(quiet = TRUE) |>
40-
#' tag_set_map(
41-
#' extent = c(-16, 23, 0, 50),
42-
#' scale = 10,
43-
#' known = data.frame(
44-
#' stap_id = 1,
45-
#' known_lon = 17.05,
46-
#' known_lat = 48.9
36+
#' withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
37+
#' # Read geolocator data and build twilight
38+
#' tag <- tag_create("18LX", quiet = TRUE) |>
39+
#' tag_label(quiet = TRUE) |>
40+
#' tag_set_map(
41+
#' extent = c(-16, 23, 0, 50),
42+
#' scale = 10,
43+
#' known = data.frame(
44+
#' stap_id = 1,
45+
#' known_lon = 17.05,
46+
#' known_lat = 48.9
47+
#' )
4748
#' )
48-
#' )
4949
#'
50-
#' # Compute the twilight
51-
#' tag <- twilight_create(tag) |> twilight_label_read()
50+
#' # Compute the twilight
51+
#' tag <- twilight_create(tag) |> twilight_label_read()
5252
#'
53-
#' # Compute likelihood map
54-
#' tag <- geolight_map(tag, quiet = TRUE)
53+
#' # Compute likelihood map
54+
#' tag <- geolight_map(tag, quiet = TRUE)
55+
#' })
5556
#'
5657
#' plot(tag, type = "map_light")
5758
#' @family geolight

R/geopressure_map.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@
120120
#' datapoints used to compute the MSE.
121121
#'
122122
#' @examples
123-
#' owd <- setwd(system.file("extdata", package = "GeoPressureR"))
124-
#' tag <- tag_create("18LX", quiet = TRUE) |>
125-
#' tag_label(quiet = TRUE) |>
126-
#' tag_set_map(
127-
#' extent = c(-16, 23, 0, 50),
128-
#' scale = 4
129-
#' )
130-
#' setwd(owd)
123+
#' withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
124+
#' tag <- tag_create("18LX", quiet = TRUE) |>
125+
#' tag_label(quiet = TRUE) |>
126+
#' tag_set_map(
127+
#' extent = c(-16, 23, 0, 50),
128+
#' scale = 4
129+
#' )
130+
#' })
131131
#'
132132
#' tag <- geopressure_map_mismatch(tag,
133133
#' max_sample = 50,

R/geopressure_map_preprocess.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#' @inheritParams geopressure_map
1313
#' @return Pressure data.frame without flight and discarded values, on a 1 hour resolution.
1414
#' @examples
15-
#' owd <- setwd(system.file("extdata", package = "GeoPressureR"))
16-
#' tag <- tag_create("18LX", quiet = TRUE) |> tag_label(quiet = TRUE)
17-
#' setwd(owd)
15+
#' withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
16+
#' tag <- tag_create("18LX", quiet = TRUE) |> tag_label(quiet = TRUE)
17+
#' })
1818
#'
1919
#' pressure_processed <- geopressure_map_preprocess(tag)
2020
#' str(pressure_processed)

R/geopressuretemplate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#' - `graph_most_likely()`: Computes the most likely path based on the movement model.
5454
#' 6. If `"simulation"` is in `config$geopressuretemplate$outputs`:
5555
#' - `graph_simulation()`: Runs simulations to model multiple possible paths.
56-
#' 7. \*`save()`: Saves the computed graph and associated objects in `data/interim/{id}.Rdata`
56+
#' 7. `save()`: Saves the computed graph and associated objects in `data/interim/{id}.Rdata`
5757
#'
5858
#' * **Pressure Path Processing [`geopressuretemplate_pressurepath()`]**: Computes pressurepaths
5959
#' (`pressurepath_create`) using the content of the `Rdata` file and appending the pressurepath
@@ -75,7 +75,7 @@
7575
#' @examples
7676
#' \dontrun{
7777
#' # Run the complete geopressuretemplate workflow
78-
#' geopressuretemplate("example_id", quiet = TRUE)
78+
#' geopressuretemplate("18LX", quiet = TRUE)
7979
#' }
8080
#'
8181
#' @family geopressuretemplate

R/geopressuretemplate_graph.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ geopressuretemplate_graph <- function(
9191

9292

9393
# Store the graph parameters
94-
param <- graph$param
94+
param <- graph$param # nolint
9595

9696
# Initialize a list to keep track of outputs to be saved
9797
save_list <- c("tag", "param")
@@ -103,7 +103,7 @@ geopressuretemplate_graph <- function(
103103
if (!quiet) {
104104
cli::cli_h2("Compute marginal map")
105105
}
106-
marginal <- graph_marginal(graph, quiet = quiet)
106+
marginal <- graph_marginal(graph, quiet = quiet) # nolint
107107
save_list <- c(save_list, "marginal")
108108
}
109109

@@ -113,7 +113,7 @@ geopressuretemplate_graph <- function(
113113
cli::cli_h2("Compute most likely path")
114114
}
115115
path_most_likely <- graph_most_likely(graph, quiet = quiet)
116-
edge_most_likely <- path2edge(path_most_likely, graph)
116+
edge_most_likely <- path2edge(path_most_likely, graph) # nolint
117117
save_list <- c(save_list, "path_most_likely", "edge_most_likely")
118118
}
119119

@@ -127,7 +127,7 @@ geopressuretemplate_graph <- function(
127127
nj = config$graph_simulation$nj,
128128
quiet = quiet
129129
)
130-
edge_simulation <- path2edge(path_simulation, graph)
130+
edge_simulation <- path2edge(path_simulation, graph) # nolint
131131
save_list <- c(save_list, "path_simulation", "edge_simulation")
132132
}
133133
},

R/geopressuretemplate_pressurepath.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#' @family geopressuretemplate
33
#' @export
44
geopressuretemplate_pressurepath <- function(
5-
# nolint
65
id,
76
config = config::get(config = id),
87
quiet = FALSE,
@@ -32,7 +31,7 @@ geopressuretemplate_pressurepath <- function(
3231
if ("most_likely" %in% config$geopressuretemplate$pressurepath &&
3332
"path_most_likely" %in% save_list) {
3433
path_most_likely <- get("path_most_likely")
35-
pressurepath_most_likely <- pressurepath_create(
34+
pressurepath_most_likely <- pressurepath_create( # nolint
3635
tag,
3736
path = path_most_likely,
3837
variable = config$pressurepath_create$variable,
@@ -45,7 +44,7 @@ geopressuretemplate_pressurepath <- function(
4544
if ("geopressureviz" %in% config$geopressuretemplate$pressurepath &&
4645
"path_geopressureviz" %in% save_list) {
4746
path_geopressureviz <- get("path_geopressureviz")
48-
pressurepath_geopressureviz <- pressurepath_create(
47+
pressurepath_geopressureviz <- pressurepath_create( # nolint
4948
tag,
5049
path = path_geopressureviz,
5150
variable = config$pressurepath_create$variable,

R/graph_create.R

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@
4444
#' - `param`: list of parameters including `thr_likelihood` and `thr_gs` (same as `tag$param`)
4545
#'
4646
#' @examples
47-
#' setwd(system.file("extdata", package = "GeoPressureR"))
48-
#' tag <- tag_create("18LX", quiet = TRUE) |>
49-
#' tag_label(quiet = TRUE) |>
50-
#' twilight_create() |>
51-
#' twilight_label_read() |>
52-
#' tag_set_map(
53-
#' extent = c(-16, 23, 0, 50),
54-
#' known = data.frame(stap_id = 1, known_lon = 17.05, known_lat = 48.9)
55-
#' ) |>
56-
#' geopressure_map(quiet = TRUE) |>
57-
#' geolight_map(quiet = TRUE)
47+
#' withr::with_dir(system.file("extdata", package = "GeoPressureR"), {
48+
#' tag <- tag_create("18LX", quiet = TRUE) |>
49+
#' tag_label(quiet = TRUE) |>
50+
#' twilight_create() |>
51+
#' twilight_label_read() |>
52+
#' tag_set_map(
53+
#' extent = c(-16, 23, 0, 50),
54+
#' known = data.frame(stap_id = 1, known_lon = 17.05, known_lat = 48.9)
55+
#' ) |>
56+
#' geopressure_map(quiet = TRUE) |>
57+
#' geolight_map(quiet = TRUE)
58+
#' })
5859
#'
5960
#' # Create graph
6061
#' graph <- graph_create(tag, thr_likelihood = 0.95, thr_gs = 100, quiet = TRUE)

0 commit comments

Comments
 (0)