trackit_2D: Trackit 2D

Description Usage Arguments Details Value Examples

View source: R/trackit_2D.R

Description

Function to track particles through a ROMS-field in 2D-space.

Usage

1
2
3
4
5
6
trackit_2D(pts, romsobject, w_sink = 100, time = 50,
  sedimentation = FALSE, particle_radius = 0.00016,
  force_final_settling = FALSE, romsparams = NULL,
  sedimentationparams = NULL, loop_trackit = FALSE,
  time_steps_in_s = 1800, uphill_restricted = NULL,
  sed_at_max_speed = FALSE, mean_move = FALSE)

Arguments

pts

input points

w_sink

sinking rate in m/days

time

total number of days to run the model

sedimentation

defines stopping conditions for the particles. If TRUE, particles stop depending on their size and on the current speed and number of particles in a cell

particle_radius

particle radius for the sedimentation, default is set to 0.16mm

force_final_settling

This can be set to TRUE to force all floating particles at the end of the model-run to settle. This is useful because otherwise a stopindex for those points is not defined

romsparams

parameters that are filled when this function is called from loopit

sedimentationparams

parameters estimated through the buildparams-function

uphill_restricted

define whether particles are restricted from moving uphill, defined as from how many meters difference particles cannot cross between cells

mean_move

to use when uphill_resticted is TRUE. Checks the final position of the particles and when usually they would be located back at their starting point for violating the uhill restriction, the code iterates to find a position in between that might still belong to the ROMS-cell the particle originates from

kdtree

kd tree

Details

Due to the limitation of RAM available, time is restricted depending on the number of particles (too long runs might give an error because the generated vector is too large) If sedimentation=TRUE, then particles stop in areas with low current speed. default is FALSE

Value

list(ptrack = ptrack, pnow = pnow, plast = plast, stopindex = stopindex, indices = indices, indices_2D = indices_2D)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
data(surface_chl)
data(toyROMS)
pts_seeded <- create_points_pattern(surface_chl, multi=100)
track <- trackit_2D(pts = pts_seeded, romsobject = toyROMS, force_final_settling=TRUE)

## where points end up
plot(track$pnow, col="red", cex=0.1)
points(pts_seeded, cex=0.1)

## where points stop
pend <- data.frame(matrix(NA, ncol=2, nrow=nrow(pts_seeded)))
for(irow in 1:nrow(pts_seeded)){
  pend[irow,] <- track$ptrack[irow,1:2,track$stopindex]
}
plot(pend, col="red", cex=0.6)
points(pts_seeded)

## with stronger currents:
toyROMS2 <- toyROMS
toyROMS2$i_u <- toyROMS$i_u*5
toyROMS2$i_v <- toyROMS$i_v*5
track <- trackit_2D(pts = pts_seeded, romsobject = toyROMS2)
plot(pts_seeded)
points(track$pnow, col="red", cex=0.6)







## looking at the results together with roms:
library(rasterVis)
library(rgdal)
library(rgl)

ra <- raster(nrow = 50, ncol = 50, ext = extent(surface_chl))
r_roms <- rasterize(x = cbind(as.vector(toyROMS$lon_u), as.vector(toyROMS$lat_u)), y = ra, field = as.vector(-toyROMS$h))
plot(r_roms)

## what the floor-current-speed looks like
ra <- raster(nrow = 50, ncol = 50, ext = extent(surface_chl))
i_uv_roms <- rasterize(x = cbind(as.vector(toyROMS$lon_u), as.vector(toyROMS$lat_u)), y = ra, field = sqrt(as.vector(toyROMS$i_u)^2 + as.vector(toyROMS$i_v)^2))
plot(i_uv_roms)

janjansen86/ptrackr documentation built on May 18, 2019, 2:38 p.m.