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M##&vFix1&=Z}LpB#;Zyh|UEa9WID^3abts
zTOS{v@f`@H;t19;vdkW^sT$L
zM!y%d$Rc|${8l5#>p$NtMRs_49o1tp_LcU79|Yy&oWT*LHb6(QzpkcWonjl)ajU_$
zQ+O4S#j+8cs9meopzq}ZXWU9PDg|2eW09x+UMx+Xssiz2YcwQ-^VfOix;HMVF)G0=
zpxdT8{&k|`4B
z^eq)_WQL%X(yq=8DY98o2Rn65#rIPgpQGKWlE3V{yOj1ubKD$|=UK=A$UJ7YIzvaP
zJ%d@IS*TW$JgK2NhgbKW8ow20M0a__cB1&nBR4|%i%)+owsha$^zrn4daTmMLS)Q*7
zg226elc(?Suz%)0UI=8&cf9w?4Le5{4?rr;h3n|0E%OtD;M@Ftm)YJ1u2U&H+q#;J
zpeQH?hZp|EKwww*a5~E=x{s!4SXjAojvqONodC5+d&1)2ewE|sE%^G({#aQ{Ar3(#b(VB#>b=fHTI1Jjy|~@p;_ta5ugKRj;inog>;Ov
z+U9EY+SVMeO=EI&K{}Ps=KEgeC=;I8n?<`ieJyId
zoD1c90xD1CiHV6T<3k6!q0W}8FZzs|IYdCb%RrA!Y$Jdlsm$)~?zp@dDscktg#|KF
zKKkSZi=I+(y(d3Lle`+7uZWx;j9#H%1UL4?yG>Gok(V5^*Kvxcl=6&Kq*x#jrO4=7
ztev1>z-N>WgQh#C!$S%&q
zyR2Z3jUp&23rU%qWuWyoW3!j5OAv_v;-vw`TVamAQ@Y?zYGrnI5wXbjTgi6*7`g?M
z8rW|S?GMC1_=KOy>=+iqB~z5JABZ3CSZ?t?EmS7S-;aw5ooa{4f#$Yr*9yui$)Ld(
XZ;p4J$MiS6fi~^^SM?V^@KOE;cUPuS
literal 0
HcmV?d00001
diff --git a/man-roxygen/output_e_source_param.R b/man-roxygen/output_e_source_param.R
index 8b33db5..66d5307 100644
--- a/man-roxygen/output_e_source_param.R
+++ b/man-roxygen/output_e_source_param.R
@@ -1,2 +1,2 @@
-#' @param e_source Character (e.g., `mapzen` or `WorldClim`). Indicating the
+#' @param e_source Character (e.g., `mapzen` or `geodata`). Indicating the
#' elevation data source.
diff --git a/man/ce_download.Rd b/man/ce_download.Rd
index ec56728..a035c63 100644
--- a/man/ce_download.Rd
+++ b/man/ce_download.Rd
@@ -20,7 +20,7 @@ the data will be stored.}
\item{c_source}{Character (e.g., \code{"CHELSA or WorldClim"}). Indicating the
climate data source.}
-\item{e_source}{Character (e.g., \code{mapzen} or \code{WorldClim}). Indicating the
+\item{e_source}{Character (e.g., \code{mapzen} or \code{geodata}). Indicating the
elevation data source.}
\item{var}{Character. If supplied will download a subset of the climate data.
diff --git a/man/elev.Rd b/man/elev.Rd
index afffc21..bb29a56 100644
--- a/man/elev.Rd
+++ b/man/elev.Rd
@@ -14,7 +14,7 @@ the data will be stored.}
\link[sf:st]{sf::st_polygon} to make polygons and \link[sf:st_as_sf]{sf::st_as_sf} to make point
objects.}
-\item{e_source}{Character (e.g., \code{mapzen} or \code{WorldClim}). Indicating the
+\item{e_source}{Character (e.g., \code{mapzen} or \code{geodata}). Indicating the
elevation data source.}
\item{\dots}{Additional arguments to \code{\link[=download.file]{download.file()}}.}
@@ -37,11 +37,33 @@ latitudes between -60 and 60 or Mapzen's synthesis digital elevation product.
}
\examples{
\dontrun{
-# Start by loading Italy's Biom data
+# We could do this using Italy's Biome data
data("italy_py", package = "climenv")
# elevation will be saved in the output_dir (i.e. output directory)
elev(output_dir = "...Desktop/elev", location = italy_py)
}
+
+Or a smaller example we can make a polygon covering an island in the ocean.
+
+location <- sf::st_polygon(
+ list(
+ cbind(
+ long = c(161, 161, 154, 161),
+ lat = c(-61, -49, -61, -61)
+ )
+ )
+)
+
+# We need to make sure that the polygon the correct class
+location <- sf::st_geometry(location)
+class(location) # "sfc_POLYGON" "sfc"
+
+# Lets make sure to set the coordinate reference system
+sf::st_crs(location) = "epsg:4326"
+
+# Lastly we can use elev()
+elev_data <- elev(location = location)
+
}
\references{
{ Hijmans, R.J., Barbosa, M., Ghosh, A., & Mandel, A. (2023).
@@ -61,7 +83,8 @@ ISPRS International Journal of Geo-Information 8, 108.
}
\seealso{
A more convenient function for other climate and elevation data
-\code{\link[=ce_download]{ce_download()}}.
+\code{\link[=ce_download]{ce_download()}}. See \link[sf:st]{sf::st_polygon} to make polygons and \link[sf:st_as_sf]{sf::st_as_sf}
+to make point objects.
}
\author{
James L. Tsakalos
diff --git a/man/srtm_tiles.Rd b/man/srtm_tiles.Rd
new file mode 100644
index 0000000..6bef659
--- /dev/null
+++ b/man/srtm_tiles.Rd
@@ -0,0 +1,25 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data_srtm_tiles.R
+\docType{data}
+\encoding{UTF-8}
+\name{srtm_tiles}
+\alias{srtm_tiles}
+\title{STRM tiles data}
+\format{
+{ An object of class \code{SpatialPolygonsDataFrame} with 872 rows
+and 1 columns.}
+}
+\usage{
+srtm_tiles
+}
+\description{
+SRTM tiles data.
+}
+\details{
+Contains tiles to assist downloading from 'geodata'.
+}
+\examples{
+data("srtm_tiles", package = "climenv")
+head(srtm_tiles)
+}
+\keyword{datasets}
diff --git a/tests/testthat/expected/mapzen.tif b/tests/testthat/expected/mapzen.tif
new file mode 100644
index 0000000000000000000000000000000000000000..97a1701a710fe08ecd933fb7dd2cb0f8832a2f19
GIT binary patch
literal 11372
zcma)i4OA1?w*SoJYw}45Aq?RolMgWwD>4eQUk9{%gJWpS8~H
z-^|&2pL1sKv(K5cc5ZGQ00RIJ0stTh00T%7DBvGBHGrW%FdD$5KQJYLsej<#Wr9I6
z00ro?KneYC?*)J0xWN0cKX{%5aO8jEdFj95m49GTfQMsY0l(9&0mWu33!nyYa{zzX
zLIThLJ|DpD7S_MoeHy@LTA+W8gc=YcdLUqPpkq*=m;#vmyB@>Vz#RZCqX6)BV91;R
z-`7$A$jH&C@|UfzGgKJr44DiR&B(1=zXjcD*s}g5$;u*CQSQp3+^m(aEK`-_E?c!s
zf^Ii#si_XsDI}TmlTwlr7N(~rr=>1brY&5Mk@&m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4D5ss9*u#-2zVSj
zo96FYVngSJ?VgRZP8D+0U(uPDf|FatM`>Dl8Ed+SLH3j=)$*fr?&DeAH%~`0i7$BM
zYs*?(ecWb99_ncSi`g=hnX^$Z@XLPq;h79s8_hJmwV|%#SxeLgp)~6ZbhpVN*?)f$827QvJq!;GU$nrVp?Y
zuLD1HYg@nRpwR{p#Mv$F@XpBP*iPyOADeaGk)l3%J4$>ZpM)-Nw2Ymqz^bDZ@1{+J0%YseUtz^T+
zNedodZiI1{iM8a`^d(L$4z|ufODK0w@dgcf?H!U6S&q7;J&*bDW5%wgfs8p&^|JlW
zvtXBP3sOK
z4Sld?OHj|n;5`+^eA*9sy2Sq*Lz!f!bWCJJ2eyCGah`sR8x#%mH_(Rki*q{VT!Vp6
z@t!LN-Sbr93Q>nAmA>0?J($o8nE!Gu)3Wjb6E9*1-^^lYNAc~_*|kaHHsxNdHtZpv
z(lp6adTx#&6TVJZS!SnAbse7QrbNFG;s8P(OLZCNw&HNV{nB6F$s9NGOAq)rT#
zEd6BPSo#>|2|0i=Ie)>@Y}og-A#7<|Ey8Rr;EJRbZZ`O3akJwuD?AxkQy3(s;h@Lfz&L&9+h@(F}(3;l;=lDv@7Z@&{S)saQ6n1dH4stg-F(M7g~CB;&n
zyr7u93I_MVNh>#ZJ39Jix>zlEfIUQRWvm42Af@_(i-YUj&@?25Px;$j@V7v+{-o{8SD3Pl*W>eqW^%-%xB2{iA9p=s=WOPZ)TdUu1!%l;rR_
zQ2p@&GkD`yv+rQB$(k*}5|jrWE&RXR;>l0YxjBz~QQ#Y^NKT25K<3KKiUsNDBge=_6G`+t#<
F{}bgSY*zpP
literal 0
HcmV?d00001
diff --git a/tests/testthat/expected/mapzen_pt.tif b/tests/testthat/expected/mapzen_pt.tif
new file mode 100644
index 0000000000000000000000000000000000000000..de2524481becf9134bb80f5b8967235cce8af3e4
GIT binary patch
literal 980
zcmebD)MDUZU|*y7Mi#K%KTHe^
zqDbOmP&UXMaj2RbK(-8$8e1fGFqF*<#Ta3_yzE36R*>&IIX=5LUCelK@L#PK*>(m(!xy7
z+|4#~zsi~QPp0SCcxuuzfIbo}VLtI>3
z!-%!q#WmPD$TJ|s(;vmX3Pt%KucxFICl_TFlw{`TDcPlE=A@b#CmNWiT9_D{B*J}T
zqmLT03}@?=0xGmF*&l$?;NZtY{0D*c$qw>@i}$5H_C5ep$_P$d>Es!{;6TraOP+x0%
zDJMMo!jGf1k{&%lmpDX@@~?N(33Hmra#VdBAxVhMrkGgm!wX8v(WnGlL$Bly$|3<9tPSP4
z6+Vlw@M>>#PmMm!`=Byu*4aw#&OaVEJRbJ4v1wVBh$bxzKUAjm@IXLPcc)q|SJI~v
Y73qjYi{_oy-oEUe%J0ShK36gV0CDX0TL1t6
literal 0
HcmV?d00001
diff --git a/tests/testthat/expected/srtm.tif b/tests/testthat/expected/srtm.tif
new file mode 100644
index 0000000000000000000000000000000000000000..da501f75c6161f237112a791d481f5d325f3293f
GIT binary patch
literal 4886
zcmeH|iCa_07Qp8wAtZq0vM&a`gs`KAfNYYOKmtSxLMv`}e|HjMu8-*}d1bSASl
zFHk1`!G`e%4xMEzYNNYD2h7M?3;=~P9e_vqJjy4Fu>e8&3CgNs9e@hpgc_bI#(bQK
zH_B49lL(E)2Q39C<4~J4Q5sqU5QRFTe~fb`*8g8rs2vCObBGAQEj0KsZ2;cs0HCi6
zfGr6CZy11;dH^KqqwLRNe-e}+7R8IiBBmCCc=N;wsYseAHGx416|e=oPyx?3G&+bK
z!3zotq9B=~)Ql8VN24(5&Mu3c-Cb$!bh_J8Hy7_EGhP462bUfECkKl>(eLlO@q+(n
zXlK{OG#bs*9UYgx^lv?c3OF2Y_&*(*!wvOa#p4TjA%BV%*_=Kz@A!nwxXsBK;^g!+
z3Nv%FI5pa3X|yx__ZYmF{CPnE2$?_DQV@K6`S0@MHvVlzRsYw-koCJM^fA9R!Av?p
zXx^X+iAppD&;tO05f~zzDn_*c|FK*L<;tGq}%`^U3^@0et&_5LM
zaLof!0Cc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M2VCSVg?qQ|UE=mtsf
z(JcWJn3xy-;7A+8a+tU0qQIeKD2x<Egkn7sAQux8g4kt_~Dvuc_-duf-5w=L<
zK#SX!D+Mdva=0227#L!0WEe_h2GFp&QHDQd>W|4tIv)G{A^*>kMHXr&u)FNIJ@en$#+@pLrdN?8k-P{)sJXf
z4<;_LDC!(`e%n|fwBO$~Lf>|9B%M)lbIj%6Cye*=8hR#Na}kpbm9YdQu^1`hwc6G(kBhJ?^x2?D~oavd@AIDJiB)P6`v)S%n-#50!
zOA>xK>cqfCx5&2o3rVNHf0DgS(*Ib}Hk9tMrrqX4ap$Aw+r0CIR*G-OGQHNeH!N@H
zpLm(e$iExccK>;{chm*j?N>)$yp=Gw3lHCa`Zkxj?kp8Iwy5Il+
literal 0
HcmV?d00001
diff --git a/tests/testthat/expected/srtm_pt.tif b/tests/testthat/expected/srtm_pt.tif
new file mode 100644
index 0000000000000000000000000000000000000000..9ebbc0c511e55102e26e2ae42a2190178f92a45c
GIT binary patch
literal 2242
zcmebD)MDUZU|-pD0L7W1Y*rwf4ax@T5oBaxfQT_Lh$4xL
zLD`}}HR4b;pMY!`BsI23>|iLH8K{P@nTG*HS1~a#G_~+BumRbVfb8|{%nS-Z_8}m9
zLpu)xkYZp0D%{x41onv#klnC^i6H^#FexBz1hQFxYVs2EfFuLM1fZA<50F=Dk&5v<`(1th%2ncKQ
z^uw^(&`i(7z}(2l%+$kK$T|qI{6IQ&NkQi!uvJ
zGV}A4?23y@a^sE7;th>pzOd0p4NnGt=@(lX{Z`w
z@y7^E4Zvguq=69(OxBDH&jc7bHnsz08Q8%5K4ngh4ecO#ZZOTj(2-j*O?F8U$UKK-
zArX$@?!gKcCN&HV3=BNXf4Df=nhrcPs0dM#%~3hq0zNr39dK^eSXlUzv*C=asmYlZzz&Obb_@eky4O|A$zE#4=qyjYW!UMcGaq
zepVW3n-(3u?%FdmtH09@=We~@D8jHbRy5DO<6`TcjF{ru=rwKDD>uQV#22-2xm^7v%Zta5Tv
z%v=@EPaz96PX(=+Eux@6LVUQZO*)ZkR2i};R(FQCTF}lV`_j#3ok=&Yyz;2lc7eY}
z@Gg~q?QV-MWSUfkD$Vs>5v&!mYpLDxuvJ&GO{=aZ?Ty_Kt`oXjweEP@rW?6t)uD^-
z=I)5r3){VP-}ACvck<1vuRi))dm!E*e2?mX_O?S03N32Flx2HQBpXHSS!S<3?bMTE
z%bIJ+wsS9}n?&wat9M^^=|!nkZP?=2wKuZOqV_J^pT6zZn{w;gYmaO9KFGI--lz7z
z{n(=ql{R(Z%5%@YD7K2(x7>dDwO3!NZR@Tl@4fq>+$MIvdj0WdpMKQZ)rT*>`}Rk*
cUEKcV`=5XN^(SkBz-ZWvhRujfH&r1l0HEznv;Y7A
literal 0
HcmV?d00001
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index 4c1a834..e67c059 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -28,6 +28,7 @@ test_that("elev() fails gracefully", {
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
+ # When location is not supplied
# This is testing R's functionality, rather than our packages, so does
# not need to be included in this package's test suite;
# we do not handle the case where no parameters are specified.
@@ -37,6 +38,7 @@ test_that("elev() fails gracefully", {
"Error in elev() : argument location is missing, with no default"
))
+ # Invalid polygon
flip_lat_long <- sf::st_polygon(list(cbind(
lat = c(-61, -49, -61, -61),
lng = c(161, 161, 154, 161)
@@ -92,3 +94,133 @@ test_that("elev()", {
skip_if_not_installed("vdiffr")
vdiffr::expect_doppelganger("geo-elev", function() terra::plot(geo_elev))
})
+
+test_that("elev() downloads data", {
+
+ skip_if_offline() # Requires connectivity
+ skip_on_cran() # download is slow
+
+ # CRAN policy: Packages should not write [anywhere] apart from the
+ # R session’s temporary directory [...] and such usage should be cleaned up
+ tmp_dir <- tempdir()
+ on.exit(unlink(tmp_dir))
+
+ # Make a polygon
+ location <- sf::st_polygon(
+ list(cbind(long = c(161, 161, 154, 161),
+ lat = c(-61, -49, -61, -61)))
+ )
+ location <- sf::st_geometry(location)
+ sf::st_crs(location) <- "epsg:4326"
+
+ # polygon and mapzen tiles ####
+ elev(
+ output_dir = tmp_dir, location = location, e_source = "mapzen"
+ )
+ mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_equal(file.exists(mapzen_tile), TRUE)
+
+ # Check data matches expectation
+ skip_if(!file.exists(mapzen_tile[1]))
+ elev_mapzen <- terra::rast(mapzen_tile[1])
+ thumb_1 <- terra::aggregate(elev_mapzen, fact = 64)
+ expected <- terra::rast(test_path("expected", "mapzen_py.tif"))
+ expect_true(all.equal(rast(thumb_1), terra::rast(expected)))
+
+ # Run this code manually to update the "Expected" value
+ if (FALSE) {
+ terra::writeRaster(
+ thumb_1, overwrite = TRUE,
+ test_path("expected", "mapzen_py.tif")
+ )
+ }
+
+ unlink(tmp_dir)
+ tmp_dir <- tempdir()
+ on.exit(unlink(tmp_dir))
+
+ # polygon and geodata ####
+ elev(
+ output_dir = tmp_dir, location = location, e_source = "geodata"
+ )
+ srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_equal(file.exists(srtm_tile), TRUE)
+
+ # Check data matches expectation
+ skip_if(!file.exists(srtm_tile[1]))
+ elev_srtm <- terra::rast(srtm_tile[1])
+ thumb_2 <- terra::aggregate(elev_srtm, fact = 64)
+ expected <- terra::rast(test_path("expected", "srtm_py.tif"))
+ expect_true(all.equal(rast(thumb_2), terra::rast(expected)))
+
+ # Run this code manually to update the "Expected" value
+ if (FALSE) {
+ terra::writeRaster(
+ thumb_2, overwrite = TRUE,
+ test_path("expected", "srtm_py.tif")
+ )
+ }
+
+ # Now for points
+ location <- terra::centroids(terra::vect(location))
+
+ unlink(tmp_dir)
+ tmp_dir <- tempdir()
+ on.exit(unlink(tmp_dir))
+
+ # I expect error because the package does not accept spatvectors
+ expect_error(elev(output_dir = tmp_dir,
+ location = location))
+
+ # sf class is okay.
+ location <- sf::st_as_sf(location)
+
+ # point and mapzen tiles ####
+ elev(
+ output_dir = tmp_dir, location = location, e_source = "mapzen"
+ )
+ mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_equal(file.exists(mapzen_tile), TRUE)
+
+ # Check data matches expectation
+ skip_if(!file.exists(mapzen_tile[1]))
+ elev_mapzen <- terra::rast(mapzen_tile[1])
+ thumb_3 <- terra::aggregate(elev_mapzen, fact = 64)
+ expected <- terra::rast(test_path("expected", "mapzen_pt.tif"))
+ expect_true(all.equal(terra::rast(thumb_3), terra::rast(expected)))
+
+ # Run this code manually to update the "Expected" value
+ if (FALSE) {
+ terra::writeRaster(
+ thumb_3, overwrite = TRUE,
+ test_path("expected", "mapzen_pt.tif")
+ )
+ }
+
+ unlink(tmp_dir)
+ tmp_dir <- tempdir()
+ on.exit(unlink(tmp_dir))
+
+ # polygon and geodata
+ elev(
+ output_dir = tmp_dir, location = location, e_source = "geodata"
+ )
+ srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_equal(file.exists(srtm_tile), TRUE)
+
+ # Check data matches expectation
+ skip_if(!file.exists(srtm_tile[1]))
+ elev_srtm <- terra::rast(srtm_tile[1])
+ thumb_4 <- terra::aggregate(elev_srtm, fact = 64)
+ expected <- terra::rast(test_path("expected", "srtm_pt.tif"))
+ expect_true(all.equal(terra::rast(thumb_4), terra::rast(expected)))
+
+ # Run this code manually to update the "Expected" value
+ if (FALSE) {
+ terra::writeRaster(
+ thumb_4, overwrite = TRUE,
+ test_path("expected", "srtm_pt.tif")
+ )
+ }
+
+})
From 4c68daa2d1f5c3b36e5ce7cf75fdfec7660f6234 Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:14:13 +0100
Subject: [PATCH 30/61] Update NAMESPACE
---
NAMESPACE | 1 +
1 file changed, 1 insertion(+)
diff --git a/NAMESPACE b/NAMESPACE
index c9e525a..6cf4741 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -49,6 +49,7 @@ importFrom(terra,crds)
importFrom(terra,extract)
importFrom(terra,mosaic)
importFrom(terra,rast)
+importFrom(terra,rasterize)
importFrom(terra,rowFromCell)
importFrom(terra,vect)
importFrom(terra,writeRaster)
From 42b22c07eca73f61f5ee3a87907e370fb99ea50c Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:18:20 +0100
Subject: [PATCH 31/61] Spatial-ize "sfc" objects too
---
R/elev.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/elev.R b/R/elev.R
index 245ee18..6f45d15 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -158,7 +158,7 @@ elev <- function(output_dir, location, e_source = "mapzen", ...) {
stop("e_source must be \"mapzen\" or \"geodata\"")
}
- if ("sfg" %in% class(location)) {
+ if (any(c("sfc", "sfg") %in% class(location))) {
location <- as(location, "Spatial")
}
location_sf <- as(location, "sf")
From fe2c4b21aa493ad249e6f5022c8828c15de9ec60 Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:18:55 +0100
Subject: [PATCH 32/61] load sp quietly
---
tests/testthat.R | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/testthat.R b/tests/testthat.R
index ea9b06b..5a7db44 100644
--- a/tests/testthat.R
+++ b/tests/testthat.R
@@ -1,4 +1,5 @@
-library(testthat)
-library(climenv)
+suppressPackageStartupMessages(library("sp", quietly = TRUE)) # Until Oct 2023
+library("testthat")
+library("climenv")
test_check("climenv")
From f1e2ae0fc07619369c9bad55b83a1e59a95225af Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:19:03 +0100
Subject: [PATCH 33/61] skip_on_cran implicit
---
tests/testthat/test-elev.R | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index e67c059..61562f8 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -97,8 +97,7 @@ test_that("elev()", {
test_that("elev() downloads data", {
- skip_if_offline() # Requires connectivity
- skip_on_cran() # download is slow
+ skip_if_offline() # Requires connectivity. Automatically skips on CRAN.
# CRAN policy: Packages should not write [anywhere] apart from the
# R session’s temporary directory [...] and such usage should be cleaned up
From 0f4927b6d2e8bedb0048cc551ee7b971146e1563 Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:28:24 +0100
Subject: [PATCH 34/61] st_as_sf
---
R/elev.R | 5 ++++-
tests/testthat/test-elev.R | 6 ------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/R/elev.R b/R/elev.R
index 6f45d15..06ae3ab 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -148,7 +148,7 @@
#'
#' @importFrom elevatr get_elev_raster
#' @importFrom methods as
-#' @importFrom sf as_Spatial st_geometry st_bbox st_is_longlat st_crs<-
+#' @importFrom sf as_Spatial st_as_sf st_bbox st_geometry st_is_longlat st_crs<-
#' @importFrom terra extract mosaic rast rasterize vect writeRaster xyFromCell
#' @export
elev <- function(output_dir, location, e_source = "mapzen", ...) {
@@ -158,6 +158,9 @@ elev <- function(output_dir, location, e_source = "mapzen", ...) {
stop("e_source must be \"mapzen\" or \"geodata\"")
}
+ if (is.function(location)) {
+ location <- st_as_sf(location)
+ }
if (any(c("sfc", "sfg") %in% class(location))) {
location <- as(location, "Spatial")
}
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index 61562f8..f8f1cb5 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -167,12 +167,6 @@ test_that("elev() downloads data", {
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # I expect error because the package does not accept spatvectors
- expect_error(elev(output_dir = tmp_dir,
- location = location))
-
- # sf class is okay.
- location <- sf::st_as_sf(location)
# point and mapzen tiles ####
elev(
From c770bbc2ae57e2356bc3fccc0ac2f2599d06daba Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:34:37 +0100
Subject: [PATCH 35/61] Separate tests for each assertion
Clarifies workflow and allows granular skipping
---
tests/testthat/test-elev.R | 91 +++++++++++++++++++-------------------
1 file changed, 46 insertions(+), 45 deletions(-)
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index f8f1cb5..8f65584 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -1,3 +1,12 @@
+polygon <- sf::st_polygon(
+ list(cbind(long = c(161, 161, 154, 161),
+ lat = c(-61, -49, -61, -61)))
+ )
+polygon <- sf::st_geometry(polygon)
+sf::st_crs(polygon) <- "epsg:4326"
+points <- terra::centroids(terra::vect(polygon))
+
+
scrub_progress_bars <- function(x) {
progress_bars <- grep("^[\\|\\-=\\s]*$", x, perl = TRUE)
if (length(progress_bars)) {
@@ -95,8 +104,7 @@ test_that("elev()", {
vdiffr::expect_doppelganger("geo-elev", function() terra::plot(geo_elev))
})
-test_that("elev() downloads data", {
-
+test_that("elev() downloads polygon from Mapzen", {
skip_if_offline() # Requires connectivity. Automatically skips on CRAN.
# CRAN policy: Packages should not write [anywhere] apart from the
@@ -104,20 +112,12 @@ test_that("elev() downloads data", {
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # Make a polygon
- location <- sf::st_polygon(
- list(cbind(long = c(161, 161, 154, 161),
- lat = c(-61, -49, -61, -61)))
- )
- location <- sf::st_geometry(location)
- sf::st_crs(location) <- "epsg:4326"
-
# polygon and mapzen tiles ####
elev(
- output_dir = tmp_dir, location = location, e_source = "mapzen"
+ output_dir = tmp_dir, location = polygon, e_source = "mapzen"
)
mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
- expect_equal(file.exists(mapzen_tile), TRUE)
+ expect_true(file.exists(mapzen_tile))
# Check data matches expectation
skip_if(!file.exists(mapzen_tile[1]))
@@ -133,73 +133,75 @@ test_that("elev() downloads data", {
test_path("expected", "mapzen_py.tif")
)
}
-
- unlink(tmp_dir)
+})
+test_that("elev() downloads points from Mapzen", {
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # polygon and geodata ####
elev(
- output_dir = tmp_dir, location = location, e_source = "geodata"
+ output_dir = tmp_dir, location = points, e_source = "mapzen"
)
- srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
- expect_equal(file.exists(srtm_tile), TRUE)
+ mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_true(file.exists(mapzen_tile))
# Check data matches expectation
- skip_if(!file.exists(srtm_tile[1]))
- elev_srtm <- terra::rast(srtm_tile[1])
- thumb_2 <- terra::aggregate(elev_srtm, fact = 64)
- expected <- terra::rast(test_path("expected", "srtm_py.tif"))
- expect_true(all.equal(rast(thumb_2), terra::rast(expected)))
+ skip_if(!file.exists(mapzen_tile[1]))
+ elev_mapzen <- terra::rast(mapzen_tile[1])
+ thumb_3 <- terra::aggregate(elev_mapzen, fact = 64)
+ expected <- terra::rast(test_path("expected", "mapzen_pt.tif"))
+ expect_true(all.equal(terra::rast(thumb_3), terra::rast(expected)))
# Run this code manually to update the "Expected" value
if (FALSE) {
terra::writeRaster(
- thumb_2, overwrite = TRUE,
- test_path("expected", "srtm_py.tif")
+ thumb_3, overwrite = TRUE,
+ test_path("expected", "mapzen_pt.tif")
)
}
+})
- # Now for points
- location <- terra::centroids(terra::vect(location))
- unlink(tmp_dir)
+test_that("elev() downloads polygon from GeoData", {
+ skip_if_server_offline("srtm.csi.cgiar.org")
+
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
-
- # point and mapzen tiles ####
+ # polygon and geodata ####
elev(
- output_dir = tmp_dir, location = location, e_source = "mapzen"
+ output_dir = tmp_dir, location = polygon, e_source = "geodata", quiet = TRUE
)
- mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
- expect_equal(file.exists(mapzen_tile), TRUE)
+ srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
+ expect_true(file.exists(srtm_tile))
# Check data matches expectation
- skip_if(!file.exists(mapzen_tile[1]))
- elev_mapzen <- terra::rast(mapzen_tile[1])
- thumb_3 <- terra::aggregate(elev_mapzen, fact = 64)
- expected <- terra::rast(test_path("expected", "mapzen_pt.tif"))
- expect_true(all.equal(terra::rast(thumb_3), terra::rast(expected)))
+ skip_if(!file.exists(srtm_tile[1]))
+ elev_srtm <- terra::rast(srtm_tile[1])
+ thumb_2 <- terra::aggregate(elev_srtm, fact = 64)
+ expected <- terra::rast(test_path("expected", "srtm_py.tif"))
+ expect_true(all.equal(rast(thumb_2), terra::rast(expected)))
# Run this code manually to update the "Expected" value
if (FALSE) {
terra::writeRaster(
- thumb_3, overwrite = TRUE,
- test_path("expected", "mapzen_pt.tif")
+ thumb_2, overwrite = TRUE,
+ test_path("expected", "srtm_py.tif")
)
}
+})
+
+
+test_that("elev() downloads points from GeoData", {
+ skip_if_server_offline("srtm.csi.cgiar.org")
- unlink(tmp_dir)
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # polygon and geodata
elev(
- output_dir = tmp_dir, location = location, e_source = "geodata"
+ output_dir = tmp_dir, location = points, e_source = "geodata", quiet = TRUE
)
srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
- expect_equal(file.exists(srtm_tile), TRUE)
+ expect_true(file.exists(srtm_tile))
# Check data matches expectation
skip_if(!file.exists(srtm_tile[1]))
@@ -215,5 +217,4 @@ test_that("elev() downloads data", {
test_path("expected", "srtm_pt.tif")
)
}
-
})
From 78ae56e8a862b02e6e6b6e36c8216aaa93846ee1 Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 08:35:36 +0100
Subject: [PATCH 36/61] Support SpatVectors
---
R/elev.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/elev.R b/R/elev.R
index 06ae3ab..07d13ee 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -161,7 +161,7 @@ elev <- function(output_dir, location, e_source = "mapzen", ...) {
if (is.function(location)) {
location <- st_as_sf(location)
}
- if (any(c("sfc", "sfg") %in% class(location))) {
+ if (any(c("sfc", "sfg", "SpatVector") %in% class(location))) {
location <- as(location, "Spatial")
}
location_sf <- as(location, "sf")
From 2d8fb9b1293119f4f2cb5b42f99678825c790e9d Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Wed, 12 Jul 2023 12:02:32 +0100
Subject: [PATCH 37/61] Squashed commit of the following:
commit 122d3d7ef471efecd2625983423c8de049e172e0
Author: Martin R. Smith <1695515+ms609@users.noreply.github.com>
Date: Wed Jul 12 12:01:52 2023 +0100
uncomment
commit 7802e82484e26eee6ee1f559fc97d312ac02df39
Author: Martin R. Smith <1695515+ms609@users.noreply.github.com>
Date: Tue Jul 11 22:38:36 2023 +0100
sp
commit fbffb8577df264ed20f7336a5230647dbfae094d
Author: Martin R. Smith <1695515+ms609@users.noreply.github.com>
Date: Tue Jul 11 22:35:51 2023 +0100
Explore error
commit 3cc191dc4aa2938e5a658bb946be214187533ac3
Author: Martin R. Smith <1695515+ms609@users.noreply.github.com>
Date: Tue Jul 11 22:04:04 2023 +0100
define file_path outside switch
commit f0c143ec489a9a294cc5fbe450ac5a659761a175
Author: Martin R. Smith <1695515+ms609@users.noreply.github.com>
Date: Tue Jul 11 21:58:45 2023 +0100
Avoid rgdal
---
DESCRIPTION | 4 +++-
R/elev.R | 38 ++++++++++++++++++--------------------
man/elev.Rd | 7 +++++--
tests/testthat/test-elev.R | 9 +++++----
4 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 9d21872..732396c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -38,7 +38,7 @@ Imports:
climaemet,
dismo,
dplyr,
- elevatr,
+ elevatr (>= 1.0),
exactextractr,
geodata,
glue,
@@ -58,6 +58,8 @@ Suggests:
rmarkdown,
testthat (>= 3.0.0),
vdiffr
+Remotes:
+ jhollist/elevatr
Config/Needs/check: rcmdcheck
Config/Needs/coverage: covr
Config/Needs/website: pkgdown
diff --git a/R/elev.R b/R/elev.R
index 07d13ee..41cbd0d 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -85,6 +85,8 @@
#' @template output_dir_param
#' @template output_location_param
#' @template output_e_source_param
+#' @param verbose Logical specifying whether to display verbose output when
+#' downloading from Mapzen.
#' @param \dots Additional arguments to [`download.file()`].
#'
#' @return
@@ -107,7 +109,7 @@
#' https://CRAN.R-project.org/package=geodata
#'
#' Hollister, J. (2022). elevatr: Access Elevation Data from Various
-#' APIs. R package version 0.4.2. \doi{10.5281/zenodo.5809645}
+#' APIs. R package version 1.0.0. \doi{10.5281/zenodo.5809645}
#' https://CRAN.R-project.org/package=elevatr
#'
#' Mouratidis, A., & Ampatzidis, D. (2019). European Digital Elevation Model
@@ -151,7 +153,8 @@
#' @importFrom sf as_Spatial st_as_sf st_bbox st_geometry st_is_longlat st_crs<-
#' @importFrom terra extract mosaic rast rasterize vect writeRaster xyFromCell
#' @export
-elev <- function(output_dir, location, e_source = "mapzen", ...) {
+elev <- function(output_dir, location, e_source = "mapzen",
+ verbose = FALSE, ...) {
e_source_id <- pmatch(tolower(e_source[1]), c("mapzen", "geodata"))
if (is.na(e_source_id)) {
@@ -189,24 +192,19 @@ elev <- function(output_dir, location, e_source = "mapzen", ...) {
recursive = TRUE, showWarnings = FALSE)
}
+ file_path <- paste0(output_dir, "/elev/srtm.tif")
# Saves elevation from geodata or mapzen sources
- switch(e_source_id,
- { # mapzen
- srtm_mosaic <- terra::rast(
- elevatr::get_elev_raster(
- location_sf, z = 7, override_size_check = TRUE,
- progress = FALSE
- )
- )
- file_path <- paste0(output_dir, "/elev/srtm.tif")
- terra::writeRaster(srtm_mosaic, filename = file_path,
- overwrite = TRUE)
- },
- { # geodata
- srtm_mosaic <- .elev_geodata(location_sf, output_dir, ...)
- file_path <- paste0(output_dir, "/elev/srtm.tif")
- terra::writeRaster(srtm_mosaic, filename = file_path,
- overwrite = TRUE)
- }
+ switch(e_source_id, { # mapzen
+ elev_raster <- elevatr::get_elev_raster(
+ location_sf, z = 7, override_size_check = TRUE,
+ progress = verbose, verbose = verbose
+ )
+ srtm_mosaic <- terra::rast(elev_raster)
+ terra::writeRaster(srtm_mosaic, filename = file_path,
+ overwrite = TRUE)
+ }, { # geodata
+ srtm_mosaic <- .elev_geodata(location_sf, output_dir, ...)
+ terra::writeRaster(srtm_mosaic, filename = file_path, overwrite = TRUE)
+ }
)
}
diff --git a/man/elev.Rd b/man/elev.Rd
index bb29a56..bf4a91c 100644
--- a/man/elev.Rd
+++ b/man/elev.Rd
@@ -4,7 +4,7 @@
\alias{elev}
\title{Download elevation data}
\usage{
-elev(output_dir, location, e_source = "mapzen", ...)
+elev(output_dir, location, e_source = "mapzen", verbose = FALSE, ...)
}
\arguments{
\item{output_dir}{Character (e.g., \code{"../Desktop/chelsa"}). Pathway to where
@@ -17,6 +17,9 @@ objects.}
\item{e_source}{Character (e.g., \code{mapzen} or \code{geodata}). Indicating the
elevation data source.}
+\item{verbose}{Logical specifying whether to display verbose output when
+downloading from Mapzen.}
+
\item{\dots}{Additional arguments to \code{\link[=download.file]{download.file()}}.}
}
\value{
@@ -71,7 +74,7 @@ geodata: Download Geographic Data. R package version 0.5-8.
https://CRAN.R-project.org/package=geodata
Hollister, J. (2022). elevatr: Access Elevation Data from Various
-APIs. R package version 0.4.2. \doi{10.5281/zenodo.5809645}
+APIs. R package version 1.0.0. \doi{10.5281/zenodo.5809645}
https://CRAN.R-project.org/package=elevatr
Mouratidis, A., & Ampatzidis, D. (2019). European Digital Elevation Model
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index 8f65584..924753f 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -95,10 +95,11 @@ test_that("elev()", {
"Could not download srtm_6._2."),
"Coordinate reference system not specified")
- #cran = TRUE, error = FALSE, scrub_progress_bars)
- # Expect the warnings:
- # "Coordinate reference system not specified",
- # "Could not download srtm_6._2."
+ # TODO JS to investigate:
+ # elev.R:172 terra::writeRaster(srtm_mosaic, filename = file_path, [...]
+ # throws
+ # Error: [writeRaster] there are no cell values
+ expect_snapshot(mz_elev <- elev(tmp_dir, island), cran = TRUE)
skip_if_not_installed("vdiffr")
vdiffr::expect_doppelganger("geo-elev", function() terra::plot(geo_elev))
From e4d7d559fd2b26af8de71934bb1d0e2a752bd272 Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Thu, 13 Jul 2023 10:58:24 +0100
Subject: [PATCH 38/61] Comment-out comment (#)
---
R/elev.R | 7 +++----
man/elev.Rd | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/R/elev.R b/R/elev.R
index 41cbd0d..bd2526e 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -127,8 +127,7 @@
#' elev(output_dir = "...Desktop/elev", location = italy_py)
#' }
#'
-#' Or a smaller example we can make a polygon covering an island in the ocean.
-#'
+#' # As a smaller example, we can make a polygon covering an ocean island.
#' location <- sf::st_polygon(
#' list(
#' cbind(
@@ -142,10 +141,10 @@
#' location <- sf::st_geometry(location)
#' class(location) # "sfc_POLYGON" "sfc"
#'
-#' # Lets make sure to set the coordinate reference system
+#' # Set the coordinate reference system
#' sf::st_crs(location) = "epsg:4326"
#'
-#' # Lastly we can use elev()
+#' # We are now ready to call elev()
#' elev_data <- elev(location = location)
#'
#' @importFrom elevatr get_elev_raster
diff --git a/man/elev.Rd b/man/elev.Rd
index bf4a91c..d0dfc90 100644
--- a/man/elev.Rd
+++ b/man/elev.Rd
@@ -46,8 +46,7 @@ data("italy_py", package = "climenv")
elev(output_dir = "...Desktop/elev", location = italy_py)
}
-Or a smaller example we can make a polygon covering an island in the ocean.
-
+# As a smaller example, we can make a polygon covering an ocean island.
location <- sf::st_polygon(
list(
cbind(
@@ -61,10 +60,10 @@ location <- sf::st_polygon(
location <- sf::st_geometry(location)
class(location) # "sfc_POLYGON" "sfc"
-# Lets make sure to set the coordinate reference system
+# Set the coordinate reference system
sf::st_crs(location) = "epsg:4326"
-# Lastly we can use elev()
+# We are now ready to call elev()
elev_data <- elev(location = location)
}
From b7a020729dd054c9f21fdab3884450ed01fe45ce Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Thu, 13 Jul 2023 11:53:02 +0100
Subject: [PATCH 39/61] Don't call elev
We don't want to write files to user's machine
---
R/elev.R | 2 +-
man/elev.Rd | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/R/elev.R b/R/elev.R
index bd2526e..8fea808 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -145,7 +145,7 @@
#' sf::st_crs(location) = "epsg:4326"
#'
#' # We are now ready to call elev()
-#' elev_data <- elev(location = location)
+#' # elev(location = location, output_dir = )
#'
#' @importFrom elevatr get_elev_raster
#' @importFrom methods as
diff --git a/man/elev.Rd b/man/elev.Rd
index d0dfc90..c15eb1f 100644
--- a/man/elev.Rd
+++ b/man/elev.Rd
@@ -64,7 +64,7 @@ class(location) # "sfc_POLYGON" "sfc"
sf::st_crs(location) = "epsg:4326"
# We are now ready to call elev()
-elev_data <- elev(location = location)
+# elev(location = location, output_dir = )
}
\references{
From 67015f381a7cd52c46fe00b0fac99d4c3fa4d37d Mon Sep 17 00:00:00 2001
From: "Martin R. Smith" <1695515+ms609@users.noreply.github.com>
Date: Fri, 14 Jul 2023 13:35:56 +0100
Subject: [PATCH 40/61] `inherits` preferable to `class`
---
R/elev.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/elev.R b/R/elev.R
index 8fea808..6280dc9 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -163,7 +163,7 @@ elev <- function(output_dir, location, e_source = "mapzen",
if (is.function(location)) {
location <- st_as_sf(location)
}
- if (any(c("sfc", "sfg", "SpatVector") %in% class(location))) {
+ if (inherits(location, c("sfc", "sfg", "SpatVector"))) {
location <- as(location, "Spatial")
}
location_sf <- as(location, "sf")
From d51bb9d20c82796bcae76ca61e0164c4740679ce Mon Sep 17 00:00:00 2001
From: James Tsakalos
Date: Sun, 16 Jul 2023 17:49:29 +0200
Subject: [PATCH 41/61] corrected srtm code to mask tiles that were in the sea
to ensure that the selection of srtm_id was correct. added the `touches =
TRUE` arguement to ensure that the intersection also includes tiles where
verticies have not been sampled. usage of `as(elev_raster, "SpatTaster")`
instead of `terra::rast(elev_raster)`, I'm not sure why but the existing code
threw an error.
---
R/elev.R | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/R/elev.R b/R/elev.R
index 6280dc9..2c0118a 100644
--- a/R/elev.R
+++ b/R/elev.R
@@ -1,24 +1,20 @@
#' @importFrom terra colFromCell crs<- rowFromCell
.elev_geodata <- function(location, output_dir, ...) {
+ # create SRTM tiles
y_max <- 60
y_min <- -60
- # create SRTM tiles
- rs <- terra::rast(res = 5, ymin = y_min, ymax = y_max)
- rs <- terra::rasterize(terra::vect(climenv::srtm_tiles), rs, "FID")
-
- # we need to set the crs of the SRTM tiles
- terra::crs(rs) <- "epsg:4326"
-
- # the location crs needs to match the tiles
- location <- terra::project(terra::vect(location), rs)
+ rs <- terra::rast(res = 5, ymin = y_min, ymax = y_max,
+ vals = 1:1728, crs = "+proj=longlat +datum=WGS84")
+ # mask out the tiles with no data
+ rs <- terra::mask(rs, terra::vect(climenv::srtm_tiles), touches = TRUE)
- # Intersect location and tiles
+ # intersect location and tiles
tiles <- unique(
- terra::extract(rs, location, touches = TRUE)$FID
+ terra::extract(rs, location, touches = TRUE)$lyr.1
)
- cols <- formatC(colFromCell(rs, tiles), width = 2, flag = 0)
- rows <- formatC(rowFromCell(rs, tiles), width = 2, flag = 0)
+ cols <- formatC(terra::colFromCell(rs, tiles), width = 2, flag = 0)
+ rows <- formatC(terra::rowFromCell(rs, tiles), width = 2, flag = 0)
na <- cols == "NA" | rows == "NA"
srtm_id <- paste0("srtm_", cols[!na], "_", rows[!na])
@@ -52,8 +48,8 @@
if (error == 0) {
tryCatch(utils::unzip(temp_file, paste0(id, ".tif"), exdir = output_dir),
error = function(e) warning("Failed to unzip: ", id))
- rs <- rast(tif)
- crs(rs) <- "+proj=longlat +datum=WGS84"
+ rs <- terra::rast(tif)
+ terra::crs(rs) <- "+proj=longlat +datum=WGS84"
rs
} else {
NULL
@@ -180,9 +176,8 @@ elev <- function(output_dir, location, e_source = "mapzen",
}
if (!isTRUE(sf::st_is_longlat(location_sf))) {
- warning("Coordinate reference system not specified; assuming EPSG:4326")
- # TODO JS to check: Should we prefer WGS84 to match output?
- st_crs(location_sf) <- "EPSG:4326"
+ warning("Coordinate reference system not specified; assuming WGS84")
+ sf::st_crs(location_sf) <- "+proj=longlat +datum=WGS84"
}
# Create elev folder
@@ -198,7 +193,7 @@ elev <- function(output_dir, location, e_source = "mapzen",
location_sf, z = 7, override_size_check = TRUE,
progress = verbose, verbose = verbose
)
- srtm_mosaic <- terra::rast(elev_raster)
+ srtm_mosaic <- as(elev_raster, "SpatRaster")
terra::writeRaster(srtm_mosaic, filename = file_path,
overwrite = TRUE)
}, { # geodata
From 6887fc3ff08820847ed9d7c53f712150e926978a Mon Sep 17 00:00:00 2001
From: James Tsakalos
Date: Sun, 16 Jul 2023 17:52:34 +0200
Subject: [PATCH 42/61] creating smaller test file for mapzen and srtm data to
speed up the process. Increased the timeout to 2 seconds to reduce the
incorrect decision to abort tests based on slow server response time. Updated
the warnings for the island example using srtm data.
---
tests/testthat/test-elev.R | 127 +++++++++++++++++++------------------
1 file changed, 64 insertions(+), 63 deletions(-)
diff --git a/tests/testthat/test-elev.R b/tests/testthat/test-elev.R
index 924753f..6a2e9c2 100644
--- a/tests/testthat/test-elev.R
+++ b/tests/testthat/test-elev.R
@@ -1,11 +1,17 @@
-polygon <- sf::st_polygon(
+polygon_py <- sf::st_polygon(
list(cbind(long = c(161, 161, 154, 161),
lat = c(-61, -49, -61, -61)))
)
-polygon <- sf::st_geometry(polygon)
-sf::st_crs(polygon) <- "epsg:4326"
-points <- terra::centroids(terra::vect(polygon))
+polygon_py <- sf::st_geometry(polygon_py)
+sf::st_crs(polygon_py) <- "epsg:4326"
+points <- terra::centroids(terra::vect(polygon_py))
+polygon_py_sm <- sf::st_polygon(
+ list(cbind(long = c(156, 156, 154, 156),
+ lat = c(-61, -60, -61, -61)))
+)
+polygon_py_sm <- sf::st_geometry(polygon_py_sm)
+sf::st_crs(polygon_py_sm) <- "epsg:4326"
scrub_progress_bars <- function(x) {
progress_bars <- grep("^[\\|\\-=\\s]*$", x, perl = TRUE)
@@ -20,7 +26,7 @@ skip_if_server_offline <- function(server) {
# Preferred to testthat::skip_if_offline as this runs on CRAN
# Thus we can expect notice of any breaking changes to imported packages
tryCatch(
- curlGetHeaders(server, timeout = 1),
+ curlGetHeaders(server, timeout = 2),
error = function(e) {
if (length(grep("Connection timed out", e$message, fixed = TRUE))) {
testthat::skip(paste("Could not connect to", server))
@@ -31,21 +37,12 @@ skip_if_server_offline <- function(server) {
test_that("elev() fails gracefully", {
- expect_error(elev(out = "", location = "", e_source = ""),
- "e_source must be ")
-
+ skip_if_server_offline("srtm.csi.cgiar.org")
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # When location is not supplied
- # This is testing R's functionality, rather than our packages, so does
- # not need to be included in this package's test suite;
- # we do not handle the case where no parameters are specified.
- expect_error(
- expect_warning(
- elev(),
- "Error in elev() : argument location is missing, with no default"
- ))
+ expect_error(elev(out = "", location = "", e_source = ""),
+ "e_source must be ")
# Invalid polygon
flip_lat_long <- sf::st_polygon(list(cbind(
@@ -57,7 +54,6 @@ test_that("elev() fails gracefully", {
"bounding box falls outside supported latitudes"
)
- skip_if_server_offline("srtm.csi.cgiar.org")
# No data available in the oceans
sea <- sf::st_as_sf(
data.frame(lat = c(-59, -59, -58, -59),
@@ -67,55 +63,48 @@ test_that("elev() fails gracefully", {
})
-test_that("elev()", {
- skip_if_server_offline("srtm.csi.cgiar.org")
+test_that("elev() downloads tiles not containing a vertex srtm", {
+ skip_if_server_offline("srtm.csi.cgiar.org")
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # Two squares, 68_24 and 68_23, cover
- # Latitude south: 50-60
- # Longitude east: 155-160
- # We should be able to download these squares even if our target area
- # overlaps non-existent neighbouring squares
+ # Island example. Covers two srtm tiles (68_24 and 68_23), but the polygon
+ # does not cover one tile not containing a vertex.
island <- sf::st_polygon(
list(cbind(lng = c(161, 161, 154, 161), lat = c(-61, -49, -61, -61))))
- # This polygon covers a tile that does not contain a vertex.
- # This tile should be downloaded too
+ # downloading the data for srtm
expect_warning(
- expect_warning(
- expect_warning(
- expect_warning(
- expect_warning(
geo_elev <- elev(tmp_dir, island, "GEOdata", quiet = TRUE),
- "Could not download srtm_6._2."),
- "Could not download srtm_6._2."),
- "Could not download srtm_6._2."),
- "Could not download srtm_6._2."),
"Coordinate reference system not specified")
- # TODO JS to investigate:
- # elev.R:172 terra::writeRaster(srtm_mosaic, filename = file_path, [...]
- # throws
- # Error: [writeRaster] there are no cell values
- expect_snapshot(mz_elev <- elev(tmp_dir, island), cran = TRUE)
+ thumb_0 <- terra::aggregate(geo_elev, fact = 20)
+
+ # Run this code manually to update the "Expected" value
+ if (FALSE) {
+ terra::writeRaster(
+ thumb_0, overwrite = TRUE,
+ test_path("expected", "island_srtm_py.tif")
+ )
+ }
+
+ expected <- terra::rast(test_path("expected", "island_srtm_py.tif"))
+ expect_true(all.equal(terra::rast(thumb_0), terra::rast(expected)))
- skip_if_not_installed("vdiffr")
- vdiffr::expect_doppelganger("geo-elev", function() terra::plot(geo_elev))
})
test_that("elev() downloads polygon from Mapzen", {
- skip_if_offline() # Requires connectivity. Automatically skips on CRAN.
+ skip_if_offline() # Requires connectivity. Automatically skips on CRAN.
# CRAN policy: Packages should not write [anywhere] apart from the
# R session’s temporary directory [...] and such usage should be cleaned up
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # polygon and mapzen tiles ####
+ # download mapzen using a polygon ###
elev(
- output_dir = tmp_dir, location = polygon, e_source = "mapzen"
+ output_dir = tmp_dir, location = polygon_py_sm, e_source = "mapzen"
)
mapzen_tile <- paste0(tmp_dir, "/elev/srtm.tif")
expect_true(file.exists(mapzen_tile))
@@ -124,8 +113,6 @@ test_that("elev() downloads polygon from Mapzen", {
skip_if(!file.exists(mapzen_tile[1]))
elev_mapzen <- terra::rast(mapzen_tile[1])
thumb_1 <- terra::aggregate(elev_mapzen, fact = 64)
- expected <- terra::rast(test_path("expected", "mapzen_py.tif"))
- expect_true(all.equal(rast(thumb_1), terra::rast(expected)))
# Run this code manually to update the "Expected" value
if (FALSE) {
@@ -134,11 +121,19 @@ test_that("elev() downloads polygon from Mapzen", {
test_path("expected", "mapzen_py.tif")
)
}
+
+ expected <- terra::rast(test_path("expected", "mapzen_py.tif"))
+ expect_true(all.equal(terra::rast(thumb_1), terra::rast(expected)))
+
})
+
test_that("elev() downloads points from Mapzen", {
+
+ skip_if_offline() # Requires connectivity. Automatically skips on CRAN.
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
+ # download mapzen using points
elev(
output_dir = tmp_dir, location = points, e_source = "mapzen"
)
@@ -148,29 +143,31 @@ test_that("elev() downloads points from Mapzen", {
# Check data matches expectation
skip_if(!file.exists(mapzen_tile[1]))
elev_mapzen <- terra::rast(mapzen_tile[1])
- thumb_3 <- terra::aggregate(elev_mapzen, fact = 64)
- expected <- terra::rast(test_path("expected", "mapzen_pt.tif"))
- expect_true(all.equal(terra::rast(thumb_3), terra::rast(expected)))
+ thumb_2 <- terra::aggregate(elev_mapzen, fact = 64)
# Run this code manually to update the "Expected" value
if (FALSE) {
terra::writeRaster(
- thumb_3, overwrite = TRUE,
+ thumb_2, overwrite = TRUE,
test_path("expected", "mapzen_pt.tif")
)
}
-})
+ expected <- terra::rast(test_path("expected", "mapzen_pt.tif"))
+ expect_true(all.equal(terra::rast(thumb_2), terra::rast(expected)))
+
+})
test_that("elev() downloads polygon from GeoData", {
- skip_if_server_offline("srtm.csi.cgiar.org")
+ skip_if_server_offline("srtm.csi.cgiar.org")
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
- # polygon and geodata ####
+ # download mapzen using a polygon ###
elev(
- output_dir = tmp_dir, location = polygon, e_source = "geodata", quiet = TRUE
+ output_dir = tmp_dir, location = polygon_py_sm, e_source = "geodata",
+ quiet = TRUE
)
srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
expect_true(file.exists(srtm_tile))
@@ -178,29 +175,31 @@ test_that("elev() downloads polygon from GeoData", {
# Check data matches expectation
skip_if(!file.exists(srtm_tile[1]))
elev_srtm <- terra::rast(srtm_tile[1])
- thumb_2 <- terra::aggregate(elev_srtm, fact = 64)
- expected <- terra::rast(test_path("expected", "srtm_py.tif"))
- expect_true(all.equal(rast(thumb_2), terra::rast(expected)))
+ thumb_3 <- terra::aggregate(elev_srtm, fact = 64)
# Run this code manually to update the "Expected" value
if (FALSE) {
terra::writeRaster(
- thumb_2, overwrite = TRUE,
+ thumb_3, overwrite = TRUE,
test_path("expected", "srtm_py.tif")
)
}
-})
+ expected <- terra::rast(test_path("expected", "srtm_py.tif"))
+ expect_true(all.equal(terra::rast(thumb_3), terra::rast(expected)))
+
+})
test_that("elev() downloads points from GeoData", {
- skip_if_server_offline("srtm.csi.cgiar.org")
+ skip_if_server_offline("srtm.csi.cgiar.org")
tmp_dir <- tempdir()
on.exit(unlink(tmp_dir))
elev(
output_dir = tmp_dir, location = points, e_source = "geodata", quiet = TRUE
)
+
srtm_tile <- paste0(tmp_dir, "/elev/srtm.tif")
expect_true(file.exists(srtm_tile))
@@ -208,8 +207,6 @@ test_that("elev() downloads points from GeoData", {
skip_if(!file.exists(srtm_tile[1]))
elev_srtm <- terra::rast(srtm_tile[1])
thumb_4 <- terra::aggregate(elev_srtm, fact = 64)
- expected <- terra::rast(test_path("expected", "srtm_pt.tif"))
- expect_true(all.equal(terra::rast(thumb_4), terra::rast(expected)))
# Run this code manually to update the "Expected" value
if (FALSE) {
@@ -218,4 +215,8 @@ test_that("elev() downloads points from GeoData", {
test_path("expected", "srtm_pt.tif")
)
}
+
+ expected <- terra::rast(test_path("expected", "srtm_pt.tif"))
+ expect_true(all.equal(terra::rast(thumb_4), terra::rast(expected)))
+
})
From c18e7c880f795b56fa93673c7dd0ff5d6cfd9241 Mon Sep 17 00:00:00 2001
From: James Tsakalos
Date: Sun, 16 Jul 2023 17:53:18 +0200
Subject: [PATCH 43/61] adding new testing expectations
---
tests/testthat/Rplots.pdf | Bin 8623 -> 3448 bytes
tests/testthat/_snaps/elev.md | 5 +++--
tests/testthat/expected/island_srtm_py.tif | Bin 0 -> 28746 bytes
tests/testthat/expected/mapzen_pt.tif | Bin 980 -> 980 bytes
tests/testthat/expected/mapzen_py.tif | Bin 0 -> 1595 bytes
tests/testthat/expected/srtm.tif | Bin 4886 -> 0 bytes
tests/testthat/expected/srtm_pt.tif | Bin 2242 -> 2106 bytes
tests/testthat/expected/srtm_py.tif | Bin 0 -> 2106 bytes
8 files changed, 3 insertions(+), 2 deletions(-)
create mode 100644 tests/testthat/expected/island_srtm_py.tif
create mode 100644 tests/testthat/expected/mapzen_py.tif
delete mode 100644 tests/testthat/expected/srtm.tif
create mode 100644 tests/testthat/expected/srtm_py.tif
diff --git a/tests/testthat/Rplots.pdf b/tests/testthat/Rplots.pdf
index 6b7b7122210e569125be2b3eb8759ce5a969bde7..0a93a3d6020c32a064ac460285e3a284ad5c82f9 100644
GIT binary patch
delta 179
zcmZ4Q{6lJjnX0*=nW4F{nW=#$m%eX)ic4Zis)B}#m63swu>o9eVsz!?rNRnau?qUm
z`K5U!3I>yJ3;S%g6?wwNXg*n4K9-}RC^e1CK*3^ikb?8%rwU?r7M2PIAfS+^zy)R)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W_qCGRd5}rN7m-Qr7L*uFiT5e-IVHZQ#C=NSxk9O5!BGHL2IMVPD~$p-D-A7n
zDh+QQP~tC2q;Xw|DrnE&*gn$Fzg40wAiciw$+O#YR%+;|WnHPXb|Ubb(4CfXBp*7~
zEp*{M=l3@8ln)AP>-$R6FGE@{hrB(w!t~xjrxU4F(Qv!u?F@CAciE$vlV1*6iW$5}
zrXGV*aeFwsO|teSRHXW@pLbvdIt+74$+hYw@cca-q$50eHl&5BvZKVUSCksG`E2Xx&V;xwbl
zo8%iiDur~~F&wHtTK49WTg62W
zyt>$6Z4>hA^UB7L1aFONo40D_dS{b@_PQ5{@=ouZE@oL3PoRCzr`N-1Ow>Cpo%S8H
z_|dqE3b(F-$pXS>#~wmatMbO~FnN`=W+YeEd9d&+v}IGd_pN^&qtl@RIWhpp6m>T^
z%bNc+4Wn`LNiGpNhWyIv0K~c=GV)ueG0Wk6pGu6!*l5LT$+cf~zm%+doU4CPJ+fhJ
z{I}!u*w*^(Ql(CFavWP=M&RQU)(C8U>~;B3j4ycVksb#G2?xXAe~wZl0u1}(h7okA
z$shm>mJVUG#{Dk;-9ST9%rY><*v}sO+fO@o)nH(VzMTifR-A?7e@4{#3Q#$U+xT~!0>$M_mtf)rP{zK(B*LHomy-nv3u_r5LH`5RH>%YD
diff --git a/tests/testthat/_snaps/elev.md b/tests/testthat/_snaps/elev.md
index 4798e46..42715bc 100644
--- a/tests/testthat/_snaps/elev.md
+++ b/tests/testthat/_snaps/elev.md
@@ -3,7 +3,8 @@
Code
elev(tmp_dir, sea, "GEOdata", quiet = TRUE)
Warning
- Coordinate reference system not specified; assuming EPSG:4326
- Could not download srtm_12_24: HTTP status 404
+ Coordinate reference system not specified; assuming WGS84
+ Could not download srtm__: HTTP status 404
Error
No data downloaded.
+
diff --git a/tests/testthat/expected/island_srtm_py.tif b/tests/testthat/expected/island_srtm_py.tif
new file mode 100644
index 0000000000000000000000000000000000000000..ccea4e98f1b9ddb2a41313e8e29901c0db51ebcd
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