Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test elev.R #17

Merged
merged 66 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
8d4c19c
Explicitly test e_source failure
ms609 Jul 6, 2023
b1dc835
Merge branch 'master' into test-elev
ms609 Jul 7, 2023
793b623
Use named variables
ms609 Jul 7, 2023
8143bca
Use `apply()`
ms609 Jul 7, 2023
5b18942
Tests for geodata – which required some reimplementation
ms609 Jul 7, 2023
e7db9bb
Merge branch 'master' into test-elev
ms609 Jul 7, 2023
03ab7ba
Intermediate edit
ms609 Jul 7, 2023
c34f184
Merge branch 'master' into test-elev
ms609 Jul 11, 2023
b29fca1
Handle different input formats
ms609 Jul 11, 2023
93e8370
<-
ms609 Jul 11, 2023
a96ece6
expect_snapshots
ms609 Jul 11, 2023
acef36c
importFrom methods as
ms609 Jul 11, 2023
7137ab2
Order reversed in testthat 3
ms609 Jul 11, 2023
4b8da73
lint
ms609 Jul 11, 2023
0561907
rm duplicate
ms609 Jul 11, 2023
d818c91
import methods
ms609 Jul 11, 2023
08cc69d
Pass `...` to `download.file()`
ms609 Jul 11, 2023
69ebe3b
Suppress messages
ms609 Jul 11, 2023
d43d4ca
terra::plot
ms609 Jul 11, 2023
283c46c
quiet=T
ms609 Jul 11, 2023
e0e602a
rm geodata import
ms609 Jul 11, 2023
da5afae
instructive param name
ms609 Jul 11, 2023
9765bf4
No need to verify ssl
ms609 Jul 11, 2023
c899838
scrub_progress_bars
ms609 Jul 11, 2023
4c74b5f
blank lines too
ms609 Jul 11, 2023
2cc03f6
Merge branch 'master' into test-elev
ms609 Jul 12, 2023
eb3a07b
use expect_warning
ms609 Jul 12, 2023
e0bd8c8
Skip if server offline
ms609 Jul 12, 2023
e382e23
Skip if srtm.csi.cgiar.org offline
ms609 Jul 12, 2023
8d02326
Don't attach; called with ::
ms609 Jul 12, 2023
072a857
Explain why not skip_if_offline
ms609 Jul 12, 2023
1c8cfef
testthat:: for lint
ms609 Jul 12, 2023
b8473b5
Squashed commit of the following:
ms609 Jul 12, 2023
4c68daa
Update NAMESPACE
ms609 Jul 12, 2023
42b22c0
Spatial-ize "sfc" objects too
ms609 Jul 12, 2023
fe2c4b2
load sp quietly
ms609 Jul 12, 2023
f1e2ae0
skip_on_cran implicit
ms609 Jul 12, 2023
0f4927b
st_as_sf
ms609 Jul 12, 2023
c770bbc
Separate tests for each assertion
ms609 Jul 12, 2023
78ae56e
Support SpatVectors
ms609 Jul 12, 2023
2d8fb9b
Squashed commit of the following:
ms609 Jul 12, 2023
e4d7d55
Comment-out comment (#)
ms609 Jul 13, 2023
b7a0207
Don't call elev
ms609 Jul 13, 2023
67015f3
`inherits` preferable to `class`
ms609 Jul 14, 2023
d51bb9d
corrected srtm code to mask tiles that were in the sea to ensure that…
jamestsakalos Jul 16, 2023
6887fc3
creating smaller test file for mapzen and srtm data to speed up the p…
jamestsakalos Jul 16, 2023
c18e7c8
adding new testing expectations
jamestsakalos Jul 16, 2023
d72a2a4
fixing importFrom "crs<-" to "crs" adding "mask" to imports
jamestsakalos Jul 16, 2023
cc9e4d3
imports
jamestsakalos Jul 16, 2023
8e63885
reducing size of testing polygon further
jamestsakalos Jul 16, 2023
44b8f70
updating ce_extract to issue warning when no `location_g` argument su…
jamestsakalos Jul 16, 2023
eac461d
Return FALSE if no valid tiles
ms609 Jul 17, 2023
561230e
* remove scrub_progress_bars
ms609 Jul 17, 2023
a6d1327
use https:// for checks
ms609 Jul 17, 2023
7a8d71e
distinct temp_file for each loop
ms609 Jul 17, 2023
42c2ea0
indent
ms609 Jul 17, 2023
130b797
Only unzip if file downloaded
ms609 Jul 17, 2023
2feafd4
make `TRUE` return invisible
ms609 Jul 17, 2023
1d36ef9
Return "SpatRaster"
ms609 Jul 17, 2023
41a7f51
skip_if_server_offline return invisibly
ms609 Jul 17, 2023
eb15fb4
Don't compare names
ms609 Jul 17, 2023
db33f92
Update tests: Warn, don't message
ms609 Jul 17, 2023
304a0fa
Remove commented code
ms609 Jul 17, 2023
eca97e9
updating returns descriptions on functions.
jamestsakalos Jul 17, 2023
e22482f
adding progress to suggests
jamestsakalos Jul 17, 2023
70f1d06
Merge branch 'master' into test-elev
jamestsakalos Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ Imports:
climaemet,
dismo,
dplyr,
elevatr,
elevatr (>= 1.0),
exactextractr,
geodata,
glue,
macroBiome,
methods,
plyr,
randomForest,
sf,
Expand All @@ -53,12 +54,16 @@ Suggests:
covr,
fs,
knitr,
progress,
raster,
rmarkdown,
testthat (>= 3.0.0),
vdiffr
Remotes:
jhollist/elevatr
Config/Needs/check: rcmdcheck
Config/Needs/coverage: covr
Config/Needs/website: pkgdown
Config/testthat/edition: 3
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
8 changes: 7 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ importFrom(dplyr,group_by)
importFrom(dplyr,summarize)
importFrom(elevatr,get_elev_raster)
importFrom(exactextractr,exact_extract)
importFrom(geodata,elevation_3s)
importFrom(geodata,worldclim_tile)
importFrom(glue,glue)
importFrom(graphics,axis)
Expand All @@ -28,10 +27,12 @@ importFrom(graphics,points)
importFrom(graphics,strwidth)
importFrom(graphics,text)
importFrom(macroBiome,cliHoldridgePoints)
importFrom(methods,as)
importFrom(plyr,round_any)
importFrom(randomForest,importance)
importFrom(randomForest,randomForest)
importFrom(randomForest,varImpPlot)
importFrom(sf,"st_crs<-")
importFrom(sf,as_Spatial)
importFrom(sf,st_as_sf)
importFrom(sf,st_bbox)
Expand All @@ -42,10 +43,15 @@ importFrom(sp,SpatialPolygonsDataFrame)
importFrom(stats,aggregate)
importFrom(stats,sd)
importFrom(terra,centroids)
importFrom(terra,colFromCell)
importFrom(terra,crds)
importFrom(terra,crs)
importFrom(terra,extract)
importFrom(terra,mask)
importFrom(terra,mosaic)
importFrom(terra,rast)
importFrom(terra,rasterize)
importFrom(terra,rowFromCell)
importFrom(terra,vect)
importFrom(terra,writeRaster)
importFrom(terra,xyFromCell)
Expand Down
2 changes: 1 addition & 1 deletion R/ce_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @param \dots Arguments to control a download from the Internet
#' `download.file()`.
#'
#' @return
#' @returns
#' See documentation from [`chelsa()`], [`worldclim()`] and
#' [`elev()`].
#'
Expand Down
4 changes: 2 additions & 2 deletions R/ce_extract.R
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@

# Assigns an 'id' if location_g is empty
if (is.null(location_g)) {
message(
warning(
paste(
"location_g must be one of",
paste(setdiff(colnames(location_df), c("coords.x1", "coords.x2")),
Expand Down Expand Up @@ -347,7 +347,7 @@
#' @template output_c_source_param
#' @template output_var_param
#'
#' @return
#' @returns
#' Returns a list storing matrices containing the mean and standard deviation
#' of the climate and/or elevation data. Each column represents a month, each
#' row represents a feature of the \code{location} \code{sp}, \code{sf} polygon
Expand Down
2 changes: 1 addition & 1 deletion R/chelsa.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param quiet,\dots Arguments to control a download from the Internet
#' `download.file()`.
#'
#' @return
#' @returns
#' Returns four subfolders named prec, tmax, tmin and tmean. Each folder
#' contains 12 GeoTiff (.tif) files, one for each month of the year for the time
#' period 1981&ndash;2010. Each of the files are downloaded at a spatial
Expand Down
15 changes: 15 additions & 0 deletions R/data_srtm_tiles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
##' STRM tiles data
##'
##' SRTM tiles data.
##'
##' @docType data
##' @format{ An object of class \code{SpatialPolygonsDataFrame} with 872 rows
##' and 1 columns.}
##' @details Contains tiles to assist downloading from 'geodata'.
##' @encoding UTF-8
##' @keywords datasets
##' @rdname srtm_tiles
##' @examples
##' data("srtm_tiles", package = "climenv")
##' head(srtm_tiles)
"srtm_tiles"
Loading