-
Notifications
You must be signed in to change notification settings - Fork 1
Particle_Tracking
Ben Tupper edited this page Feb 28, 2023
·
1 revision
Open a connection to a FVCOM data source. In this example the Scituate (MA) Harbor Inundation.
suppressPackageStartupMessages({
library(sf)
library(fvcom)
library(dplyr)
})
(X = ScituatePhysics())
## Scituate_Physics class: http://www.smast.umassd.edu:8080/thredds/dodsC/models/fvcom/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_SCITUATE_FORECAST.nc
## CRS : +init=nad83:1802
## zvar : siglay
## t0 : 1858-11-17T00:00:00 UTC
## n timesteps: 1729
## n elements : 11153
## n nodes : 5620
## verbose : FALSE
Select two starting locations at random.
p <- X$random_points(n = 2, select_z = "surface") |>
glimpse()
## Rows: 2
## Columns: 3
## $ elem <int> 184, 726
## $ time <dttm> 2022-12-21, 2022-12-21
## $ geometry <POINT [m]> POINT Z (856645.5 -69579.34..., POINT Z (854905.7 -68746.12..…
Now track each particle - there are a number of options, see
?particle_track
for details.
track = particle_track(X, p,
tstep = 60 * 10,
tmax = 3600 * 36,
fixed_z = TRUE)
A simple plot. It would be nicer if we showed the shoreline for context.
plot_track(track, X = X, title = "Scituate")