Skip to content

Commit a657d6c

Browse files
committed
working /test/
1 parent 5c88eca commit a657d6c

File tree

6 files changed

+13
-130
lines changed

6 files changed

+13
-130
lines changed

R/ee_as_sf.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ ee_fc_to_sf_getInfo_batch <- function(x_fc, dsn, maxFeatures, overwrite, quiet)
342342
suppressWarnings(
343343
sf::st_write(local_sf, dsn, delete_dsn = overwrite, quiet = TRUE)
344344
)
345+
local_sf
345346
} else {
346347
crs_sf <- x_fc %>%
347348
ee$FeatureCollection$geometry() %>%

tests/testthat/test-download.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test_that("GEOTIFF_DRIVE", {
7474
metadata = TRUE,
7575
dsn = tempfile()
7676
)
77-
expect_is(img, "character")
77+
expect_is(img, "list")
7878
})
7979

8080
# # 2. CTFRECORD_IMAGE - DRIVE
@@ -341,7 +341,7 @@ test_that("KMZ_VECTOR_GCS",{
341341
vector <- ee_gcs_to_local(task = task_vector,
342342
public = TRUE,
343343
metadata = TRUE)
344-
expect_is(vector, "character")
344+
expect_is(vector, "list")
345345
})
346346

347347
# # 18. GEOJSON_VECTOR - GCS
@@ -358,7 +358,7 @@ test_that("GEOJSON_VECTOR_GCS",{
358358
vector <- ee_gcs_to_local(task = task_vector,
359359
public = TRUE,
360360
metadata = TRUE)
361-
expect_is(vector, "character")
361+
expect_is(vector, "list")
362362
})
363363
# # 19. CTFRECORD_VECTOR - GCS
364364
# test_that("CTFRECORD_VECTOR_GCS",{

tests/testthat/test-ee_extract.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ filename <- system.file("external/lux.shp", package="raster")
77
terraclimate_raw <- ee$ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")
88
terraclimate <- ee$ImageCollection("IDAHO_EPSCOR/TERRACLIMATE")$
99
filterDate("2000-01-01", "2001-01-01")$
10-
map(function(x) x$select("pr")$reproject("EPSG:4326"))
10+
map(function(x) x$select("pr"))
1111
nc <- st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE) %>%
1212
st_transform(4326)
1313

@@ -16,15 +16,15 @@ test_that("ee_extract ee$ImageCollection",{
1616
y = nc,
1717
fun = ee$Reducer$max(),
1818
sf = TRUE)
19-
expect_equal(mean(ee_nc_rain$X200012), 50.47)
19+
expect_equal(mean(ee_nc_rain$pr), 124.87)
2020
})
2121

2222
test_that("ee_extract ee$Image",{
2323
ee_nc_rain <- ee_extract(x = terraclimate$toBands(),
2424
y = sf_as_ee(nc),
2525
fun = ee$Reducer$max(),
2626
sf = TRUE)
27-
expect_equal(mean(ee_nc_rain$X200012_pr), 50.47)
27+
expect_equal(mean(ee_nc_rain$pr), 124.87)
2828
})
2929

3030
test_that("ee_extract - error ",{

tests/testthat/test-ee_image.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,6 @@ test_that("ee_as_stars - simple ", {
114114
# expect_type(ee_image_03,'character')
115115
# })
116116

117-
test_that("ee_as_raster", {
118-
img_01 <- ee_as_raster(
119-
image = image_srtm,
120-
region = geometry,
121-
scale = 10,
122-
via = "getInfo"
123-
)
124-
expect_s4_class(img_01, "RasterStack")
125-
})
126-
127117
# world image thumbnail -----------------------------------------------
128118
region <- ee$Geometry$Rectangle(
129119
coords = c(-180,-60,180,60),
@@ -158,7 +148,6 @@ test_that("ee_image_local error 1", {
158148
}
159149
)
160150

161-
162151
test_that("ee_image_local error 2", {
163152
expect_error(
164153
rgee:::ee_image_local(

tests/testthat/test-imagecollection.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ test_that("ee_imagecollection_to_local - simple dsn", {
2121
dsn = tmp,
2222
quiet = TRUE
2323
)
24-
raster(ic_getinfo_files[1])
25-
expect_type(ic_getinfo_files, "character")
24+
raster(ic_getinfo_files[[1]]$dsn)
25+
expect_type(ic_getinfo_files, "list")
2626
}
2727
)
2828

@@ -34,7 +34,7 @@ test_that("ee_imagecollection_to_local - simple dsn", {
3434
dsn = file.path(tmp, "drive_"),
3535
quiet = FALSE
3636
)
37-
expect_type(ic_getinfo_files, "character")
37+
expect_type(ic_getinfo_files, "list")
3838
}
3939
)
4040

@@ -44,13 +44,14 @@ test_that("ee_imagecollection_to_local - simple dsn", {
4444
ic = ic,
4545
scale = 200,
4646
dsn = c("lesly_01.tif", "lesly_02.tif"),
47-
region = geometry
47+
region = geometry,
48+
add_metadata = FALSE
4849
)
4950
ic_getinfo_files <- ee_imagecollection_to_local(
5051
ic = ic,
5152
scale = 200,
5253
region = geometry
5354
)
54-
expect_type(ic_getinfo_files, "character")
55+
expect_type(ic_getinfo_files, "list")
5556
}
5657
)

tests/testthat/test-search.R

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)