Skip to content

Commit 40d0d6d

Browse files
committed
add bathymetry to test argo fieldset
1 parent e1ff3ee commit 40d0d6d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/virtualship/instruments/argo_float.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from typing import ClassVar
55

66
import numpy as np
7+
78
from parcels import (
89
AdvectionRK4,
910
JITParticle,
1011
ParticleSet,
1112
StatusCode,
1213
Variable,
1314
)
14-
1515
from virtualship.instruments.base import Instrument
1616
from virtualship.instruments.types import InstrumentType
1717
from virtualship.models.spacetime import Spacetime
@@ -196,8 +196,6 @@ def simulate(self, measurements, out_path) -> None:
196196

197197
fieldset = self.load_input_data()
198198

199-
breakpoint()
200-
201199
shallow_waypoints = {}
202200
for i, m in enumerate(measurements):
203201
loc_bathy = fieldset.bathymetry.eval(

tests/instruments/test_argo_float.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import numpy as np
66
import xarray as xr
7-
from parcels import FieldSet
87

8+
from parcels import FieldSet
99
from virtualship.instruments.argo_float import ArgoFloat, ArgoFloatInstrument
1010
from virtualship.models import Location, Spacetime
1111

@@ -27,6 +27,7 @@ def test_simulate_argo_floats(tmpdir) -> None:
2727
u = np.full((2, 2, 2), 1.0)
2828
t = np.full((2, 2, 2), CONST_TEMPERATURE)
2929
s = np.full((2, 2, 2), CONST_SALINITY)
30+
bathy = np.full((2, 2), -5000.0)
3031

3132
fieldset = FieldSet.from_data(
3233
{"V": v, "U": u, "T": t, "S": s},
@@ -39,6 +40,15 @@ def test_simulate_argo_floats(tmpdir) -> None:
3940
],
4041
},
4142
)
43+
fieldset.add_field(
44+
FieldSet.from_data(
45+
{"bathymetry": bathy},
46+
{
47+
"lon": np.array([0.0, 10.0]),
48+
"lat": np.array([0.0, 10.0]),
49+
},
50+
).bathymetry
51+
)
4252

4353
# argo floats to deploy
4454
argo_floats = [

0 commit comments

Comments
 (0)