-
Notifications
You must be signed in to change notification settings - Fork 9
Instructions for Windows Users
Windows users may be unable to install vat
because of issues associated with the ncdf4
library.
Window users need to install ncdf4
as a binary using the instructions here and should download one of the ZIP files for MS-Windows depending on whether they have a 32- or 64-bit operating system. Once a ZIP file has been downloaded (presuming it's saved to Downloads), it should be installed by typing the following in R
:
# Assuming you have a 64-bit operating system
install.packages("Downloads/ncdf4_1.12.zip", repo = NULL)
Then, you'll need to run the following code, you need to install these packages.
install.packages(c("devtools", "plyr", "dplyr", "tidy", "stringr",
"shiny", "DT", "markdown", "ggplot2", "scales"))
The following code must be run if you want to use the vat
functions. I would recommend saving the code in an R script. Note, you only need to source()
and load the libraries only once during an R session.
library("devtools")
source_url("https://raw.githubusercontent.com/mareframe/vat/master/R/vadt.R")
source_url("https://raw.githubusercontent.com/mareframe/vat/master/R/create_vadt.R")
source_url("https://raw.githubusercontent.com/mareframe/vat/master/R/animate_vadt.R")
library("ncdf4")
library("plyr")
library("dplyr")
library("tidyr")
library("stringr")
library("shiny")
library("DT")
library("markdown")
library("ggplot2")
library("scales")
# Set working directory to where your model is
setwd('/AtlantisModel')
#' Create a visualizing Atlantis diagnostic tool object
#'
#' This function creates a visualizing Atlantis diagnostic tool object which
#' should be fed to the \code{vadt} function. This object can be quite large
#' and this function may take a little while depending on how long you have
#' run Atlantis for and the complexity of your model.
#'
#'@param outdir Path to Atlantis output directory
#'@param fgfile Functional group file
#'@param biolprm Biology parameter file
#'@param ncout Name of output ncdf4 file excluding nc suffix (i.e. name given
#' after -o flag)
#'@param startyear Year that the model starts
#'@param toutinc Periodicity of writing output (in days)
#'@param diet Include diagnostic diet plots? default is TRUE
obj <- create_vadt(outdir = "ZooBio/", fgfile = "GroupsIceland.csv",
ncout = "OutputNoFish", startyear = 1948, toutinc = 30,
biolprm = "BiologyNoFishZoo.prm", diet = TRUE)
#' The visualizing Atlantis diagnostic tool
#'
#' The visualizing Atlantis diagnostic tool is an interactive Shiny-based tool
#' for model tuning and calibration. It includes various plots, both aggregated
#' and unaggregated, that are useful for diagnostic, tuning, and visualizing
#' output. To use \code{vadt}, the user must first run the \code{create_vadt}
#' function which will create an object of class \code{vadt} which can be fed
#' to the \code{vadt} function. The user may also run the \code{animate_vadt}
#' to create the animated GIFs (this is optional).
#'
#'
#'@param obj Object of class vat returned by create_vat
#'@param anim Directory to stored animated plot created by vat_animate function
#' (defaults to NULL)
vadt(obj, anim = NULL)
If you want animated plots in vadt
, then you will need to do the following. Note, this has not been tested on Windows and it requires imagemagick to be installed.
install.packages(c("animation", "gridExtra"))
library("animation")
library("gridExtra")
#'
#' Create animated Atlantis plots of all the tracers
#'
#' This function will create GIFs of all Atlantis tracers by default.
#' WARNING: This can take a while and is not necessary to use \code{vadt}.
#' It is probably much, much better to specify certain groups! This function
#' depends on having the unix command convert installed locally. Convert is
#' part of imagemagick and can be downloaded here: http://www.imagemagick.org/.
#'
#' @param bgm An Atlantis bgm file
#' @param bmass BoxBiomass.txt file from Atlantis out
#' @param interval Speed of animination (unit in seconds)
#' @param codes Vector of containing all the Atlantis functional group codes needed
#' to create GIFs
#' @param savedir Where should the gifs be saved?
bgm <- "/path/to/atlantis.bgm"
bmass <- "/path/to/outputBoxBiomass.txt"
codes <- read.csv("functionalGroup.csv", header = T, stringsAsFactors = FALSE)
savedir <- "/home/chris/"
animate_vadt(bgm = bgm, bmass = bmass, codes = codes$Code, savedir = savedir)
vadt(obj, anim = "/home/chris")