project-gen3sis / r-package Goto Github PK
View Code? Open in Web Editor NEWRepository of the R-packageGen3sis
Home Page: https://project-gen3sis.github.io/R-package/
License: GNU General Public License v3.0
Repository of the R-packageGen3sis
Home Page: https://project-gen3sis.github.io/R-package/
License: GNU General Public License v3.0
Impossible to follow the tutorial, since distances matrices are currently not provided with the package. Either provide a line in the vignette to compile these distances or use another landscape as example at the vignette
Reproduce issue:
datapath <- system.file(file.path("extdata", "SouthAmerica"), package="gen3sis")
config_object_old <- create_input_config(file.path(datapath, "config/config_southamerica.R"))
sim_old <- run_simulation(config = config_object_old,
landscape = file.path(datapath, "landscape"),
verbose=0, # no progress printed
output_directory=tempdir())
Example files are running too long for CRAN - shorten or wrap in \donttest{}, see https://cran.r-project.org/web/packages/roxygen2/vignettes/rd.html
Examples with CPU or elapsed time > 5s
user system elapsed
run_simulation 32.379 0.58 33.844
Currently the distance matrices can only be left out or computed fully during the input creation.
We may want to offer calculating partial/full distance matrices from existing inputs.
##1
If there are references describing the methods in your package, please add these in the description field of your DESCRIPTION file in the form authors (year) doi:... authors (year) arXiv:... authors (year, ISBN:...) or if those are not available: https:... with no space after 'doi:', 'arXiv:', 'https:' and angle brackets for auto-linking.
(If you want to add a title as well please put it in quotes: "Title")
##2
Please add \value to .Rd files regarding exported methods and explain the functions results in the documentation. Please write about the structure of the output (class) and also what the output means. (If a function does not return a value, please document that too, e.g.
\value{No return value, called for side effects} or similar) Missing Rd-tags in up to 18 .Rd files, e.g.:
evolution_mode_none.Rd: \value
plot_landscape_overview.Rd: \value
plot_landscape.Rd: \value
plot_ranges.Rd: \value
plot_raster_multiple.Rd: \value
plot_raster_single.Rd: \value
...
##3
Please always make sure to reset to user's options(), working directory or par() after you changed it in examples and vignettes and demos.
e.g.: inst/doc/introduction.R
oldpar <- par(mfrow = c(1,2))
...
par(oldpar)
Please do not modify the .GlobalEnv. This is not allowed by the CRAN policies. e.g.: .Random.seed
##4
Additionally:
Have the issues why your package was archived been fixed?
Please explain this in the submission comments.
inhabited sites should appear in a different color scale in cases where 0 %in% richness
So, I tried to use for the function's argument the list of data frames that I used to produce the rds file before. Then I get this error "unkown landscapes; it has to be a named list of list of either rasters or raster files..."
This means I need to transform my data frames into rasters instead of directly providing a list of data frames that can be directly saved into rds. That seems a bit counterproductive. It would be nice if the function would recognize that the list of landscapes is already in the format necessary to write a .rds.
Meanwhile I have to check how to transform my arrays into raster stacks then so the function can use them.
either by config flag or switch on interactive()?
the plot_richness in the introduction vignette are now showing up anymore
(see lines 233-241 on introduction.Rmd)
I think it has to do with you changes
@ohagen - is there are special reason why we wouldn't put everything in the same vignette?
If you add the following lines to the observer function:
plot_richness(species, landscape)
plot_landscape(landscape)
plot_species_presence(species[[1]], landscape)"
run
run_simulation(config = "./inst/extdata/WorldCenter/config/config_worldcenter.R",
+ landscape = "./inst/extdata/WorldCenter/landscape",
+ call_observer = "all", output_directory = "YOURTEMPDIRHERE")
breaks with error:
[1] "config found: ./inst/extdata/WorldCenter/config/config_worldcenter.R"
[1] "landscape found: ./inst/extdata/WorldCenter/landscape"
[1] "output directory is: C:/temp/config_worldcenter"
Error in rownames(landscape[["coordinates"]]) :
object 'landscape' not found
previously relying on Travis, now we need another solution. Specially if we want to improve collaboration
Hi Oskar,
I just looked at the vignettes because of the CRAN check problems - if you want to push this on CRAN soon, I would clean up the vignettes before. If you have the money, this could also be a work that a student helper with good english could do.
Hi Juliano, this file currently doesn't run, probably due to #24
No problem, but now that we have the CI running, to be able to check the model, it would be better move this file into a new branch, so that we have the master branch clean / can check if everything works fine.
I can do it for you, I just didn't want to do it in case you are currently working on it.
the indexing for the timestep labels on the x-axis is wrong.
line 132-134
axis_lab <- seq(from=1, to=nrow(d), length.out = max((nrow(d)/20),2))
axis(1, at=rev(as.numeric(rownames(d)))[axis_lab], labels = rownames(d)[axis_lab])
mtext(side=1, text="Time steps", line=2.5, cex=1.1)
the "at" uses the row number 0 as starting index. indexing is positional and starts at 1. hence all axis labels are shifted by one to the left
should be present on v1.1
I suspect that this could have something with the new change of the distances in Km to m (1/1000)
When checking -as --cran on R.4.0:
*** checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ...
Running 'testthat.R'
ERROR
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
>
> test_check("gen3sis")
-- 1. Failure: distance matrix creation works (@test-distances.R#26) ---------------------------------------------------------------------------------------
isTRUE(all.equal(unname(dist_m), gdist_m)) isn't true.
-- 2. Failure: get_local_distances works (@test-input_creation.R#134) --------------------------------------------------------------------------------------
isTRUE(all.equal(unname(distance_local), local_tr)) isn't true.
== testthat results ========================================================================================================================================
[ OK: 26 | SKIPPED: 10 | WARNINGS: 0 | FAILED: 2 ]
1. Failure: distance matrix creation works (@test-distances.R#26)
2. Failure: get_local_distances works (@test-input_creation.R#134)
Error: testthat unit tests failed
Execution halted
** running tests for arch 'x64' ...
Running 'testthat.R'
ERROR
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
>
> test_check("gen3sis")
-- 1. Failure: distance matrix creation works (@test-distances.R#26) ---------------------------------------------------------------------------------------
isTRUE(all.equal(unname(dist_m), gdist_m)) isn't true.
-- 2. Failure: get_local_distances works (@test-input_creation.R#134) --------------------------------------------------------------------------------------
isTRUE(all.equal(unname(distance_local), local_tr)) isn't true.
== testthat results ========================================================================================================================================
[ OK: 26 | SKIPPED: 10 | WARNINGS: 0 | FAILED: 2 ]
1. Failure: distance matrix creation works (@test-distances.R#26)
2. Failure: get_local_distances works (@test-input_creation.R#134)
Error: testthat unit tests failed
Execution halted**
The color scheme is very hard to see for people with color blindness especially red-green color blindness like I have. Would it be possible to add a selection argument for the plot function which would optionaly allow color-blind friendly schemes to be used?
The color options of this package https://www.fabiocrameri.ch/colourmaps/ would work very good for colorblind people.
in the internal functions
* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
'examples_i386' 'examples_x64' 'gen3sis-Ex_i386.Rout'
'gen3sis-Ex_x64.Rout' 'tests_i386' 'tests_x64'
The above happens when checking the package.
returning:
Error in matrix(no_data, nrow = nrow(landscape[["coordinates"]]), ncol = ncol(values) + :
non-numeric matrix extent
Called from: matrix(no_data, nrow = nrow(landscape[["coordinates"]]),
ncol = ncol(values) + 2, dimnames = list(rownames(landscape[["coordinates"]]),
c(colnames(landscape[["coordinates"]]), colnames(values))))
Error during wrapup: unimplemented type (29) in 'eval'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Once landscape input is only for a certain environment (e.g. landscape$temp) it returns:
plot_landscape(l$temp)
Error in matrix(no_data, nrow = nrow(landscape[["coordinates"]]), ncol = ncol(values) + :
non-numeric matrix extent
Called from: matrix(no_data, nrow = nrow(landscape[["coordinates"]]),
ncol = ncol(values) + 2, dimnames = list(rownames(landscape[["coordinates"]]),
c(colnames(landscape[["coordinates"]]), colnames(values))))
Error during wrapup: unimplemented type (29) in 'eval'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Error during wrapup: INTEGER() can only be applied to a 'integer', not a 'unknown type #29'
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
changing landscape[["environment"]] does not help.
so that users can have this handy function as well
plot_richness causes gen3sis to crash when called in the observer function when all species have gone extinct.
plot_richness(species, landscape)
Error in (mult * length(col)):1 : NA/NaN argument
In addition: Warning message:
In x[] <- col[x] :
number of items to replace is not a multiple of replacement length
The problem is there is no color in the richness palette for values of 0
max(richness)
[1] 0
color_richness(max(richness, na.rm=TRUE))
[1] character(0)
color_richness(1)
[1] "#440154"
This problem also means colours on a richness plot cannot distinguish between cells with 1 species and cells with 2 species.
Currently the habitability mask in the input creation overrides the habitable cells in the landscape rasters. This is going to be inconsistent with NA-cells in the input rasters as these are used to determine habitable cells during the simulation run.
I think a better/more intuitive way would be to use the habitability mask in addition to the landscapes, as such that for example it allows to limit the world to a smaller extract.
fyi, I have activated the project page, which displays the content of the readme.md file here https://project-gen3sis.github.io/R-package/
The readme is at the moment not very helpful to the user. Would suggest to add info for how to install etc. similar to here http://florianhartig.github.io/DHARMa/ or whatever you think is most suitable.
currently the species id and it's index in the species list match, nevertheless to it is ambiguous to implicitly rely on that for saved states (e.g save_traits)
releases summary files. maybe just a a single file e.g. releases_history.txt? any other idea?
Warning: @return [C:\VITAL LOCAL\Meus Documentos\ETH PhD\Code\R\package\Gen3sis\R\config_handling.R#122]: requires a value
Warning: [/Users/florian/Dropbox/Home/Projekte/Papers_in_Review/19-rGAsm-package/R-package/R/observations.R:146] @example '/Users/florian/Dropbox/Home/Projekte/Papers_in_Review/19-rGAsm-package/R-package/inst/examples/observer_plot_help.R' doesn't exist
-> should I add the file?
checkRd: (5) gen3sis.Rd:0-14: Must have a \description
Returning this NOTE when checked on CRAN:
Relates to the update on Fri, 23 Apr 2021:
https://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2021/04/23#n2021-04-23
CRAN Build feedback:
package gen3sis_1.3.tar.gz does not pass the incoming checks automatically, please see the following pre-tests:
Windows: https://win-builder.r-project.org/incoming_pretest/gen3sis_1.3_20210630_120636/Windows/00check.log
Status: 1 NOTE
Debian: https://win-builder.r-project.org/incoming_pretest/gen3sis_1.3_20210630_120636/Debian/00check.log
Status: 1 NOTE
Related issue forum:
https://stackoverflow.com/questions/66860659/lazydata-is-specified-without-a-data-directory-error-when-submitting-r-packa
I added an example for examples in the help in 1db8808 - will have to populate this for all important functions
Update automated checks with new functions provided by ZHU related to #58
create_input scales from meters to kilometers by multiplying a factor of 1/1000. This only works if a coordinate system is set for the input rasters.
line ~159 in Input_creation.R:
correction@transitionMatrix@x <- (1/1000) / correction@transitionMatrix@x
Should we remove that and tell the user the cost/distances are in meters, if they want kilometers they have to scale their cost function by 1/1000?
one of the richness plots is in the inst/logo folder, should be moved to extdata/southamerica/images
add windows and possibly mac flavours on CI travis
make_summary hardcodes richness_final to
sgen3sis$summary <- c(data$summaries, list("richness-final"=data$geo_richness[,c(1,2,ncol(data$geo_richness))]))
This will be all NAs if the simulation aborts (too many species) or if end_time is not 0.
Subsequently this:
ras <- rasterFromXYZ(output$summary$`richness-final`)
rc <- color_richness(max(ras@data@values, na.rm=TRUE) + 1)
will call max() with an all NA vector which will return -Inf. Of course a colorRampPalette can't produce -Inf many colours and it fails.
Currently there is quite some magic going on trying to divine the config, input, and output paths from partial info when running a simulation. Currently it is a bit inconsistent and intransparent on what is going on. Should we remove all/most of it and instead expect all three to be provided when calling a simulation?
The only part I'd keep is creating a subfolder with the config name in the output path.
(config_handling.R, prepare_directories, lines 16-81)
Hi guys,
just as we talked about the tests - you haven't set up CI tests yet, right? There are at least two options, Travis CI, which I do for DHARMa, and there is a new option directly via GitHub workflows, see an example here https://github.com/TheoreticalEcology/s-jSDM/actions
The advantage of using the workflows is that a) I think it can also be done on a private repo b) it also tests Windows and MacOS. Advantage of TravisCI is that it looks nicer (in my opinion), especially when you work a lot with branches.
Anyway, we should decide for one or the other, this will help a lot with the tests and questions such as #6
loop_ecology()
is currently called in line 270 in gen3sis_main.R
script. As the observer is invoked before, observer output does not reflect ecology processes of this time step.
Line 270 in d7a65d8
Documentation and comments in the code suggest that it should be called after the evolution step and prior to the end of loop updates in line 232.
Lines 226 to 232 in d7a65d8
Please see the problems shown on
https://cran.r-project.org/web/checks/check_results_gen3sis.html.
The vignette problems are from vignettes that contain unbalanced code chunk delimiters (e.g., a chunk opened by five backticks but closed by four, or opened by three but closed by four, etc.).
See yihui/knitr#2057 for more information.
Please correct before 2021-10-19 to safely retain your package on CRAN.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.