unable to get sen2r function working, some arguments missing? - r

I am trying to use to sen2r() function (Package sen2r_1.3.2) with default parameters but getting the following error:
Error in paste(c(...), collapse = sep) : argument is missing, with no default.
I know the error wants me to fill in some parameters, but the source manual clearly says that the default should work, and the parameters can be set subsequently upon launching the GUI.
Using the s2_gui() launches the shiny app, but keeps hanging when I try to "Save and Close"
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
Also, can someone with a 'higher reputation' please create a sen2r tag, for easier subsequent communications?
Here is the traceback...
sen2r()
Error in paste(c(...), collapse = sep) :
argument is missing, with no default
> traceback()
7: paste(c(...), collapse = sep)
6: strsplit(paste(c(...), collapse = sep), "\n")
5: unlist(strsplit(paste(c(...), collapse = sep), "\n"))
4: strwrap(unlist(strsplit(paste(c(...), collapse = sep), "\n")),
width = width, indent = indent, exdent = exdent, prefix = prefix,
initial = initial)
3: print_message(type = "waiting", "It seems you are running this package for the first time. ",
"Do you want to verify/install the required dependencies using a GUI (otherwise, an\n automatic check will be performed)? (y/n) ",
)
2: .sen2r(param_list = param_list, pm_arg_passed = pm_arg_passed,
gui = gui, preprocess = preprocess, s2_levels = s2_levels,
sel_sensor = sel_sensor, online = online, order_lta = order_lta,
apihub = apihub, downloader = downloader, overwrite_safe = overwrite_safe,
rm_safe = rm_safe, step_atmcorr = step_atmcorr, sen2cor_use_dem = sen2cor_use_dem,
sen2cor_gipp = sen2cor_gipp, max_cloud_safe = max_cloud_safe,
timewindow = timewindow, timeperiod = timeperiod, extent = extent,
extent_name = extent_name, s2tiles_selected = s2tiles_selected,
s2orbits_selected = s2orbits_selected, list_prods = list_prods,
list_rgb = list_rgb, list_indices = list_indices, index_source = index_source,
rgb_ranges = rgb_ranges, mask_type = mask_type, max_mask = max_mask,
mask_smooth = mask_smooth, mask_buffer = mask_buffer, clip_on_extent = clip_on_extent,
extent_as_mask = extent_as_mask, reference_path = reference_path,
res = res, res_s2 = res_s2, unit = unit, proj = proj, resampling = resampling,
resampling_scl = resampling_scl, outformat = outformat, rgb_outformat = rgb_outformat,
index_datatype = index_datatype, compression = compression,
rgb_compression = rgb_compression, overwrite = overwrite,
path_l1c = path_l1c, path_l2a = path_l2a, path_tiles = path_tiles,
path_merged = path_merged, path_out = path_out, path_rgb = path_rgb,
path_indices = path_indices, path_subdirs = path_subdirs,
thumbnails = thumbnails, parallel = parallel, processing_order = processing_order,
use_python = use_python, tmpdir = tmpdir, rmtmp = rmtmp,
log = log, globenv = sen2r_env, .only_list_names = FALSE)
1: sen2r()
I ran s2_gui() as is...no parameters specified. But i am running the dependency check now, I suspect that should clear things up even for the GUI.

This error was due to a code bug, which was fixed (see the GitHub issue 292).
Until the sen2r CRAN version will be updated, the bug can be:
solved installling the sen2r GitHub version (remotes::install_github("ranghetti/sen2r")), or
bypassed launching check_gdal() before running sen2r().

This is a bug in the original code.
In the traceback that you provided, it included:
3: print_message(type = "waiting", "It seems you are running this package for the first time. ",
"Do you want to verify/install the required dependencies using a GUI (otherwise, an\n automatic check will be performed)? (y/n) ",
)
Notably, I'll truncate most of the strings:
3: print_message(type = "waiting", "It seems ... time. ",
"Do you ... performed)? (y/n) ",
) # ^-- extra comma, invalid R syntax
Notice how it ends with a comma and then a right-paren? Yup, that's a syntax error in R. (This has been submitted as issue 292 on the original repo.)

Related

How to solve R future error "error in future$uuid : object of type closure is not subsettable"

When trying to register a future with a parallel backend in R, I receive the following error message:
Error in future$uuid : object of type 'closure' is not subsettable
Previously using future has always been fine.
My code:
# Previously installed future, doFuture, parallel and doParallel packages
library(future)
library(doFuture)
registerDoFuture()
no.clusters = max(detectCores()-4,1)
cl = parallel::makeCluster(no.clusters)
plan(cluster, workers = cl)
The error occurs when running the plan command. Restarting RStudio solves the issue for one run, but running the code a second time in the same session causes the error. Obviously, I'd prefer not having to restart RStudio and import all the data etc. every time I want to use the parallel programming, so help would be appreciated
Traceback:
16: FutureCondition(message = message, call = call, uuid = uuid,
future = future)
15: FutureError(sprintf("Cannot resolve %s (%s), because the connection to the worker is corrupt: %s",
class(x)[1], label, attr(isValid, "reason", exact = TRUE)),
future = future)
14: stop(FutureError(sprintf("Cannot resolve %s (%s), because the connection to the worker is corrupt: %s",
class(x)[1], label, attr(isValid, "reason", exact = TRUE)),
future = future))
13: resolved.ClusterFuture(future, run = FALSE)
12: resolved(future, run = FALSE)
11: collectValues(where, futures = futures, firstOnly = TRUE)
10: FutureRegistry(reg, action = "collect-first", earlySignal = TRUE)
9: await()
8: requestNode(await = function() {
FutureRegistry(reg, action = "collect-first", earlySignal = TRUE)
}, workers = workers)
7: run.ClusterFuture(future)
6: run(future)
5: strategy(..., envir = envir, workers = workers)
4: evaluator(NA, label = "future-plan-test", globals = FALSE, lazy = FALSE)
3: plan_init()
2: plan_set(newStack, skip = .skip, cleanup = .cleanup, init = .init)
1: plan(cluster, workers = cl)

