Giter Site home page Giter Site logo

reactiveatlantis's Introduction

Project Status Build Status

ReactiveAtlantis

ReactiveAtlantis is a R-package builded using the Shiny package as the main platform for the reactive programming approach.

ReactiveAtlantis has several tools that were created to help in the tuning, parameterization and analysis of the processes and parameters most often modified during the calibration of Atlantis (e.g. growth rate, predation, recruitment, Audzijonyte et al. 2017. Among the processes performed by this package are:

  • Visualization and analysis of the input, output and initial conditions of an Atlantis model.
  • Interactive modification of Atlantis configuration files.
  • Simulation of new parameters to help in the calibration on an Atlantis model.
  • Execution of a model skill assessment, to evaluate the performance of the model to reflect the observed data.

Getting Started

These instructions will give you access to use the R-package ReactiveAtlantis. If you have some problem for your installation, please let me know and I will try to solve it as soon as possible.

Prerequisites and installation

What things you need to install To run ReactiveAtlantis on R.

# install packages
install.packages('devtools')   ## you need to do this step just once
# running
library("devtools")
install_github('Atlantis-Ecosystem-Model/ReactiveAtlantis', force=TRUE, dependencies=TRUE)
library("ReactiveAtlantis")

Running ReactiveAtlantis

Compare outputs and Biomass visualization

nc.current  <- 'your_current_output.nc'
nc.old      <- 'your_previous_output.nc'
grp.csv     <- 'your_groups_definition_file.csv'
bgm.file    <- 'your_spatial_configuration_file.bgm'
cum.depths  <- c(0, 20, 50, 150, 250, 400, 650, 1000, 4300) ## This should be the cummulative depth of your model
## individual file
compare(nc.current, nc.out.old = NULL, grp.csv, bgm.file, cum.depths)
## compare to previuos run
compare(nc.current, nc.old, grp.csv, bgm.file, cum.depths)

Predation analysis from the Atlantis output

biom        <- 'your_BiomIndx.txt'
diet.file   <- 'your_DietCheck.txt'
bio.age     <- 'your_AgeBiomIndx.txt' ## optional file. just if you want to check the predation by age
grp.csv     <- 'your_groups_definition_file.csv'
## Predation by Age
predation(biom, grp.csv, diet.file, bio.age)
## No predation by Age
predation(biom, grp.csv, diet.file, bio.age = NULL)

Exploring predator-prey interactions from the initial conditions

prm.file    <- 'your_prm_file.prm'
nc.initial  <- 'your_initial_conditions.nc'
grp.csv     <- 'your_groups_definition_file.csv'
bgm.file    <- 'your_spatial_configuration_file.bgm'
cum.depths  <- c(0, 20, 50, 150, 250, 400, 650, 1000, 4300) ## This should be the cummulative depth of your model
feeding.mat(prm.file, grp.file, nc.initial, bgm.file, cum.depths)

Atlantis food web and trophic level composition

grp.csv     <- 'your_groups_definition_file.csv'
prm.file    <- 'your_prm_file.prm'
diet.file   <- 'your_DietCheck.txt'
food.web(diet.file, grp.file)
## optional you can explore the food web by polygon
food.web(diet.file, grp.file, diet.file.bypol)
## diet.file.bypol Detailed diet check file, this can be obtained as an extra output from Atlantis "DetailedDietCheck.txt". To get this file from Atlantis turn on the option "flagdietcheck" on the Run.prm file.

Growth of primary producers and limiting factors

nc.initial  <- 'your_initial_conditions.nc'
nc.current  <- 'your_current_output.nc'
grp.csv     <- 'your_groups_definition_file.csv'
prm.file    <- 'your_prm_file.prm'
growth.pp(nc.initial, grp.csv, prm.file, nc.current)

Analysis of recruitment and primary production

nc.initial  <- 'your_initial_conditions.nc'
nc.current  <- 'your_current_output.nc'
yoy.file    <- 'your_yoy_file.txt'
grp.csv     <- 'your_groups_definition_file.csv'
prm.file    <- 'your_prm_file.prm'
recruitment.cal(nc.initial, nc.current, yoy.file, grp.file, prm.file)

Harvest outputs and model skill assessment

catch.nc             <- 'your_output_CATCH.nc'
ext.catch.total      <- 'external_catch_time_serie.csv'
ext.catch.by.fleet   <- 'external_catch_time_serie_by_fleets.csv'
cum.depths  <- c(0, 20, 50, 150, 250, 400, 650, 1000, 4300) ## This should be the cummulative depth of your model
fsh.csv     <- 'your_fisheries_definition_file.csv'
bgm.file    <- 'your_spatial_configuration_file.bgm'
grp.csv     <- 'your_groups_definition_file.csv'
catch(grp.csv, fsh.csv, catch.nc, ext.catch.total, ext.catch.total)

Authors

  • Javier Porobic

License

This project is licensed under GPL3

reactiveatlantis's People

Contributors

iles-stell avatar jporobicg avatar kevcaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactiveatlantis's Issues

function description needs updating?

I was double checking how to use the predation() function on the github (https://github.com/Atlantis-Ecosystem-Model/ReactiveAtlantis), and the page says to do the following if you do not have the agebiomindx.txt file:

predation(biom, grp.csv, diet.file, bio.age = NULL)

but this did not work until I tried

predation(biom, grp.csv, diet.file, age.biomass = NULL)

Did the bio.age input get replaced by age.biomass? If so maybe the main github needs updating? Thanks!

Create PNG of images?

This is not an issue but more of a request/question. I really like the predation over time images created by the predation() function. I use the snipping tool to save the images, which is not a big deal, but maybe it would be nice if there was like a button or something that the user can click to save a png of the image? Might be able to get some images of better quality that way? Just an idea. Thanks!

Recruitment.cal

Javier, The recruitment.cal produced an error message:

Error: dims [product 1] do not match the length of object [11]

After entering the debugging mode, I found that the line 38 is to read.csv (YOY.txt file), but the file is a YOY.txt file. I tried to change to read.delim(), but could not make it work. Could you please to help fixing the code? thanks

Error in pprey

During package installation I get the following error
unused argument (pprey = TRUE)

Then when using feeding.mat I get

Error in text2num(prm, "pPREY", Vector = TRUE, pprey = TRUE) :
unused argument (pprey = TRUE)

Found a bug with feeding.mat() - quick fix

Hei Javier! I was trying to get feeding.mat() to work with the GoM files and I kept getting an error about a variable not being found. I did some digging into the script and I found that the error was happening within the Bio.func() function and a mismatch with the groups.csv column headers. If you go into the feeding.mat() function, line 101 and 102, there is a safety net to fix the headers in the groups.csv file, but in the GOM model we use "inverttype" as the column head - note "invertype". I switched the code to this:

if(any(grepl('inverttype', names(groups.csv)))){
names(groups.csv)[which(grepl('inverttype', names(groups.csv)))] <- 'grouptype'
}

and I was able to get it to run. :)

help with error messages running feeding.mat and growth.pp

Javier,
I got the following error messages when running feeding.mat

Error in data.frame(FG = min.depth[, 1], Min = min.depth[, 2], Max = max.depth[which(max.depth[, :
arguments imply differing number of rows: 53, 52

and error message when running growth.pp
Error in if (flaghabd == 1) { : the condition has length > 1.

Could you or anyone else in the group help me with the solutions, please?

food.web() function - Getting "Error: replacement has length zero"

Hei! I am continuing the testing out of ReactiveAtlantis functions with the inputs and outputs from the Gulf of Mexico Atlantis model, and I ran into an error with the food.web() function. I was trying to look at the food webs for the shrimp groups (BSH, PSH, and WSH) over time, and I start getting the stated error. At first I thought it had something to do with the column headers in the groups.csv file, so I changed the headers that are getting called in the food.web() function (from what I could see in the r code). It fixed the issue for some of the other fish groups, but I am still getting the error with the shrimp groups. I attached the files I am using in the function in case you wanted to test it yourself.
GulfGroupsForR.csv
GOM_OUTDietCheck.txt

Error in recruitment.cal

I was getting an error in recruitment.cal() with referencing column names in the group.file. I think it's caused by the column names being turned lowercase (Line 58) but being referenced with uppercase (Lines 90, 144, etc.).

Biomass and predation

Hello,
The tool for calculating absolute and relative biomass is not working as expected, and different values are shown when plotting the biomass using the predation tool.
Ice-associate species are not showing up in certain tools.
Additionally, in the predator-prey matrix, there are issues visualising the correct proportion of prey consumption.

Thank you!

Minor update seems to have created an error

When running the updated ReactiveAtlantis in R-Studio, the following error results:

Error in data.frame(Time = Time, FG = paste0(as.character(age.grp$longname[age]), : arguments imply differing number of rows: 154, 1, 123

Safeguards for different column names in groups.csv file?

Hei! I tried to run the compare() function for the Gulf of Mexico files, and the function did not run and I think it is because the compare() function expects the column names to be specific labels (line 85; grp <- grp[grp$isturnedon == 1, c('code', 'name', 'longname', 'grouptype', 'numcohorts')]), but for the Gulf of Mexico inputs we have "Long Name" and "InvertType" and "NumCohorts". This file still runs in Atlantis, so I am guessing Atlantis has some safe-guards in place for different column headers in the groups.csv file. I do not have an issue changing the column headers, but then it needs to be communicated back to all the users of this model which might be tricky to make sure they use this new file. So, I am just wondering if this function should have some of those safe guards for different column headers? Thanks!

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.