Skip to content

Commit

Permalink
Cleanup for winbuilder
Browse files Browse the repository at this point in the history
 - Spellcheck

 - Update .Rbuildignore

 - Docs

 - Safely initialize in tests
  • Loading branch information
brownag committed Nov 1, 2022
1 parent c45ad14 commit 772321f
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 13 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
$\.github/*
^\.github$
^misc$
^cran-comments\.md$
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Maintainer: Andrew Brown <[email protected]>
URL: https://humus.rocks/rgeedim/, https://github.com/brownag/rgeedim, https://geedim.readthedocs.io/
BugReports: https://github.com/brownag/rgeedim/issues
Description: Search, composite, and download Google Earth Engine imagery with 'reticulate' bindings for the Python module 'geedim'.
rgeedim provides wrapper functions that make it more convenient to use `geedim` to download images larger than the Earth Engine size limit.
Wrapper functions are provided to make it more convenient to use 'geedim' to download images larger than the Earth Engine size limit.
Config/reticulate:
list(
packages = list(
Expand All @@ -16,11 +16,12 @@ Config/reticulate:
)
)
License: Apache License (>= 2)
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
Imports: utils, methods, reticulate, jsonlite
Suggests: terra, raster, tinytest, knitr, rmarkdown
Depends: R (>= 4.1)
Depends: R (>= 3.5)
Encoding: UTF-8
LazyData: false
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# rgeedim 0.0.0.9007

* Added helper functions for enums: `gd_resampling_methods()`, `gd_composite_methods()`, `gd_cloud_mask_methods()`
* Fix for enum helper functions `gd_resampling_methods()`, `gd_composite_methods()`, `gd_cloud_mask_methods()` to return values rather than names

* `gd_download()` now supports path expansion for `filename` argument

Expand Down
2 changes: 1 addition & 1 deletion R/AAAA.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gd_ee_version <- function() {

if (is.null(gd)) {
try(gd <<- reticulate::import("geedim", delay_load = TRUE), silent = TRUE)
if (is.null(ee)) {
if (length(gd) > 0) {
try(ee <<- gd$utils$ee, silent = TRUE)
}
}
Expand Down
11 changes: 10 additions & 1 deletion R/hello.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ gd_initialize <- function(private_key_file = NULL, opt_url = 'https://earthengin
}
}
if (!is.null(ek) && length(ek) == 1) {

if (file.exists(ek) && grepl("\\.json$", ek[1], ignore.case = TRUE)) {
kd <- jsonlite::read_json(ek)
} else {
kd <- jsonlite::parse_json(ek)
}
sac <- ee$ServiceAccountCredentials(kd[['client_email']], key_data = kd[['private_key']])

sac <- try(ee$ServiceAccountCredentials(kd[['client_email']],
key_data = kd[['private_key']]),
silent = quiet)

if (inherits(sac, 'try-error')) {
return(invisible(sac))
}

return(invisible(try(ee$Initialize(sac, opt_url = opt_url), silent = quiet)))
} else {
return(invisible(try(ee$Initialize(opt_url = opt_url), silent = quiet)))
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ z <- x |>
plot(rast(z)[[1:4]])
```

The `"q-mosaic"` method produces a composite largely free of artefacts; this is because it prioritizes pixels with higher distance from clouds.
The `"q-mosaic"` method produces a composite largely free of artifacts; this is because it prioritizes pixels with higher distance from clouds.

```{r include=FALSE}
unlink('image.tif')
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ expressed in WGS84 decimal degrees (`"OGC:CRS84"`).

``` r
library(rgeedim)
#> rgeedim v0.1.0 -- using geedim 1.5.3 w/ earthengine-api 0.1.328
#> rgeedim v0.1.0 -- using geedim 1.5.3 w/ earthengine-api 0.1.329
```

If this is your first time using any Google Earth Engine tools,
Expand Down Expand Up @@ -329,5 +329,5 @@ plot(rast(z)[[1:4]])

<img src="man/figures/README-unnamed-chunk-7-2.png" width="100%" />

The `"q-mosaic"` method produces a composite largely free of artefacts;
The `"q-mosaic"` method produces a composite largely free of artifacts;
this is because it prioritizes pixels with higher distance from clouds.
53 changes: 53 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Albers
Authenticator
CLI
CMD
CSP
Christoph
CloudMaskMethod
CompositeMethod
ERGo
Enum
Enums
GeoJSON
GeoTIFF
Gohlke
Hillshade
Insolation
JSON
LiDAR
Miniconda
NAD
RStudio
RasterLayer
RasterStack
ResamplingMethod
SRTM
STAC
SpatExtent
SpatRaster
SpatVector
USGS
WGS
WKT
artefacts
codecov
conda
edu
enums
geedim
gohlke
hillshade
https
lfd
pythonlibs
reticulate
sp
terra
uci
verifier
www
xmax
xmin
ymax
ymin
11 changes: 7 additions & 4 deletions inst/tinytest/test_rgeedim.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## we are assuming gd_authenticate() has been called or otherwise set up

# init modules
gi <- gd_initialize()
if (length(earthengine()) > 0) {
# we are assuming gd_authenticate() has been called / set up
# such that we can init modules and begin using them
gi <- gd_initialize()
} else {
gi <- try(stop("earthengine-api not available"), silent = TRUE)
}

.testbounds <- c(
xmin = 5.744140,
Expand Down
2 changes: 1 addition & 1 deletion man/rgeedim-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 772321f

Please sign in to comment.