How to fix Error in CellChat <- netEmbedding(cellchat, type = "functional") / UMAP Problems?

This is regarding "Manifold and Classification learning analysis of signalling networks" in the [full tutorial/vignette][1].
I installed umap and it seems to run fine like this:
[Installing UMAP, a Python Package occurs successfully][2]
library(reticulate)
use_python("/Users/soumyasharma/opt/anaconda3/bin/python")
UMAP<-import("umap", convert = FALSE)
This command: cellchat <- computeNetSimilarity(cellchat, type = "functional") also seems to run well.
However: at the following command there is an error as displayed in the screenshot.
```library("CellChat") #https://github.com/sqjin/CellChat
cellchat <- netEmbedding(cellchat, type = "functional")```
[screenshot of error seen][3]
9.
stop(structure(list(message = "AttributeError: module 'umap' has no attribute 'UMAP'", call = py_get_attr_impl(x, name, silent), cppstack = structure(list( file = "", line = -1L, stack = c("1 reticulate.so 0x0000000112ee105e _ZN4Rcpp9exceptionC2EPKcb + 222", "2 reticulate.so 0x0000000112ee96a5 _ZN4Rcpp4stopERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 53", ...
8.
py_get_attr_impl(x, name, silent)
7.
py_get_attr(x, name)
6.
py_get_attr_or_item(x, name, TRUE)
5.
`$.python.builtin.object`(x, name)
4.
`$.python.builtin.module`(umap_import, "UMAP")
3.
umap_import$UMAP
2.
runUMAP(Similarity, min.dist = 0.3, n.neighbors = k)
1.
netEmbedding(cellchat, type = "functional")```
Can you please help me troubleshoot this?
[1]: https://htmlpreview.github.io/?https://github.com/sqjin/CellChat/blob/master/tutorial/CellChat-vignette.html
[2]: https://i.stack.imgur.com/QjLqT.png
[3]: https://i.stack.imgur.com/uoar6.png

exams2openolat: shufflesections and navigation do not work

I run the following command from the exams2openolat() video tutorial for summative online exams using R/exams
exams2openolat(exm, n = 50, name = "R-exams-OpenOLAT",
points = 1, maxattempts = 0, cutvalue = 2, solutionswitch = FALSE,
duration = 60, shufflesections = TRUE, navigation = "linear",
stitle = names(exm), ititle = "Question", adescription = "", sdescription = "")
and get the error
## Error in rmarkdown::pandoc_convert(input = infile, output = outfile, from = from, :
## unused Arguments (shufflesections = TRUE, navigation = "linear")
When I leave the two arguments out, it works fine. In the YouTube tutorial the command also works with the two arguments.
The two arguments have been introduced in version 2.4-0 of the package which was still the development version when the question was asked.
This point along with a few other details are explained in a blog post that accompanies the YouTube tutorial: http://www.R-exams.org/tutorials/openolat_exam/

Error return from the MODISSummaries function (R package MODISTools)

Does anyone know how to handle this error? It occurs both on my PC ("Windows" "7 x64" "build 7601, Service Pack 1" "x86-64") and Mac ("Darwin" "Darwin" "12.5.0" "Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64")
library(MODISTools)
data(SubsetExample)
MODISSubsets(LoadDat = SubsetExample, Products = "MOD13Q1", Bands = c("250m_16_days_EVI",
"250m_16_days_pixel_reliability"), Size = c(0,0), StartDate = TRUE)
MODISSummaries(LoadDat = SubsetExample, Product = "MOD13Q1", Bands = "250m_16_days_EVI",
ValidRange = c(-2000,10000), NoDataFill = -3000, ScaleFactor = 0.0001,
StartDate = TRUE, QualityScreen = TRUE, QualityThreshold = 0,
QualityBand = "250m_16_days_pixel_reliability")
Error:
Error in matrix(band.data.site$mean.band[band.data.site$ID == lat.long$SubsetID[i]], :
non-numeric matrix extent
Thanks for highlighting this bug. I've pushed a fix to my GitHub repository (https://github.com/seantuck12/MODISTools/). I will update the version on CRAN as soon as possible but in the meantime please use the GitHub version.

Hardware convertion : written data is different than my read data

I am testing a program executed partially on a MPC603 and partially on a MPC555.
I have to verify that some data is correctly "moved" from one processor to the other via a DPRAM.
I am guessing that at some point "someone" makes a conversion but I don't know how to find what kind of conversion is done.
Here are some examples:
Pt_Dpram->acq1 at 0x8D00008 = 0x3EB2
acq1 = (0xA010538) = 1182451712 = 0x467AC800
Pt_Dpram->acq2 at 0x8D0000A = 0x5528
acq2 = (0xA010540) = 1185566720 = 0x46AA5000
Pt_Dpram->acq3 at 0x8D0000C = 0x416E
acq3 = (0xA010548) = 1107552036 = 0x4203E724
Pt_Dpram->acq4 at 0x8D0000E = 0x413C
acq4 = (0xA010550) = 1107526232 = 0x42038258
I got my answers from a collegue : the values in acqX are in Motorola binary format : http://en.wikipedia.org/wiki/SREC_(file_format)
Here is a small software that does the conversion : http://www.hexworkshop.com/onlinehelp/500/html/idhelp_baseconv.htm

Resources