Skip to content

Commit

Permalink
drifter test
Browse files Browse the repository at this point in the history
  • Loading branch information
surgura committed May 28, 2024
1 parent b8c5fca commit 0672d8c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/instruments/test_drifters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Test the simulation of drifters."""

from virtual_ship.instruments.drifter import simulate_drifters, Drifter
from virtual_ship.instruments import Location
from parcels import FieldSet
import numpy as np
from datetime import timedelta


def test_simulate_drifters() -> None:
fieldset = FieldSet.from_data(
{"U": 0, "V": 0, "T": 0},
{
"lon": 0,
"lat": 0,
"time": [np.datetime64("1950-01-01") + np.timedelta64(632160, "h")],
},
)

min_depth = -fieldset.U.depth[0]

drifters = [
Drifter(
location=Location(latitude=0, longitude=0),
deployment_time=0,
min_depth=min_depth,
)
]

simulate_drifters(
drifters=drifters,
fieldset=fieldset,
out_file_name="test",
outputdt=timedelta(minutes=5),
)

0 comments on commit 0672d8c

Please sign in to comment.