GithubHelp home page GithubHelp logo

tidyopeneo's Issues

new functionalities

  • 1. pass .p and .con as function parameters as in Edzer's commit.
  • 2. group_by + summarise behaviour {if data cude is grouped, or not, different interactions} - add new subclass for that and therefore a (sub)method.
  • 3. pass what slice does to filter.
  • 4. year %in% (2000:2002) / group_by(year, month) [use list_connection()$extent as reference
  • 5. check mandatory params -> is.null() stop()
  • 6. "datacube" should be the first in the list of inherits(), not last
  • 7. Maths and Ops Math.datacube = function(x, ...) { p = openeo::processes(); p[.Generic] }
  • 8. Add examples for all functions + add them to the vignette
  • 9. create slice interaction more similar dplyr slice
  • 10. remove default con from all function... speed up code.

NOTEs when running check

❯ checking for future file timestamps ... NOTE
unable to verify current time

❯ checking R code for possible problems ... [12s/10s] NOTE
filter.datacube: no visible binding for global variable ‘.’
Undefined global functions or variables:
.

@edzerpebesma comments

  • create a select for bands
  • improve operation : simplify
  • Do not mask from dplyr
  • change group_by function so it can have either a reducer string (e.g. "mean") or keep as it is
  • change package name
  • three dots
  • group_by process operations

Introducing slice causes a long error in testthat()

----------- FAILURE REPORT --------------
--- failure: length > 1 in coercion to logical ---
--- srcref ---
:
--- package (from environment) ---
openeo
--- call from context ---
FUN(X[[i]], ...)
--- call from argument ---
is.environment(value) || !is.na(value)
--- R stacktrace ---
where 1: FUN(X[[i]], ...)
where 2: lapply(node$parameters, function(param) {
value = param$getValue()
if (length(value) > 0 && (is.environment(value) || !is.na(value))) {
if ("Graph" %in% class(value)) {
return(value$getVariables())
}
else if ("ProcessGraphParameter" %in% class(value) &&
length(value$getProcess()) == 0) {
return(value)
}
else if (is.list(value)) {
return(lapply(value, function(array_elem) {
if ("ProcessGraphParameter" %in% class(array_elem) &&
length(array_elem$getProcess()) == 0) {
return(array_elem)
}
return(NULL)
}))
}
}
return(NULL)
})
where 3: FUN(X[[i]], ...)
where 4: lapply(used_nodes, function(node) {
node_variables = lapply(node$parameters, function(param) {
value = param$getValue()
if (length(value) > 0 && (is.environment(value) || !is.na(value))) {
if ("Graph" %in% class(value)) {
return(value$getVariables())
}
else if ("ProcessGraphParameter" %in% class(value) &&
length(value$getProcess()) == 0) {
return(value)
}
else if (is.list(value)) {
return(lapply(value, function(array_elem) {
if ("ProcessGraphParameter" %in% class(array_elem) &&
length(array_elem$getProcess()) == 0) {
return(array_elem)
}
return(NULL)
}))
}
}
return(NULL)
})
})
where 5: variables(final_node)
where 6: doTryCatch(return(expr), name, parentenv, handler)
where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 8: tryCatchList(expr, classes, parentenv, handlers)
where 9: tryCatch({
private$variables = variables(final_node)
}, error = function(e) {
})
where 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, classes, parentenv, handlers)
where 13: tryCatch({
con = .assure_connection(con)
if (is.null(final_node)) {
stop("The final node (endpoint of the graph) has to be set.")
}
if ("ProcessNode" %in% class(final_node)) {
node_list = .final_node_serializer(final_node)
private$nodes = unname(node_list)
private$final_node_id = final_node$getNodeId()
tryCatch({
private$variables = variables(final_node)
}, error = function(e) {
})
}
else {
stop("The final node has to be a ProcessNode.")
}
invisible(self)
}, error = .capturedErrorToMessage)
where 14: initialize(...)
where 15: Graph$new(final_node = from)
where 16: asMethod(object)
where 17: as(process_graph, "Graph")
where 18: self$setProcessGraph(process_graph = process_graph)
where 19: initialize(...)
where 20: Process$new(id = NULL, process_graph = from)
where 21: asMethod(object)
where 22: as(., "Process")
where 23: openeo::toJSON(.)
where 24: rjson::fromJSON(.)
where 25: withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
where 26: suppressWarnings(.)
where 27: .p$save_result(data = .data, format = list_file_formats()$output$JSON) %>%
as("Process") %>% openeo::toJSON() %>% rjson::fromJSON() %>%
suppressWarnings()
where 28: slice.datacube(., n = 10)
where 29: slice(., n = 10)
where 30 at test-slice.R#4: dc %>% filter(.extent = c("2021-01-01", "2021-03-03")) %>% slice(n = 10)
where 31: eval(code, test_env)
where 32: eval(code, test_env)
where 33: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 34: doTryCatch(return(expr), name, parentenv, handler)
where 35: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 36: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 37: doTryCatch(return(expr), name, parentenv, handler)
where 38: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 39: tryCatchList(expr, classes, parentenv, handlers)
where 40: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 41: test_code(desc, code, env = parent.frame(), reporter = reporter)
where 42 at test-slice.R#1: test_that("slice creates object of class 'datacube'", {
dc = datacube(id = "SENTINEL_5P_L2")
dc_1 = dc %>% filter(.extent = c("2021-01-01", "2021-03-03")) %>%
slice(n = 10)
dc_2 = dc %>% filter(.extent = c("2021-01-01", "2021-03-03")) %>%
slice(n = -5)
dc_3 = dc %>% filter(.extent = c("2021-01-01", "2021-03-03")) %>%
slice(prop = 0.55)
dc_4 = dc %>% filter(.extent = c("2021-01-01", "2021-03-03")) %>%
slice(prop = -0.3)
expect_equal(all(inherits(dc_1, "datacube"), inherits(dc_1,
"ProcessNode"), inherits(dc_2, "datacube"), inherits(dc_2,
"ProcessNode"), inherits(dc_3, "datacube"), inherits(dc_3,
"ProcessNode"), inherits(dc_4, "datacube"), inherits(dc_4,
"ProcessNode")), TRUE)
})
where 43: eval(code, test_env)
where 44: eval(code, test_env)
where 45: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 46: doTryCatch(return(expr), name, parentenv, handler)
where 47: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 48: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 49: doTryCatch(return(expr), name, parentenv, handler)
where 50: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 51: tryCatchList(expr, classes, parentenv, handlers)
where 52: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 53: test_code(NULL, exprs, env)
where 54: source_file(path, child_env(env), wrap = wrap)
where 55: FUN(X[[i]], ...)
where 56: lapply(test_paths, test_one_file, env = env, wrap = wrap)
where 57: doTryCatch(return(expr), name, parentenv, handler)
where 58: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 59: tryCatchList(expr, classes, parentenv, handlers)
where 60: tryCatch(code, testthat_abort_reporter = function(cnd) {
cat(conditionMessage(cnd), "\n")
NULL
})
where 61: with_reporter(reporters$multi, lapply(test_paths, test_one_file,
env = env, wrap = wrap))
where 62: test_files(test_dir = test_dir, test_package = test_package,
test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,
env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap, load_package = load_package)
where 63: test_files(test_dir = path, test_paths = test_paths, test_package = package,
reporter = reporter, load_helpers = load_helpers, env = env,
stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap, load_package = load_package, parallel = parallel)
where 64: test_dir("testthat", package = package, reporter = reporter,
..., load_package = "installed")
where 65: test_check("tidyopeneo")

--- value of length: 2 type: logical ---
[1] TRUE TRUE
--- function from context ---
function (param)
{
value = param$getValue()
if (length(value) > 0 && (is.environment(value) || !is.na(value))) {
if ("Graph" %in% class(value)) {
return(value$getVariables())
}
else if ("ProcessGraphParameter" %in% class(value) &&
length(value$getProcess()) == 0) {
return(value)
}
else if (is.list(value)) {
return(lapply(value, function(array_elem) {
if ("ProcessGraphParameter" %in% class(array_elem) &&
length(array_elem$getProcess()) == 0) {
return(array_elem)
}
return(NULL)
}))
}
}
return(NULL)
}
<bytecode: 0x55e111abcbd0>
<environment: 0x55e112297000>
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Fatal error: length > 1 in coercion to logical

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.