Title: | Read, Plot and Analyse Output from the DEPONS Model |
---|---|
Description: | Methods for analyzing population dynamics and movement tracks simulated using the DEPONS model <https://www.depons.eu> (v.3.0), for manipulating input raster files, shipping routes and for analyzing sound propagated from ships. |
Authors: | Jacob Nabe-Nielsen [aut, cre], Caitlin K. Frankish [aut] |
Maintainer: | Jacob Nabe-Nielsen <[email protected]> |
License: | GPL-3 |
Version: | 1.2.4 |
Built: | 2024-11-21 07:04:51 UTC |
Source: | CRAN |
Convert Automatic Identification System (AIS) data for ships to
ship track objects. This is done by cropping one or more ship tracks to the
extent of a landscape and converting the data to a DeponsShips-class
object. If the AIS data does not include ship positions recorded in half-hour
steps, the tracks are interpolated to make objects suitable for use in DEPONS.
ais.to.DeponsShips(data, landsc, title = "NA", ...)
ais.to.DeponsShips(data, landsc, title = "NA", ...)
data |
data.frame with ship positions and the times at which the positions were recorded. Must contain the columns 'id', 'time' (of the form " type, character), 'length' (ship length, meters), 'x', and 'y' (position, meters/UTM). |
landsc |
A |
title |
Title of the output object |
... |
Optional parameters, including 'startday' and 'endday' (" from 'data'. If startday = endday the output object will contain up to 49 positions from the selected date for each vessel track. |
Returns a DeponsShips
object containing one or more ships
assigned to each of the routes in the object. All ships on a particular
route move at the same speed along the route. The routes are
defined by x and y coordinates based on the same coordinate reference
system as the landscape they are located in. The speed that ships use after
reaching a particular position (a particular 'virtual buoy') is calculated
from the distance to the following position, and the time it takes reaching
that position. If speed is included in the input AIS data, this is NOT used.
The routes include one position per half-hour time step, corresponding to
the default time step used in the DEPONS model. If input data does not
include one position per half hour, new positions are generated using linear
interpolation. If the input data contains many positions in a particular
half-hour interval, only the positions closest to the half-hour interval are
used. The routes contain information about the number of half-hour
intervals were ships 'pause' at a particular location, e.g. in a
port. These are calculated based on the input AIS data.
aisdata
for an example of data that can be used as
input to ais.to.DeponsShips. The function builds on
interpolate.ais.data
, which interpolates tracks to ensure
that there is a position every 30 minutes.
See write.DeponsShips
for conversion of
DeponsShips
objects to json-files to be used in DEPONS. Use
routes
, ships
, and title
for
inspection/modification of the ship tracks.
data(aisdata) plot(aisdata$x, aisdata$y, type="n", asp=1) ids <- sort(unique(aisdata$id)) my.colors <- heat.colors(length(ids)) for (i in 1:length(ids)) { id <- ids[i] points(aisdata$x[aisdata$id==id], aisdata$y[aisdata$id==id], cex=0.6, col=my.colors[i]) } data(bathymetry) plot(bathymetry, add=TRUE) depons.ais <- ais.to.DeponsShips(aisdata, bathymetry) the.routes <- routes(depons.ais) for (i in 1:length(ids)) { points(the.routes[[i]]$x, the.routes[[i]]$y, cex=0.6, pch=16, col=my.colors[i]) } depons.ais <- ais.to.DeponsShips(aisdata, bathymetry, startday="2015-12-20", endday="2015-12-20") routes(depons.ais) aisdata2 <- aisdata aisdata2$time <- format(as.POSIXct(aisdata$time)+300) depons.ais2 <- ais.to.DeponsShips(aisdata2, bathymetry, startday="2015-12-20", endday="2015-12-21") routes(depons.ais2)
data(aisdata) plot(aisdata$x, aisdata$y, type="n", asp=1) ids <- sort(unique(aisdata$id)) my.colors <- heat.colors(length(ids)) for (i in 1:length(ids)) { id <- ids[i] points(aisdata$x[aisdata$id==id], aisdata$y[aisdata$id==id], cex=0.6, col=my.colors[i]) } data(bathymetry) plot(bathymetry, add=TRUE) depons.ais <- ais.to.DeponsShips(aisdata, bathymetry) the.routes <- routes(depons.ais) for (i in 1:length(ids)) { points(the.routes[[i]]$x, the.routes[[i]]$y, cex=0.6, pch=16, col=my.colors[i]) } depons.ais <- ais.to.DeponsShips(aisdata, bathymetry, startday="2015-12-20", endday="2015-12-20") routes(depons.ais) aisdata2 <- aisdata aisdata2$time <- format(as.POSIXct(aisdata$time)+300) depons.ais2 <- ais.to.DeponsShips(aisdata2, bathymetry, startday="2015-12-20", endday="2015-12-21") routes(depons.ais2)
Automatic identification system (AIS) data for three ships in Kattegat and the Western Baltic from 20 Dec 2015. The data set includes the variables id (the Maritime Mobile Service Identity number), time, speed (in knots), type, length (in metres), x and y (which provide the coordinates of the ship at a given time. The coordinates use the UTM zone 32 projection (CRS = "+proj=utm +zone=32 +units=m +no_defs +datum=WGS84").
data.frame
Function for converting DEPONS population dynamics object to a data frame.
## S4 method for signature 'DeponsDyn' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S4 method for signature 'DeponsDyn' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
DeponsDyn object |
row.names |
NULL or a character vector giving the row names for the data frame. Missing values are not allowed. |
optional |
Logical (not used) |
... |
additional arguments to be passed to or from methods. |
data.frame
object
data(porpoisedyn) class(porpoisedyn) the.dyn <- as.data.frame(porpoisedyn)
data(porpoisedyn) class(porpoisedyn) the.dyn <- as.data.frame(porpoisedyn)
Function for converting DEPONS movement track file to a data frame.
## S4 method for signature 'DeponsTrack' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S4 method for signature 'DeponsTrack' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
DeponsTrack object |
row.names |
NULL or a character vector giving the row names for the data frame. Missing values are not allowed. |
optional |
Logical (not used) |
... |
additional arguments to be passed to or from methods. |
data.frame
object
data(porpoisetrack) class(porpoisetrack) the.track <- as.data.frame(porpoisetrack)
data(porpoisetrack) class(porpoisetrack) the.track <- as.data.frame(porpoisetrack)
The standard bathymetry file for Kattegat which is used in DEPONS simulations. It is based on a raster file with 1000 rows and 600 columns where each grid cell corresponds to 400 m x 400 m. Cells on land are assigned a missing data value of -9999.
The Kattegat landscapes use the UTM zone 32 projection, (EPSG:32632) as in the study by Nabe-Nielsen et al (2014). The corresponding proj4string is "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs" (see https://epsg.io/32632).
DeponsRaster
Nabe-Nielsen, J., Sibly, R. M., Tougaard, J., Teilmann, J., & Sveegaard, S. (2014). Effects of noise and by-catch on a Danish harbour porpoise population. Ecological Modelling, 272, 242–251. doi:10.1016/j.ecolmodel.2013.09.025
Retrieves spatial bounding box from object. If a Depons* object is a DeponsTrack object containing multiple track, the box bounds all tracks.
## S4 method for signature 'DeponsRaster' bbox(obj) ## S4 method for signature 'DeponsTrack' bbox(obj)
## S4 method for signature 'DeponsRaster' bbox(obj) ## S4 method for signature 'DeponsTrack' bbox(obj)
obj |
DeponsRaster or DeponsTrack object |
Returns a matrix
defining the northern, southern, eastern and
western boundary of a DeponsRaster object or of one or more DeponsTrack
objects.
An object of class SpatialPolygonsDataFrame
showing the
coastline of the North Sea, Kattegat, and the Western Baltic. The map projection
used is ETRS89 – EPSG:3035 projection as for the North Sea raster files used
by DEPONS. The corresponding proj4string is "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000
+y_0=3210000 +datum=WGS84 +units=m +no_defs".
SpatialPolygonsDataFrame
Get or set the map projection (also known as coordinate reference system, crs) of DeponsRaster and DeponsTrack objects.
## S4 method for signature 'DeponsTrack' crs(x) ## S4 method for signature 'DeponsShips' crs(x) ## S4 method for signature 'DeponsRaster' crs(x) ## S4 replacement method for signature 'DeponsTrack' crs(x) <- value ## S4 replacement method for signature 'DeponsShips' crs(x) <- value ## S4 replacement method for signature 'DeponsRaster' crs(x) <- value
## S4 method for signature 'DeponsTrack' crs(x) ## S4 method for signature 'DeponsShips' crs(x) ## S4 method for signature 'DeponsRaster' crs(x) ## S4 replacement method for signature 'DeponsTrack' crs(x) <- value ## S4 replacement method for signature 'DeponsShips' crs(x) <- value ## S4 replacement method for signature 'DeponsRaster' crs(x) <- value
x |
Object of class class |
value |
(proj4string) identifying the map projection |
Methods for analyzing population dynamics and movement tracks simulated using the DEPONS model (v.3.0; https://www.depons.eu), for manipulating input raster files, shipping routes and for analyzing sound propagated from ships.
The classes used in DEPONS2R include:
DeponsTrack
movement tracks, read from "RandomPorpoise.XXX.csv" files
DeponsDyn
population dynamics data, from "Statistics.XXX.csv" files
DeponsBlockdyn
data from "PorpoisePerBlock.XXX.csv" files
DeponsShips
data from "ships.json" files or from AIS data
Here the DeponsDyn
data include both changes in population size and energetics
through time for the entire landscape, whereas DeponsBlockdyn
data include
variations in population size in different parts (or 'blocks') of the landscape.
XXX is the date and time when the simulation was finished.
Stores objects containing population size for different parts of the landscape (i.e. different 'blocks')
The dyn
slot contains a data frame with the columns 'tick',
which indicates the number of half-hourly time steps since the start of the
simulation; a column 'block' indicating the region of the landscape where
animals were counted, a 'count' column with the number of animals in that block
and tick. The 'real.time' column shows the real-world equivalent to 'tick, i.e.
the time that has passed since 'startday'.
title
Character. Name of the object or simulation
landscape
Character. Identifier for the landscape used in the DEPONS simulations. The landscapes 'DanTysk', 'Gemini', 'Kattegat', 'North Sea', 'Homogeneous', and 'User defined' are distributed with the DEPONS model.
simtime
POSIXlt
object with the date and time when the simulation was
finished. This is read from the name of the imput file.
startday
POSIXlt object with the first day of the simulation, i.e. the first day in the period that the simulations are intended to represent in the real world.
dyn
Data frame with simulation output.
DeponsBlockdyn-objects are usually read in from csv files produced during DEPONS simulations. These files are named 'PorpoisePerBlock.XXX.csv', where XXX indicates the date and time when the simulation was finished.
plot.DeponsBlockdyn
and
read.DeponsBlockdyn
.
a.DeponsBlockdyn <- new("DeponsBlockdyn") a.DeponsBlockdyn
a.DeponsBlockdyn <- new("DeponsBlockdyn") a.DeponsBlockdyn
Stores objects containing population dynamics output and energetic output simulated using the DEPONS model.
The following columns are included in the simulation output data frame: 'tick', which indicates the number of half-hourly time steps since the start of the simulation; 'count', which indicates the population size at a given time; 'anim.e', showing the average amount of energy stored by simulated animals; 'lands.e', which shows the total amount of energy in the landscape, and 'real.time' which shows the time relative to 'startday'.
title
Character. Name of the object or simulation
landscape
Character. Identifier for the landscape used in the DEPONS simulations. The landscapes 'DanTysk', 'Gemini', 'Kattegat', 'North Sea', 'Homogeneous', and 'User defined' are distributed with the DEPONS model.
simtime
POSIXlt
object with the date and time when the
simulation was finished. This is read from the name of the imput file.
startday
POSIXlt object with the first day of the simulation, i.e. the first day in the period that the simulations are intended to represent in the real world.
dyn
Data frame with simulation output.
DeponsDyn-objects are usually read in from csv files produced during DEPONS simulations. These files are named 'Statistics.XXX.csv', where XXX indicates the date and time when the simulation was finished.
plot.DeponsDyn
and
read.DeponsDyn
.
a.DeponsDyn <- new("DeponsDyn") a.DeponsDyn
a.DeponsDyn <- new("DeponsDyn") a.DeponsDyn
Stores objects containing raster landscapes used as input in DEPONS simulations.
type
Character. Identifies the kind of data stored in the raster; should be 'food', 'patches', bathymetry', 'dtc', 'salinity', 'blocks' or 'NA'.
landscape
Character Identifier for the landscape used in the DEPONS simulations. The landscapes 'DanTysk', 'Gemini', 'Kattegat', 'North Sea', 'Homogeneous', and 'User defined' are distributed with the DEPONS model.
crs
Object of class "CRS", i.e. the coordinate reference system. This is provided as a proj4string text string.
header
Data frame with data on number of columns and rows in the input raster, the coordinates of the lower left corner, the size of each grid cell and the integer value used to represent missing data.
ext
Data frame with the extent of the landscape.
data
The actual data values for each of the grid cells.
DeponsRaster-objects are typically read in from ascii raster files that have been used for DEPONS simulations.
plot.DeponsRaster
, read.DeponsRaster
and
make.blocksraster
. bathymetry
is an example
of a DeponsRaster
-object.
a.deponsraster <- new("DeponsRaster") a.deponsraster
a.deponsraster <- new("DeponsRaster") a.deponsraster
Objects containing ship routes and ships
Methods for manipulating, plotting and analyzing ship routes and ship agents used in DEPONS simulations.
title
Name of the object (character)
landscape
Name of the landscape that the ships occur in (character)
crs
CRS object providing the coordinate reference system used; see
CRS
for details
routes
data.frame
geographic positions of the 'virtual buoys'
that define one or more ship routes that ship agents follow, and the speed
that the ships should use when following this route. They also provide
information about how long ships should use speed zero when reaching a
specific buoy ('i.e. 'pause', measured in minutes). Can be extracted
using the routes
function.
ships
data.frame
defining each of the ships occurring in DEPONS
simulations, and the routes they occur on. The data frame includes the variables
'name', 'type', 'length', and 'route'. Info can be extracted using the
ships
function.
plot.DeponsShips
,
and read.DeponsShips
data(shipdata) ships(shipdata)[1:10,] routes(shipdata) plot(shipdata, col=c("red", "purple", "blue"))
data(shipdata) ships(shipdata)[1:10,] routes(shipdata) plot(shipdata, col=c("red", "purple", "blue"))
Stores objects containing animal movement tracks simulated using the DEPONS model
Classes for manipulating and plotting movement tracks generated with DEPONS.
title
Name of the object (character)
landscape
Name of the object (character)
simtime
POSIXlt object with the date and time when the simulation was finished. This is read from the name of the imput file.
crs
CRS object providing the coordinate reference system used; see
st_crs
for details
tracks
Listwith one or more tracks, each stored
as a SpatialPointsDataFrame
object)
plot.DeponsTrack
and
read.DeponsTrack
Extract population dynamics from objects
## S4 method for signature 'DeponsDyn' dyn(x) ## S4 method for signature 'DeponsBlockdyn' dyn(x)
## S4 method for signature 'DeponsDyn' dyn(x) ## S4 method for signature 'DeponsBlockdyn' dyn(x)
x |
Object of class |
Returns the name of the newest simulation output of a particular type within the specified directory. The date and time are extracted from the file name.
get.latest.sim(type = "dyn", dir)
get.latest.sim(type = "dyn", dir)
type |
Type of simulation output to check; can be one of: "dyn" (for looking in "Statistics.XX.csv" files), "blockdyn" (for looking in "PorpoisePerBlock.XX.csv" files) "track" (for looking in "RandomPorpoise.XX.csv" files). |
dir |
Directory to look for simulation output in (character string) |
character string with the name of the most recent simulation output file.
read.DeponsBlockdyn
for example.
Returns the date and time when a specific simulation was finished,
obtained from the date stored as part of the file name. The date format is system
dependent, but the function attemts to extract the data assuming that either
the English or the local language is used.
(a POSIXlt
object)
get.simtime(fname = NULL, tz = "GMT")
get.simtime(fname = NULL, tz = "GMT")
fname |
Character string with name of the file to extract the simulation date from, including the path |
tz |
Time zone |
Returns a POSIXlt
object
Interpolates ship movement tracks obtained from Automatic Identification System (AIS) data to obtain exactly one position per 30 minutes. The first and last position in the original track are omitted unless minutes = 0 or 30 and seconds = 0.
interpolate.ais.data(aisdata)
interpolate.ais.data(aisdata)
aisdata |
Data frame including the columns 'id' (ship identifier),
'time' (text string readable by |
Returns a data frame with the same columns as the input data
read.DeponsShips
and ais.to.DeponsShips
data(aisdata) ais.testdata <- aisdata[c(12,14,16) ,] plot(ais.testdata[c("x", "y")], asp=1, col="green", pch=16, xlim=c(780000, 837000)) lines(ais.testdata[c("x", "y")]) # Add 600 sec to 'time' to mis-allign with intervcal needed ais.testdata$time <- format(as.POSIXlt(ais.testdata$time)+600) text(ais.testdata[c("x", "y")]-900, ais.testdata$time, adj=0, cex=0.5) interpolated <- interpolate.ais.data(ais.testdata) points(interpolated[,c("x", "y")], col="red") text(interpolated[c("x", "y")]-900, interpolated$time, adj=0, cex=0.5) legend("bottomright", bty="n", pch=c(16, 1), col=c("green", "red"), legend=c("original positions", "interpolated"))
data(aisdata) ais.testdata <- aisdata[c(12,14,16) ,] plot(ais.testdata[c("x", "y")], asp=1, col="green", pch=16, xlim=c(780000, 837000)) lines(ais.testdata[c("x", "y")]) # Add 600 sec to 'time' to mis-allign with intervcal needed ais.testdata$time <- format(as.POSIXlt(ais.testdata$time)+600) text(ais.testdata[c("x", "y")]-900, ais.testdata$time, adj=0, cex=0.5) interpolated <- interpolate.ais.data(ais.testdata) points(interpolated[,c("x", "y")], col="red") text(interpolated[c("x", "y")]-900, interpolated$time, adj=0, cex=0.5) legend("bottomright", bty="n", pch=c(16, 1), col=c("green", "red"), legend=c("original positions", "interpolated"))
Get or set the landscape name
Get or set the landscape name
## S4 replacement method for signature 'DeponsTrack' landscape(x) <- value ## S4 method for signature 'DeponsTrack' landscape(x) ## S4 replacement method for signature 'DeponsDyn' landscape(x) <- value ## S4 method for signature 'DeponsDyn' landscape(x) ## S4 replacement method for signature 'DeponsBlockdyn' landscape(x) <- value ## S4 method for signature 'DeponsBlockdyn' landscape(x)
## S4 replacement method for signature 'DeponsTrack' landscape(x) <- value ## S4 method for signature 'DeponsTrack' landscape(x) ## S4 replacement method for signature 'DeponsDyn' landscape(x) <- value ## S4 method for signature 'DeponsDyn' landscape(x) ## S4 replacement method for signature 'DeponsBlockdyn' landscape(x) <- value ## S4 method for signature 'DeponsBlockdyn' landscape(x)
x |
Object of class |
value |
Name of the landscape (character) |
Produces a DeponsRaster object of type='blocks' for use in DEPONS simulations. This allows animals to be counted within specific regions (blocks) of the landscape during the simulation. The new blocks can be specified as either matrices or SpatialPolygons objects. For matrices, the blocks are defined as the smallest rectangle that includes all the specified positions.
## S4 method for signature 'DeponsRaster' make.blocksraster( template, blocks = NA, blockvals = NULL, NAvalue = -9999, plot = FALSE, fname = NULL, overwrite = FALSE )
## S4 method for signature 'DeponsRaster' make.blocksraster( template, blocks = NA, blockvals = NULL, NAvalue = -9999, plot = FALSE, fname = NULL, overwrite = FALSE )
template |
DeponsRaster object used as template for new blocks file |
blocks |
list of areas to be used for new blocks. Each item in 'blocks' should be a matrix (with two columns, corresponding to x- and y-coordinates) or a SpatialPolygons object |
blockvals |
Vector of integer values defining the labels of the new blocks. The first value defines the background value, so the length of 'blockvals' should equal the number of blocks plus 1 |
NAvalue |
Value used for missing data in the output object |
plot |
If TRUE, the raster block is plotted |
fname |
Name of the output raster file (character string ending with '.asc'). No file is written to disk if fname is not provided. |
overwrite |
Whether to replace existing file. |
RasterLayer
object defining different subregions of the
landscape where animals should be counted.
The blocks file should not be modified when running DEPONS simulations using the 'Kattegat' landscape. In this landscape the simulated animals use the blocks file for navigation. Also note that blocks are added to the new blocks raster in the order they are file in the order in which they are listed in 'blocks', so the order mattes if the blocks overlap.
#Load file to use as template for new blocks file data("bathymetry") # Make list of blocks to create new.blocks <- list() x <- runif(8, 700000, 760000) y <- runif(8, 6200000, 6300000) new.blocks[[1]] <- cbind(x,y) x <- c(600000, 635000, 670000, 635000) y <- c(6150000, 6200000, 6150000, 6100000) library(sp) srl <- list(Polygon(cbind(x,y))) Srl <- list(Polygons(srl, ID=as.vector("p"))) new.blocks[[2]] <- SpatialPolygons(Srl, proj4string=crs(bathymetry)) make.blocksraster(bathymetry, new.blocks, plot=TRUE) points(new.blocks[[1]]) plot(new.blocks[[2]], add=TRUE) the.dir <- tempdir() make.blocksraster(bathymetry, new.blocks, fname=paste0(the.dir, "/test.asc"))
#Load file to use as template for new blocks file data("bathymetry") # Make list of blocks to create new.blocks <- list() x <- runif(8, 700000, 760000) y <- runif(8, 6200000, 6300000) new.blocks[[1]] <- cbind(x,y) x <- c(600000, 635000, 670000, 635000) y <- c(6150000, 6200000, 6150000, 6100000) library(sp) srl <- list(Polygon(cbind(x,y))) Srl <- list(Polygons(srl, ID=as.vector("p"))) new.blocks[[2]] <- SpatialPolygons(Srl, proj4string=crs(bathymetry)) make.blocksraster(bathymetry, new.blocks, plot=TRUE) points(new.blocks[[1]]) plot(new.blocks[[2]], add=TRUE) the.dir <- tempdir() make.blocksraster(bathymetry, new.blocks, fname=paste0(the.dir, "/test.asc"))
Makes a polygon from a bounding box to use for clipping the coastline, or other SpatialPolygons objects
## S4 method for signature 'matrix' make.clip.poly(bbox, crs)
## S4 method for signature 'matrix' make.clip.poly(bbox, crs)
bbox |
2x2 matrix |
crs |
CRS object defining the projection of the SpatialPolygons object to be clipped |
SpatialPolygons
object
bbox
for creation of bbox matrix from DeponsRaster
data(bathymetry) bbox <- cbind("min"=c(549517, 6155000), "max"=c(636000, 6210000)) rownames(bbox) <- c("x", "y") clip.poly <- make.clip.poly(bbox, crs(bathymetry))
data(bathymetry) bbox <- cbind("min"=c(549517, 6155000), "max"=c(636000, 6210000)) rownames(bbox) <- c("x", "y") clip.poly <- make.clip.poly(bbox, crs(bathymetry))
Function for reading converting a data frame containing DEPONS simulation output to a DeponsDyn object.
make.DeponsDyn( oname, title = "NA", landscape = "NA", simtime = "NA", startday = "2000-01-01", timestep = 30, tz = "GMT" )
make.DeponsDyn( oname, title = "NA", landscape = "NA", simtime = "NA", startday = "2000-01-01", timestep = 30, tz = "GMT" )
oname |
Name of the object (data frame) that contains number of animals for each time step during the simulation, along with their energy and the amount of food in the landscape. |
title |
Optional character string giving name of simulation |
landscape |
The landscape used in the simulation |
simtime |
Optional character string with the date and time when the simulation finished (format yyyy-mm-dd). |
startday |
The start of the period that the simulation represents, i.e. the real-world equivalent of 'tick 1' (character string of the form 'yyyy-mm-dd', or POSIXlt). Defaluts to 2000-01-01 |
timestep |
Time step used in the model, in minutes. Defaults to 30 minutes in DEPONS. |
tz |
Time zone. |
DeponsDyn
object containing simulation output
See DeponsDyn-class
for details on what is stored in
the output object.
data(porpoisedyn) the.data <- as.data.frame(porpoisedyn) the.data <- the.data[, c(1:4)] names(the.data) <- c("tick", "PorpoiseCount", "FoodEnergyLevel", "PorpoiseEnergyLevel") porpoisedyn2 <- make.DeponsDyn(the.data, startday="2010-01-01") porpoisedyn2
data(porpoisedyn) the.data <- as.data.frame(porpoisedyn) the.data <- the.data[, c(1:4)] names(the.data) <- c("tick", "PorpoiseCount", "FoodEnergyLevel", "PorpoiseEnergyLevel") porpoisedyn2 <- make.DeponsDyn(the.data, startday="2010-01-01") porpoisedyn2
Produce a hypothetical wind farm construction scenario, specifying the position and timing of individual piling events, as well as the sound source level. All wind farms are assumed to consist of the same number of turbines, laid out in a rectangular grid. The start and end tick (i.e. the number of half-hour intervals since simulation start) is generated based on provided values for the time it required for each piling and the time between piling events.
make.windfarms( area.file, area.def, n.wf, n.turb, turb.dist, min.wf.dist, impact, constr.start, constr.end, constr.time, constr.break, iterate = 10000, verbose = FALSE, wf.coords = "random" )
make.windfarms( area.file, area.def, n.wf, n.turb, turb.dist, min.wf.dist, impact, constr.start, constr.end, constr.time, constr.break, iterate = 10000, verbose = FALSE, wf.coords = "random" )
area.file |
Name of the raster file specifying where the wind farms should be constructed. |
area.def |
Value in |
n.wf |
Number of wind farms to construct |
n.turb |
Total number of turbines to construct |
turb.dist |
Distance between turbines within a wind farm (meters) |
min.wf.dist |
Minimum distance between wind farms (meters) |
impact |
Sound source level (dB); sound emitted from turbines during construction, i.e. from tickStart to tickEnd (including both start and end) |
constr.start |
The tick at which construction of the first turbine starts. |
constr.end |
The tick at which construction of the very last turbine in the last wind farm ends. |
constr.time |
The time it takes to construct a single wind turbine (number of ticks). |
constr.break |
Break between individual pilings within a wind farm, counted in number of half-hour 'ticks'. |
iterate |
Number of times to try finding a spot for a new wind farm that is sufficiently far from the nearest neighbouring wind farm (>min.wf.dist). The number also defines the number of random positions to search through. |
verbose |
Logical; whether messages should be printed to console. |
wf.coords |
Possible location of the south-western corner of the wind farms. Defaults to the text "random", but can also be a data frame with coordinates in the columns x and y. |
data.frame specifying the position of each turbine in a wind farm, along with the start time and end time for pile driving of the turbine foundation and the sound source level during pile driving. Can be exported as a text file and used for controlling DEPONS simulations.
The parameters constr.start
, constr.end
, constr.time
,
and constr.break
are truncated to nearest integer value. Construction
of wind farms starts in WF001 at tick constr.start
. Each turbine
foundation is piled over a period of constr.time
, followed by a
noise-free period of constr.break
. Several pile driving operations may
take place at the same time, to ensure that the last piling ends before constr.end
.
Plot population dynamics simulated with DEPONS
## S4 method for signature 'DeponsBlockdyn,missing' plot(x, y, dilute = 5, ...)
## S4 method for signature 'DeponsBlockdyn,missing' plot(x, y, dilute = 5, ...)
x |
DeponsBlockdyn object |
y |
Not used |
dilute |
Integer. Plot only one in every 'dilute' values. Defaults to 5, which yields a plot of the first simulated value and one in every five of the following values. |
... |
Optional plotting parameters |
data.frame
listing blocks where no animals were counted
(returned invisibly)
The function returns a data frame with numbers of blocks with no agents.
data("porpoisebdyn") my.col <- c("red", "darkgreen", "orange") plot(porpoisebdyn, col=my.col) legend("bottomright", bty="n", fill=my.col, legend=paste("Block", 0:2)) # Show all data points for small range of x-values plot(porpoisebdyn, xlim=c(1950, 2050), ylim=c(4850, 5050), type="p", dilute=1, col=my.col)
data("porpoisebdyn") my.col <- c("red", "darkgreen", "orange") plot(porpoisebdyn, col=my.col) legend("bottomright", bty="n", fill=my.col, legend=paste("Block", 0:2)) # Show all data points for small range of x-values plot(porpoisebdyn, xlim=c(1950, 2050), ylim=c(4850, 5050), type="p", dilute=1, col=my.col)
Plot population dynamics simulated with DEPONS
## S4 method for signature 'DeponsDyn,missing' plot(x, y, dilute = 5, plot.energy = TRUE, plot.legend = TRUE, ...)
## S4 method for signature 'DeponsDyn,missing' plot(x, y, dilute = 5, plot.energy = TRUE, plot.legend = TRUE, ...)
x |
DeponsDyn object |
y |
Not used |
dilute |
Integer. Plot only one in every 'dilute' values. Defaults to 5, which yields a plot of the first simulated value and one in every five of the following values. |
plot.energy |
If set to TRUE it plots the amount of energy stored in simulated and in the landscape in addition to the population count |
plot.legend |
If set to TRUE, a legend is plotted |
... |
Optional plotting parameters |
data("porpoisedyn") # Plot for specific range of years rg <- c(as.POSIXlt("2011-01-01"), as.POSIXlt("2018-12-31")) plot(porpoisedyn, xlim=as.POSIXct(rg), plot.energy=TRUE) ## Not run: # Read data from default DEPONS simulation directory: sim.dir <- "/Applications/DEPONS 2.1/DEPONS" new.sim.name <- get.latest.sim(dir=sim.dir) new.sim.out <- read.DeponsDyn(fname=paste(sim.dir, new.sim.name, sep="/")) plot(new.sim.out) ## End(Not run)
data("porpoisedyn") # Plot for specific range of years rg <- c(as.POSIXlt("2011-01-01"), as.POSIXlt("2018-12-31")) plot(porpoisedyn, xlim=as.POSIXct(rg), plot.energy=TRUE) ## Not run: # Read data from default DEPONS simulation directory: sim.dir <- "/Applications/DEPONS 2.1/DEPONS" new.sim.name <- get.latest.sim(dir=sim.dir) new.sim.out <- read.DeponsDyn(fname=paste(sim.dir, new.sim.name, sep="/")) plot(new.sim.out) ## End(Not run)
Plot the values in a DeponsRaster object. Porpoisetracks or other kinds of lines, poits etc. can be drawn on top of the plot by adding
## S4 method for signature 'DeponsRaster,ANY' plot(x, y, col, trackToPlot = 1, ...)
## S4 method for signature 'DeponsRaster,ANY' plot(x, y, col, trackToPlot = 1, ...)
x |
|
y |
A |
col |
A color palette, i.e. a vector of n contiguous colors. Reasonable defaults are provided. |
trackToPlot |
Integer indicating which track to plot if the DeponsTrack
object contains more than one track. Ignored if |
... |
Other optional plotting parameters, including 'axes', 'legend', and 'main'. |
No return value, called for side effects
See method for plot
in the raster
package for plotting parameters and plot.DeponsTrack
for
plotting of DeponsRasters cropped to the extent of tracks.
Plot the tracks that ship agents move along in DEPONS.
## S4 method for signature 'DeponsShips,missing' plot(x, y, ...)
## S4 method for signature 'DeponsShips,missing' plot(x, y, ...)
x |
DeponsShips object |
y |
Not used |
... |
Optional plotting parameters, including 'col', 'main', 'add.legend', and 'legend.xy' (defaults to 'topright' when add.legend=TRUE) |
No return value, called for side effects
data(shipdata) plot(shipdata, col=c("red", "green", "blue")) # convert route coordinate units from 'grid squares' to UTM data(bathymetry) out <- summary(bathymetry) left <- out[[4]][1] bottom <- out[[4]][2] for (i in 1:3) { newroute <- shipdata@routes[[2]][[i]]*400 newroute$x <- newroute$x + as.numeric(left) newroute$y <- newroute$y + as.numeric(bottom) shipdata@routes[[2]][[i]] <- newroute } # Reproject coastline and clip to size of Kattegat landscape library(sp) data(bathymetry) data(coastline) coastline_sf <- sf::st_as_sf(coastline) coastline2 <- sf::st_transform(coastline_sf, crs(bathymetry)) bbox <- bbox(bathymetry) clip.poly <- make.clip.poly(bbox, crs(bathymetry)) plot(shipdata, col=c("red", "green", "blue"), add=TRUE, add.legend=TRUE) plot(clip.poly, add=TRUE)
data(shipdata) plot(shipdata, col=c("red", "green", "blue")) # convert route coordinate units from 'grid squares' to UTM data(bathymetry) out <- summary(bathymetry) left <- out[[4]][1] bottom <- out[[4]][2] for (i in 1:3) { newroute <- shipdata@routes[[2]][[i]]*400 newroute$x <- newroute$x + as.numeric(left) newroute$y <- newroute$y + as.numeric(bottom) shipdata@routes[[2]][[i]] <- newroute } # Reproject coastline and clip to size of Kattegat landscape library(sp) data(bathymetry) data(coastline) coastline_sf <- sf::st_as_sf(coastline) coastline2 <- sf::st_transform(coastline_sf, crs(bathymetry)) bbox <- bbox(bathymetry) clip.poly <- make.clip.poly(bbox, crs(bathymetry)) plot(shipdata, col=c("red", "green", "blue"), add=TRUE, add.legend=TRUE) plot(clip.poly, add=TRUE)
Plot the coordinates in a movement track simulated with DEPONS.
## S4 method for signature 'DeponsTrack,missing' plot(x, y, trackToPlot = 1, add = FALSE, ...)
## S4 method for signature 'DeponsTrack,missing' plot(x, y, trackToPlot = 1, add = FALSE, ...)
x |
DeponsTrack object |
y |
Not used |
trackToPlot |
Integer; indicates which track to plot if there is more than one track in the object. Defaults to 1 |
add |
Logical, whether to add the track to an existing plot one animal was tracked during the simulation. |
... |
Optional plotting parameters |
No return value, called for side effects
data(porpoisetrack) data("porpoisetrack") plot(porpoisetrack)
data(porpoisetrack) data("porpoisetrack") plot(porpoisetrack)
An object of class DeponsBlockdyn
with output from a DEPONS
simulation based on the North Sea landscape, using a landscape divided into
two blocks. Numbers of animals are counted per block.
DeponsBlockdyn
DeponsBlockdyn-class
, porpoisedyn
An object of class DeponsDyn
with output from a DEPONS
simulation based on the Kattegat landscape, assuming that the simulation
represents the period 2010-01-01 onward in the real world. Number of animals
and energy availability is recorded for the entire landscape.
DeponsDyn
An object with five elements: title
, landscape
,
simtime
, crs
, and tracks
. The crs
stores information
about the map projection used ("+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs").
The tracks
element is a list of objects of class
SpatialPointsDataFrame
, each ofwhich corresponds to one
simulated animal. simtime
is the simulation date.
DeponsTrack
Function for reading DEPONS simulation output with number of animals per block for each time step.
read.DeponsBlockdyn( fname, title = "NA", landscape = "NA", simtime = "NA", startday = "NA" )
read.DeponsBlockdyn( fname, title = "NA", landscape = "NA", simtime = "NA", startday = "NA" )
fname |
Name of the file (character) that contains movement data generated by DEPONS. The name includes the path to the directory if this is not the current working directory. |
title |
Optional character string giving name of simulation |
landscape |
The landscape used in the simulation |
simtime |
Optional text string with date of simulation (format: yyyy-mm-dd). If not provided this is obtained from name of input file |
startday |
The start of the period that the simulation represents, i.e. the real-world equivalent of 'tick 1' (POSIXlt) |
DeponsBlockdyn
object
See DeponsBlockdyn-class
for details on what is stored in
the output object and read.DeponsParam
for reading the parameters
used in the simulation.
## Not run: # File loaded from default location the.file <- "/Applications/DEPONS 2.1/DEPONS/PorpoisePerBlock.2020.Sep.02.20_24_17.csv" file.exists(the.file) porpoise.blockdyn <- read.DeponsBlockdyn(fname=the.file, title="Test simulation with two blocks", landscape="North Sea") porpoise.blockdyn # Get the latest simulation the.file <- get.latest.sim(type="blockdyn", dir="/Applications/DEPONS 2.1/DEPONS") owd <- getwd() setwd("/Applications/DEPONS 2.1/DEPONS") porpoise.blockdyn <- read.DeponsBlockdyn(fname=the.file) setwd(owd) ## End(Not run)
## Not run: # File loaded from default location the.file <- "/Applications/DEPONS 2.1/DEPONS/PorpoisePerBlock.2020.Sep.02.20_24_17.csv" file.exists(the.file) porpoise.blockdyn <- read.DeponsBlockdyn(fname=the.file, title="Test simulation with two blocks", landscape="North Sea") porpoise.blockdyn # Get the latest simulation the.file <- get.latest.sim(type="blockdyn", dir="/Applications/DEPONS 2.1/DEPONS") owd <- getwd() setwd("/Applications/DEPONS 2.1/DEPONS") porpoise.blockdyn <- read.DeponsBlockdyn(fname=the.file) setwd(owd) ## End(Not run)
Function for reading simulation output produced by DEPONS.
read.DeponsDyn( fname, title = "NA", landscape = "NA", simtime = "NA", startday = "NA", timestep = 30, tz = "GMT" )
read.DeponsDyn( fname, title = "NA", landscape = "NA", simtime = "NA", startday = "NA", timestep = 30, tz = "GMT" )
fname |
Name of the file (character) that contains number of animals for each time step during the simulation, along with their energy and the amount of food in the landscape. The name includes the path to the directory if this is not the current working directory. |
title |
Optional character string giving name of simulation |
landscape |
The landscape used in the simulation |
simtime |
Optional character string with the date and time when the simulation finished (format yyyy-mm-dd). If not provided this is obtained from name of input file |
startday |
The start of the period that the simulation represents, i.e. the real-world equivalent of 'tick 1' (character string of the form 'yyyy-mm-dd', or POSIXlt) |
timestep |
Time step used in the model, in minutes. Defaults to 30 in DEPONS. |
tz |
Time zone. |
DeponsDyn
object containing simulation output
See DeponsDyn-class
for details on what is stored in
the output object and as.data.frame
for converting from data
frame.
## Not run: dyn.file <- "/Applications/DEPONS 2.1/DEPONS/Statistics.2020.Sep.02.20_24_17.csv" file.exists(dyn.file) porpoisedyn <- read.DeponsDyn(dyn.file, startday=as.POSIXlt("2010-01-01")) porpoisedyn ## End(Not run)
## Not run: dyn.file <- "/Applications/DEPONS 2.1/DEPONS/Statistics.2020.Sep.02.20_24_17.csv" file.exists(dyn.file) porpoisedyn <- read.DeponsDyn(dyn.file, startday=as.POSIXlt("2010-01-01")) porpoisedyn ## End(Not run)
Read the parameters that were used for running a specific DEPONS simulation
read.DeponsParam(fname)
read.DeponsParam(fname)
fname |
Name of the XML file (character) that contains the parameter list used for running a DEPONS simulation. The name includes the path to the directory if this is not the current working directory. |
The parameter file can be generated from within DEPONS by pressing the 'Save' icon after modifying the user settings on the 'Parameters' tab within the main DEPONS model window. See TRACE document for details regarding the parameters in the model: https://github.com/jacobnabe/DEPONS. It is strongly recommended that the parameter list is stored with the simulation output.
Data frame containing all parameters used in a specific simulation
## Not run: # Parameters read from file created by DEPONS run in interactive mode the.file <- "/Applications/DEPONS 2.1/DEPONS/DEPONS.rs/parameters.xml" pfile <- read.DeponsParam(the.file) ## End(Not run)
## Not run: # Parameters read from file created by DEPONS run in interactive mode the.file <- "/Applications/DEPONS 2.1/DEPONS/DEPONS.rs/parameters.xml" pfile <- read.DeponsParam(the.file) ## End(Not run)
Function for reading raster files that have been used in DEPONS simulations. DEPONS rasters define amount of food available for simulated animals, spatial distribution of food patches, bathymetry, and distance to coast (dtc). The 'blocks' raster enables the user to count animals in specific parts of the landscape during simulations. See Nabe-Nielsen et al. (2018) for details regarding these files. In DEPONS 2.0 the salinity raster file was introduced; see TRACE document for details: https://github.com/jacobnabe/DEPONS
read.DeponsRaster(fname, type = "NA", landscape = "NA", crs = "NA")
read.DeponsRaster(fname, type = "NA", landscape = "NA", crs = "NA")
fname |
Filename (character), including the path to the DEPONS raster file. |
type |
The kind of data stored in the raster; c('food', 'patches', 'bathymetry', 'dtc', 'salinity', 'blocks'). |
landscape |
Identifier for the landscape used in the DEPONS simulations; typically set to 'North Sea'. |
crs |
CRS-object providing the map projection (see CRS). |
Returns a DeponsRaster object. The object inherits slots from the "RasterLayer" class, including "title", which is used for storing the file name.
Nabe-Nielsen, J., van Beest, F. M., Grimm, V., Sibly, R. M., Teilmann, J., & Thompson, P. M. (2018). Predicting the impacts of anthropogenic disturbances on marine populations. Conservation Letters, 11(5), e12563. doi:10.1111/conl.12563
Function for reading the json-files that are used for controlling how ship agents behave in DEPONS. Ships move along pre-defined routes in 30-min time steps. The routes are defined by the fix-points provided in the json file, and the geographic projection is assumed to match that of the landscape.
read.DeponsShips(fname, title = "NA", landscape = "NA", crs = as.character(NA))
read.DeponsShips(fname, title = "NA", landscape = "NA", crs = as.character(NA))
fname |
Name of the file (character) where ship routes and ships are defined. |
title |
Optional character string with the name of the simulation |
landscape |
Optional character string with the landscape used in the simulation |
crs |
Character, coordinate reference system (map projection) |
Returns an object with the elements title
landscape
,
crs
, routes
and ships
.
Function for reading movement tracks produced by DEPONS. These describe movements of simulated animals within the simulation landscape, where the positions after each 30-min time step are provided using the coordinate reference system that were used for generating these landscapes.See van Beest et al. (2018) and Nabe-Nielsen et al. (2013) for details regarding how these files were generated as a balance between correlated random walk behaviour and spatial memory behaviour, which allows animals to return to previously visited food patches.
read.DeponsTrack( fname, title = "NA", landscape = "NA", simtime = "NA", crs = as.character(NA), tz = "UTC" )
read.DeponsTrack( fname, title = "NA", landscape = "NA", simtime = "NA", crs = as.character(NA), tz = "UTC" )
fname |
Name of the file (character) that contains movement data generated by DEPONS. The name includes the path to the directory if this is not the current working directory. |
title |
Optional character string giving name of simulation |
landscape |
Optional character string with the landscape used in the simulation |
simtime |
Character sting with date of simulation (format yyyy-mm-dd). If not provided this is obtained from name of input file |
crs |
Character, coordinate reference system (map projection) |
tz |
Time zone used in simulations. Defaults to UTC/GMT. #' |
Returns a DeponsTrack
object with the elements title
,
simtime
, crs
, and tracks
. The date
is extracted
from input data if not provided explicitly and stored as a
POSIXlt
object. The element tracks
is a list of objects
of class SpatialPointsDataFrame, each of which corresponds to one
simulated animal (several animals can be tracked in one simulation).
data(porpoisetrack) # Load data for use in example # Use standard DEPONS coordinate reference system / map projection: the.crs <- "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +datum=WGS84 +units=m +no_defs" ## Not run: one.fname <- "~/Applications/DEPONS/ RandomPorpoise.2020.Jul.31.09_43_10.csv" porpoisetrack <- read.DeponsTrack(one.fname, title="Track simulated using DEPONS 2.0", crs=the.crs) ## End(Not run) # Plot the first of the simulated tracks plot(porpoisetrack)
data(porpoisetrack) # Load data for use in example # Use standard DEPONS coordinate reference system / map projection: the.crs <- "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +datum=WGS84 +units=m +no_defs" ## Not run: one.fname <- "~/Applications/DEPONS/ RandomPorpoise.2020.Jul.31.09_43_10.csv" porpoisetrack <- read.DeponsTrack(one.fname, title="Track simulated using DEPONS 2.0", crs=the.crs) ## End(Not run) # Plot the first of the simulated tracks plot(porpoisetrack)
Get or define routes in DeponsShips objects
## S4 method for signature 'DeponsShips' routes(x) ## S4 replacement method for signature 'DeponsShips' routes(x) <- value
## S4 method for signature 'DeponsShips' routes(x) ## S4 replacement method for signature 'DeponsShips' routes(x) <- value
x |
Object of class |
value |
list with one named element per shipping route. Each element is a data frame with the variables x, y, speed, and 'pause' which define the coordinates of the fix-points on the shipping routes and the speeds that ships have after passing the fix point and until reaching the next fix point. The variable 'pause' instructs ships about how many minutes to wait before continuing to move. |
The unit of 'speed' is knots.
The ship routes and ships used in the study by Nabe-Nielsen et al. (2014). The fix points that define the routes use the UTM zone 32 projection, (EPSG:32632; see https://epsg.io/32632).
The definitions of the ships has been modified since earlier versions of DEPONS (i.e. 2.1 and erlier) in that it now includes ship length, type, and speed (in knots). These are used for calculating the sound source level (following McGilliwray)
Automatic identification system (AIS) data for three ships in Kattegat and the Western Baltic from 20 Dec 2015. The data set includes the variables id (the Maritime Mobile Service Identity number), time, speed (in knots), type, length (in meters), x and y (which provide the coordinates of the ship at a given time. The coordinates use the UTM zone 32 projection (CRS = "+proj=utm +zone=32 +units=m +no_defs +datum=WGS84"). Data were downloaded from the Danish Maritime Authority web page (https://www.dma.dk).
DeponsShips
data.frame
MacGillivray A & de Jong C (2021). A Reference Spectrum Model for Estimating Source Levels of Marine Shipping Based on Automated Identification System Data. J Mar Sci Eng 9:369 . doi:10.3390/jmse9040369
Nabe-Nielsen, J., Sibly, R. M., Tougaard, J., Teilmann, J., & Sveegaard, S. (2014). Effects of noise and by-catch on a Danish harbour porpoise population. Ecological Modelling, 272, 242–251. doi:10.1016/j.ecolmodel.2013.09.025
Get or define ships in DeponsShips objects
## S4 method for signature 'DeponsShips' ships(x) ships(x) <- value
## S4 method for signature 'DeponsShips' ships(x) ships(x) <- value
x |
Object of class |
value |
data frame with the 'name', 'type', 'length', and 'route' of ships to be simulated, as well as 'tickStart' and 'tickEnd' defining when the ships are to be included in simulations. 'route' is one of the shipping routes defined in the DeponsShips object. |
data(shipdata) ships(shipdata)
data(shipdata) ships(shipdata)
Get or set start date for simulation
Get or set start date for simulation
## S4 method for signature 'DeponsBlockdyn' startday(x) ## S4 method for signature 'DeponsDyn' startday(x) ## S4 replacement method for signature 'DeponsBlockdyn' startday(x) <- value ## S4 replacement method for signature 'DeponsDyn' startday(x) <- value
## S4 method for signature 'DeponsBlockdyn' startday(x) ## S4 method for signature 'DeponsDyn' startday(x) ## S4 replacement method for signature 'DeponsBlockdyn' startday(x) <- value ## S4 replacement method for signature 'DeponsDyn' startday(x) <- value
x |
Object of class |
value |
POSIXlt or character string of the form 'yyyy-mm-dd' |
The start date indicates the start of the period that the simulation is supposed to represent.
The start date indicates the start of the period that the simulation is supposed to represent.
The assignment of a new start time is currently quite time consuming.
Summarizes different kinds of objects created based on output from the DEPONS model
## S4 method for signature 'DeponsBlockdyn' summary(object) ## S4 method for signature 'DeponsDyn' summary(object) ## S4 method for signature 'DeponsRaster' summary(object) ## S4 method for signature 'DeponsShips' summary(object) ## S4 method for signature 'DeponsTrack' summary(object)
## S4 method for signature 'DeponsBlockdyn' summary(object) ## S4 method for signature 'DeponsDyn' summary(object) ## S4 method for signature 'DeponsRaster' summary(object) ## S4 method for signature 'DeponsShips' summary(object) ## S4 method for signature 'DeponsTrack' summary(object)
object |
Depons* object |
The summary method is available for DeponsTrack-class
,
DeponsDyn-class
, DeponsRaster-class
,
and DeponsBlockdyn-class
-objects.
list summarizing the DeponsBlockdyn object
table summarizing the DeponsBlockdyn object
list summarizing the DeponsRaster object
list summarizing the DeponsTrack object
Converts the number of ticks since the start of the simulation to a specific date while taking into account that DEPONS assumes that there are 360 days in a simulation year.
tick.to.time(tick, timestep = 30, origin = "2010-01-01", ...)
tick.to.time(tick, timestep = 30, origin = "2010-01-01", ...)
tick |
Numeric, or numeric vector; tick number |
timestep |
Numeric; length of each simulation time step, in minutes. Defaults to 30 minutes. |
origin |
Character. The first day in the period that the simulation represents, format: 'yyyy-mm-dd'. |
... |
Optional parameters, including time zone (tz) |
object of class as.POSIXlt
The function assumes that there are 30 days in each month, except in January, February and March with 31, 28 and 31 days, respectively.
Get or set the title of Depons* objects
## S4 replacement method for signature 'DeponsTrack' title(x) <- value ## S4 replacement method for signature 'DeponsDyn' title(x) <- value ## S4 replacement method for signature 'DeponsShips' title(x) <- value ## S4 method for signature 'DeponsTrack' title(x, value) ## S4 method for signature 'DeponsDyn' title(x, value) ## S4 method for signature 'DeponsShips' title(x, value)
## S4 replacement method for signature 'DeponsTrack' title(x) <- value ## S4 replacement method for signature 'DeponsDyn' title(x) <- value ## S4 replacement method for signature 'DeponsShips' title(x) <- value ## S4 method for signature 'DeponsTrack' title(x, value) ## S4 method for signature 'DeponsDyn' title(x, value) ## S4 method for signature 'DeponsShips' title(x, value)
x |
Object of class |
value |
Character string |
Function for writing a json-file for controlling how ship agents behave in DEPONS. Ships move along pre-defined routes in 30-min time steps. The routes are defined by the fix-points provided in the json file, and the geographic projection is assumed to match that of the landscape. The projection is not stored as part of the json file.
## S4 method for signature 'DeponsShips' write(x, file)
## S4 method for signature 'DeponsShips' write(x, file)
x |
Name of the DeponsShips object to be exported |
file |
Name of the output file (character) |
No return value, called for side effects
The exported json file is intended for use in DEPONS 2.3 or later (released July 2022) where the sound pressure level (SPL) is calculated within DEPONS based on ship type, ship length and speed.