knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(osmose)
# Remove the .jar file if exits.
osmose:::flushCache("osmose_4.3.0.jar")
osmose:::flushCache("eec_4.3.0")

Create, run and read an example

Define a folder for copy example files:

exampleFolder <- tempdir()

# Show the temporary folder
cat(exampleFolder)

# Copy files
demoPaths <- osmose_demo(path = exampleFolder, config = "eec_4.3.0")

Run the example using run_osmose function (it will take less than 1 min):

run_osmose(input = demoPaths$config_file, force=TRUE)

Read outputs and config using read_osmose function

outputs <- read_osmose(path = demoPaths$output_dir, 
                       input = demoPaths$config_file)

# Print osmose outputs
print(outputs)

Plot methods for osmose class

plot(outputs, what = "biomass")
plot(outputs, what = "biomass", type = 2)
plot(outputs, what = "abundance", ts = FALSE, type = 1)
plot(outputs, what = "abundance", ts = FALSE, type = 2)

plot(outputs, what = "biomassByAge")
plot(outputs, what = "biomassBySize", type = 2)
plot(outputs, what = "biomassByTL", type = 1)
plot(outputs, what = "biomassBySize", type = 2)

Plot methods for osmose.config class

It is important to remember that config info has already been read in outputs object and you can access just by indexing outputs$config.

plot(outputs$config, what = "species")
plot(outputs$config, what = "predation")
plot(outputs$config, what = "reproduction", type = 1)
plot(outputs$config, what = "reproduction", type = 2)


roliveros-ramos/osmose documentation built on Feb. 19, 2023, 8:19 a.m.