Skip to content

Commit

Permalink
Other cleanups, remove unused packages
Browse files Browse the repository at this point in the history
gridExtra was only needed for a defunct function

Use bootstrap 5 for search bar
  • Loading branch information
olivroy committed Jan 29, 2025
1 parent bddfe19 commit 06fa0b2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 17 deletions.
4 changes: 1 addition & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Type: Package
Package: metR
Language: en-GB
Title: Tools for Easier Analysis of Meteorological Fields
Expand Down Expand Up @@ -39,18 +38,17 @@ Imports:
lubridate
Suggests:
maps,
irlba,
knitr,
ncdf4,
reshape2,
markdown,
testthat (>= 2.1.0),
PCICt,
gridExtra,
vdiffr,
proj4,
kriging,
terra,
here,
gsignal,
rnaturalearth
ByteCompile: yes
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ importFrom(ggplot2,guide_geom)
importFrom(ggplot2,guide_train)
importFrom(ggplot2,scale_type)
importFrom(grid,makeContent)
importFrom(rlang,.data)
importFrom(stats,approx)
importFrom(stats,as.formula)
importFrom(stats,line)
Expand Down
2 changes: 1 addition & 1 deletion R/GetTopography.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ GetTopography <- function(lon.west, lon.east, lat.north, lat.south, resolution =

}
field[, lon := ConvertLongitude(lon, from = 180)]
if (cache == TRUE) write.csv(field, file = file) # cache data
if (cache == TRUE) utils::write.csv(field, file = file) # cache data
}
return(field[])
}
Expand Down
4 changes: 2 additions & 2 deletions R/ImputeEOF.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ ImputeEOF <- function(formula, max.eof = NULL, data = NULL,
} else {
f <- f[-1]
}
dcast.formula <- stringr::str_squish(f[stringr::str_detect(f, "\\|")])
dcast.formula <- stringr::str_squish(f[grepl("|", f, fixed = TRUE)])
dcast.formula <- as.formula(stringr::str_replace(dcast.formula, "\\|", "~"))

value.var <- stringr::str_squish(f[!stringr::str_detect(f, "\\|")])
value.var <- stringr::str_squish(f[!grepl("|", f, fixed = TRUE)])

nas <- sum(is.na(data[[value.var]]))
if (nas == 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/ReadNetCDF.R
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ print.nc_glance <- function(x, ...) {

cat("\n\n")
cat(gettext("----- Dimensions ----- \n", domain = "R-metR"))
out <- lapply(x$dim, print)
out <- lapply(x$dims, print)
}

#' @export
Expand Down
5 changes: 3 additions & 2 deletions R/helpfunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,14 @@ rename_aes <- function(x) {

#' @importFrom stats line runif var
#' @importFrom utils head
#' @importFrom rlang .data
if(getRversion() >= "2.15.1") {
utils::globalVariables(
c(".data", "as", "dep.names", "ecdf", "equal", "fft", "hasArg", "id",
c("as", "dep.names", "ecdf", "equal", "fft", "hasArg", "id",
"ind.names", "inside", "int.level", "land", "latrad", "lon", "lonrad",
"piece", "psi", "psi.dx", "psi.dxx", "psi.dxy", "psi.dy", "psi.dyy",
"r2", "sd", "setTxtProgressBar", "time", "txtProgressBar",
"u.mean", "v.mean", "write.csv", "x", "y", "z", ".", "time2",
"u.mean", "v.mean", "x", "y", "z", ".", "time2",
"group", "step", "point", "change", "end", "level", "m", "rotate",
"x.d", "y.d", "PC", "step2", "runif", "N", "angle", "var", "head",
"col__", "row__", "t1", "z1", "z2", "..n", ".N", ":=", ".SD", ".I", ".GRP"))
Expand Down
4 changes: 1 addition & 3 deletions R/stat_contour2.r
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,7 @@ isoband_z_matrix <- function(data) {
cl <- proj(cl)
} else {
if (is.character(proj)) {
if (!requireNamespace("proj4", quietly = TRUE)) {
stopf("Projection requires the proj4 package. Install it with 'install.packages(\"proj4\")'.")
}
rlang::check_installed("proj4", "to do projection.")
cl <- lapply(cl, function(x) {
x[c("x", "y")] <- proj4::project(list(x$x, x$y), proj, inverse = proj.latlon)
return(x)
Expand Down
5 changes: 2 additions & 3 deletions R/stat_contour_fill.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,8 @@ StatContourFill <- ggplot2::ggproto("StatContourFill", ggplot2::Stat,
cl <- proj(cl)
} else {
if (is.character(proj)) {
if (!requireNamespace("proj4", quietly = TRUE)) {
stopf("Projection requires the proj4 package. Install it with 'install.packages(\"proj4\")'.")
}
rlang::check_installed("proj4", "to do projection.")
# Maybe could use sf::st_proj_info()?
cl <- lapply(cl, function(x) {
x[c("x", "y")] <- proj4::project(list(x$x, x$y), proj, inverse = proj.latlon)
return(x)
Expand Down
5 changes: 3 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
url: https://eliocamp.github.io/metR/
template:
params:
bootswatch: flatly
bootstrap: 5
boostwatch: flatly

reference:
- title: Package information
contents: metR
Expand Down

0 comments on commit 06fa0b2

Please sign in to comment.