Giter Club home page Giter Club logo

gen3sis_rf's Introduction

gen3sis

General Engine for Eco-Evolutionary Simulations

This is the repository for the R-package of the gen3sis engine project-gen3sis git.

gen3sis is a spatially-explicit eco-evolutionary mechanistic model with a modular implementation. It allows exploring the consequences of ecological and macroevolutionary processes across realistic or theoretical spatio-temporal landscapes.

gen3sis is licensed under a GPLv3 License deriving from ETHZ 2020 <doi.org/10.5905/ethz-1007-251> and has package authorship according to: http://epub.wu.ac.at/3269/1/Report114.pdf

How to cite

  • O Hagen, B Flueck, F Fopp, JS Cabral, F Hartig, M Pontarp, TF Rangel, L Pellissier (2021) gen3sis: A general engine for eco-evolutionary simulations of the processes that shape Earth’s biodiversity. PLOS Biology. doi:10.1371/journal.pbio.3001340

How to install

gen3sis is avabaile on CRAN. You can install the latest CRAN release via

install.packages("gen3sis")

you can also install the latest development release from GitHub via

devtools::install_github(repo = "project-gen3sis/R-package", 
  dependencies = TRUE, build_vignettes = TRUE)

Below the status of the automatic CI R-CMD-check tests

DEVELOPMENT R-CMD-check

MASTER R-CMD-check

How to use

Run one simulation

Load and run a simulation with the desired config and landscapes. Exemple data is provided with the package

library("gen3sis")

datapath <- system.file(file.path("extdata", "WorldCenter"), package = "gen3sis")

sim <- run_simulation(config = file.path(datapath, "config/config_worldcenter.R"), 
               landscape = file.path(datapath, "landscape"),
               output_directory = tempdir(),
               verbose=0)

A summary statistics is stored at 'sim' more data can be save using the oberver function

Visualize a simulation

Plot the summary statistics of a simulation

plot_summary(sim)

Check installed version

Make sure you have the latest gen3sis version

#print package version
paste("gen3sis version:", packageVersion("gen3sis"))

How to contribute

The main branches of the gen3sis repo are:

  • master
  • development

The master branch should always reflect the state of the current release of gen3sis on CRAN. The development branch contains the working additions/changes to the code that are to be included in the next release. You should not work on either of these branches directly. Rather, to make changes or work on a new feature, you should create a separate branch off the development branch. While working on your branch, frequently merge changes from development to stay up to date. Once your work is ready, and before you merge your branch into development, make sure to merge any changes from development and verify the code is compiling and tests are passing. Once these checks have been done, create a pull request to merge your branch into development. You can request reviewers for your pull request directly via GitHub. After your pull request is approved, or if it has not been reviewed within 30 days, it will be merged into development. The branch hotfix-development exists for small (one commit only) changes that are not worth creating a new branch for (for instance, small bugfixes, readme or help files edits, etc.). A pull request can then be created to merge those changes into development. New features should never be merged directly into master. Only hotfixes to the current release may be merged into master. For hotfixes, create a separate branch from master, make the fix and verify it, and then merge the hotfix branch into master and development. Similarly to above, the hotfix-master branch exists for small (one commit only) bugfixes to the current release. A pull request can then be created to merge those changes into master and development. The gen3sis workflow is inspired by the RevBayes workflow: https://revbayes.github.io/developer

Credits

We thank the developers of the following methods and dependencies:

gen3sis_rf's People

Contributors

ohagen avatar benj919 avatar florianhartig avatar loic-pellissier avatar julianoscabral avatar yihui avatar ffopp avatar mmore500 avatar zhg2017 avatar cakloecker avatar cndesantana avatar

Stargazers

Thomas Keggin avatar

gen3sis_rf's Issues

Option to save intermediate simulation states not working

The save_state parameter in run_simulation() is currently not working as intended. Calling this function with, for example, save_state = "last" will throw the following error:

Error in list.files(val$config$directories$output_val, full.names = TRUE) : 
  invalid 'path' argument

The reason for this is that val$config$directories$output_val is never initialised. I see that there is some code commented out in prepare_directories(), and my guess is that this code was removed either to avoid creating an empty directory that is never used or because some of the documented options for the save_state parameter (namely, passing a numeric vector of specific time steps to save) are not implemented yet.

Saving the state of the simulation can take a lot of time if the resulting .rds files are large (and they usually are, I think). This is more of a feature request, but when running simulations with thousands of time steps I would like to be able to save the state at specified times (for example, each 200 steps) to restart the simulation from there, but only keeping the latest state to save disk space.

Currently, the available options to save_state are: NA to never save, "all" to save all time steps (excessive in most cases, since writing the state files can take a lot of time), "last" which does the same but removing any previous saves, or a numeric vector to save at specified time steps (not implemented yet), keeping them all. I propose using two different options in run_simulation() instead:

  • save_state: Which time steps to save, NULL by default. Could be a numeric vector or "all". If not specified, do not create any saves.
  • last_state_only: A logical, TRUE by default. Whether to keep all saved states or only the last one.

Adding another option might not be the best approach, but I think it is the right thing to do if this feature is to be implemented.

`make_summary()` throws an error with h3 spaces

As @ohagen reported in an email, make_summary() will throw an error when running simulations with spaces of type gen3sis_space_h3:

Error in final_richness[as.integer(names(richness)), ncol(final_richness)] <- richness : 
  NAs are not allowed in subscripted assignments
In addition: Warning message:
In make_summary(val$config, val$data, val$vars, total_runtime, save_file = TRUE) :
  NAs introduced by coercion

The reason for this is that the site names in simulations with h3 spaces are not numbers as it was the case with rasters, but strings like "8003fffffffffff", which cannot be converted to integers with the as.integer function. I did not have time to have a proper look at this, but I think that the final_richness matrix in this function has row names, so it should not be necessary to use as.integer to select rows. However, right now I am not sure if it is always guaranteed to have row names.

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.