Skip to content

Commit

Permalink
new functionalities #4 item10 + #5 Introducing slice causes a long e…
Browse files Browse the repository at this point in the history
…rror in testthat()
  • Loading branch information
hurielreichel committed Feb 19, 2023
1 parent 819ee8e commit 8880354
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 36 deletions.
4 changes: 2 additions & 2 deletions R/datacube.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#' tidyopeneo and you want to come back to use tidyopeneo functions.
#' @export
datacube=function(id, data = NULL,
.p = openeo::processes(.con),
.con = openeo::connect("https://openeo.cloud")){
.p = openeo::processes(.con),
.con = NULL){

if (is.null(id) & !is.null(data)){
class(data) = c("datacube", class(data)) # Class definition
Expand Down
3 changes: 2 additions & 1 deletion R/filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#' library(tidyopeneo)
#' library(sf)
#'
#' con = connect(host = "https://openeo.cloud")
#' dc = datacube(id = "SENTINEL_5P_L2")
#'
#' # filter_temporal and filter_bbox
Expand All @@ -64,7 +65,7 @@
filter.datacube <- function(.data = NULL, ...,
.condition = NULL, .dimension = NULL, .context = NULL,
.extent = NULL, .geometries = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
4 changes: 2 additions & 2 deletions R/group_by.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#' @examples
#' library(tidyopeneo)
#' library(sf)
#'
#' con = connect(host = "https://openeo.cloud")
#' # bounding box
#' w = 6.09
#' s = 46.15
Expand Down Expand Up @@ -130,7 +130,7 @@ group_by.datacube <- function(.data = NULL, ..., .period = NULL, .reducer = NULL
.dimension = NULL, .context = NULL,
.geometries = NULL, .target_dimension = "result",
.intervals = NULL, .labels = array(),
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
4 changes: 2 additions & 2 deletions R/mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
#' @importFrom dplyr mutate
#' @examples
#' library(tidyopeneo)
#'
#' con = connect(host = "https://openeo.cloud")
#' dc = datacube(id = "SENTINEL_5P_L2")
#'
#' # apply
Expand Down Expand Up @@ -114,7 +114,7 @@ mutate.datacube <- function(.data = NULL, ...,
.kernel = NULL, .factor = 1, .border = 0,
.replace_invalid = 0, .dimension = NULL, .target_dimension = NULL,
.size = NULL, .overlap = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
3 changes: 2 additions & 1 deletion R/rename.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' @importFrom dplyr rename
#' @examples
#' library(tidyopeneo)
#' con = connect(host = "https://openeo.cloud")
#'
#' # bounding box
#' w = 6.09
Expand All @@ -35,7 +36,7 @@
#' rename(.source = "spatial", .target = "space")
#' @export
rename.datacube <- function(.data = NULL, ..., .source, .target,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
5 changes: 3 additions & 2 deletions R/resample.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#' @import dplyr openeo cli
#' @examples
#' library(tidyopeneo)
#' con = connect(host = "https://openeo.cloud")
#'
#' # bounding box
#' w = 6.09
Expand All @@ -84,7 +85,7 @@ resample <- function(.data = NULL, .resolution = 0, .projection = NULL,
.method = "near", .align = "upper-left",
.target = NULL, .dimension = NULL,
.valid_within = NULL, .target_process = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {
UseMethod("resample")
}

Expand All @@ -94,7 +95,7 @@ resample.datacube <- function(.data = NULL, .resolution = 0, .projection = NULL,
.method = "near", .align = "upper-left",
.target = NULL, .dimension = NULL,
.valid_within = NULL, .target_process = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

# check mandatory argument
if (is.null(.data)) {
Expand Down
3 changes: 2 additions & 1 deletion R/select.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
#' @importFrom dplyr select
#' @examples
#' library(tidyopeneo)
#' con = connect(host = "https://openeo.cloud")
#' dc = datacube(id = "SENTINEL_5P_L2")
#'
#' dc_no2 <- dc %>% select(.bands = "NO2")
#' @export
select.datacube <- function(.data = NULL, ...,
.bands = NULL, .wavelength = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {


#check dots ...
Expand Down
3 changes: 2 additions & 1 deletion R/slice.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#' @importFrom methods as
#' @examples
#' library(tidyopeneo)
#' con = connect(host = "https://openeo.cloud")
#'
#' dc = datacube("TERRASCOPE_S5P_L3_NO2_TD_V1")
#'
Expand All @@ -45,7 +46,7 @@
#' @export
slice.datacube <- function(.data = NULL, ...,
n = 1, prop = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")){
.p = openeo::processes(.con), .con = NULL){

#check dots ...
dots = list(...)
Expand Down
4 changes: 2 additions & 2 deletions R/summarise.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @seealso [openeo::list_processes()]
#' @examples
#' library(tidyopeneo)
#'
#' con = connect(host = "https://openeo.cloud")
#' # bounding box
#' w = 6.09
#' s = 46.15
Expand All @@ -39,7 +39,7 @@
#' @export
summarise.datacube <- function(.data = NULL, ..., .reducer = NULL,
.dimension = NULL, .context = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
3 changes: 2 additions & 1 deletion R/summarize.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#' @seealso [openeo::list_processes()]
#' @examples
#' library(tidyopeneo)
#' con = connect(host = "https://openeo.cloud")
#'
#' # bounding box
#' w = 6.09
Expand All @@ -39,7 +40,7 @@
#' @export
summarize.datacube <- function(.data = NULL, ..., .reducer = NULL,
.dimension = NULL, .context = NULL,
.p = openeo::processes(.con), .con = openeo::connect("https://openeo.cloud")) {
.p = openeo::processes(.con), .con = NULL) {

#check dots ...
dots = list(...)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Example with NDVI

![NDVI Example](fig/ndvi-example.jpeg)
![NDVI Example](doc/ndvi-example.jpeg)
Binary file removed fig/ndvi-example.jpeg
Binary file not shown.
7 changes: 1 addition & 6 deletions man/datacube.Rd

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

3 changes: 2 additions & 1 deletion man/filter.Rd

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

4 changes: 2 additions & 2 deletions man/group_by.Rd

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

4 changes: 2 additions & 2 deletions man/mutate.Rd

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

3 changes: 2 additions & 1 deletion man/rename.Rd

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

5 changes: 3 additions & 2 deletions man/resample.Rd

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

3 changes: 2 additions & 1 deletion man/select.Rd

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

3 changes: 2 additions & 1 deletion man/slice.Rd

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

4 changes: 2 additions & 2 deletions man/summarise.Rd

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

3 changes: 2 additions & 1 deletion man/summarize.Rd

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

2 changes: 1 addition & 1 deletion vignettes/my-vignette.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The **tidyopeneo** package was created with the intention to make the [openeo](h
```{r processes, echo=TRUE}
library(openeo)
con = con = connect(host = "https://openeo.cloud")
con = connect(host = "https://openeo.cloud")
p = processes()
dc = p$load_collection(
Expand Down

0 comments on commit 8880354

Please sign in to comment.