Skip to content

Commit

Permalink
Namespace cleaning and DESCRIPTION enhancement
Browse files Browse the repository at this point in the history
Former-commit-id: 582057c
  • Loading branch information
thomasarsouze committed May 3, 2023
1 parent 7ec5b4a commit e6b0878
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
Package: StormR
Title: R package to compute the behaviour of wind generated by tropical
storms and cyclones
Maintainer: Thomas Arsouze <[email protected]>
Version: 0.1.0
URL: https://umr-amap.github.io/StormR/
BugReports: https://github.com/umr-amap/StormR/issues/new/choose
Authors@R: c(
person("Baptiste", "Delaporte", , "[email protected]", role = c("aut", "cre")),
person("Thomas", "Ibanez", , "[email protected]", role = "aut",
Expand All @@ -27,14 +30,14 @@ Imports:
methods,
ncdf4,
rworldmap,
rworldxtra,
sf,
sp,
stringr,
terra,
utils,
zoo
Suggests:
rworldxtra,
knitr,
rmarkdown,
testthat (>= 3.0.0)
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export(writeRast)
exportClasses(storm)
exportClasses(stormsDataset)
exportClasses(stormsList)
import(rworldxtra)
import(sp)
importFrom(methods,as)
importFrom(methods,new)
importFrom(methods,show)
2 changes: 1 addition & 1 deletion R/getStorms.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ setOldClass("sf")
#' is EPSG:4326
#' @slot spatialLoiBuffer sf object. Buffer extension of `spatialLoi`
#' @importFrom methods new
#' @import sp
#' @importFrom methods show
#' @export
stormsList <- methods::setClass("stormsList",
slots = c(data = "list",
Expand Down
3 changes: 1 addition & 2 deletions R/plotStorms.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ plotLabels <- function(st, by, pos) {
#' @param ylim numeric vector
#' @return NULL
checkInputsPlotStorms <- function(sts, names, category, labels, by,
pos, legends, loi, xlim, ylim) {
pos, legends, loi, xlim, ylim) {
# Checking sts input
stopifnot("no data to plot" = !missing(sts))

Expand Down Expand Up @@ -207,7 +207,6 @@ checkInputsPlotStorms <- function(sts, names, category, labels, by,
#' `"bottomleft"`, `"bottomright"`, or `"none"` (legend not plotted).
#' @param loi logical. Whether (TRUE, default setting) or not (FALSE) to plot the
#' extent of the buffered location of interest on the map.
#' @import rworldxtra
#'
#' @examples
#' \dontrun{
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-getStorms.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ test_that("StormsList class getters", {
test_that("Storm and stormsList class getters", {
suppressWarnings(sds <- defDatabase(verbose = 0))
sts_nc <- defStormsList(sds = sds, loi = "New Caledonia", verbose = 0)
out <- capture_output_lines(show(sts_nc@data$PAM))
out <- capture_output_lines(sp::show(sts_nc@data$PAM))

# Check that the Storm output is correct
expect_match(out[1], "Name: PAM")
Expand All @@ -323,7 +323,7 @@ test_that("Storm and stormsList class getters", {
expect_match(out[7], "1 2015-03-08 12:00:00 168.9000 -7.500000 13 -1 93 100400 100500")
expect_match(tail(out, n = 1), "57 2015-03-15 12:00:00 178.5000 -33.799999 28 -4 37 98200 99300")

out <- capture_output_lines(show(sts_nc))
out <- capture_output_lines(sp::show(sts_nc))
# Check that the Storm output is correct
expect_match(out[3], "Number of storms: 7 ")
expect_match(out[7], "Name: PAM")
Expand Down Expand Up @@ -375,12 +375,12 @@ test_that("Test convert loi function", {
sr2 <- sp::Polygon(rbind(c(180, 0), c(290, 0), c(290, 60), c(180, 60), c(180, 0)), hole = TRUE)
srs1 <- sp::Polygons(list(sr1), "s1")
srs2 <- sp::Polygons(list(sr2), "s2")
spP <- sp::SpatialPolygons(list(srs1, srs2), 1:2, proj4string = CRS(as.character("wgs84")))
spP <- sp::SpatialPolygons(list(srs1, srs2), 1:2, proj4string = sp::CRS(as.character("wgs84")))
centroids <- sp::coordinates(spP)
x <- centroids[, 1]
y <- centroids[, 2]
z <- 1.4 + 0.1 * x + 0.2 * y + 0.002 * x * x
test <- SpatialPolygonsDataFrame(spP,
test <- sp::SpatialPolygonsDataFrame(spP,
data = data.frame(x = x, y = y, z = z, row.names = row.names(spP))
)
expect_identical(sf::st_crs(convertLoi(test))$input, "EPSG:4326")
Expand Down

0 comments on commit e6b0878

Please sign in to comment.