1616
1717def AdvectionRK4 (particle , fieldset , time ): # pragma: no cover
1818 """Advection of particles using fourth-order Runge-Kutta integration."""
19- import numpy as np
20-
21- dt = particle .dt / np .timedelta64 (1 , "s" ) # TODO improve API for converting dt to seconds
19+ dt = particle .dt / np .timedelta64 (1 , "s" ) # noqa TODO improve API for converting dt to seconds
2220 (u1 , v1 ) = fieldset .UV [particle ]
2321 lon1 , lat1 = (particle .lon + u1 * 0.5 * dt , particle .lat + v1 * 0.5 * dt )
2422 (u2 , v2 ) = fieldset .UV [time + 0.5 * dt , particle .depth , lat1 , lon1 , particle ]
@@ -32,9 +30,7 @@ def AdvectionRK4(particle, fieldset, time): # pragma: no cover
3230
3331def AdvectionRK4_3D (particle , fieldset , time ): # pragma: no cover
3432 """Advection of particles using fourth-order Runge-Kutta integration including vertical velocity."""
35- import numpy as np
36-
37- dt = particle .dt / np .timedelta64 (1 , "s" ) # TODO improve API for converting dt to seconds
33+ dt = particle .dt / np .timedelta64 (1 , "s" ) # noqa TODO improve API for converting dt to seconds
3834 (u1 , v1 , w1 ) = fieldset .UVW [particle ]
3935 lon1 = particle .lon + u1 * 0.5 * dt
4036 lat1 = particle .lat + v1 * 0.5 * dt
@@ -57,9 +53,7 @@ def AdvectionRK4_3D_CROCO(particle, fieldset, time): # pragma: no cover
5753 """Advection of particles using fourth-order Runge-Kutta integration including vertical velocity.
5854 This kernel assumes the vertical velocity is the 'w' field from CROCO output and works on sigma-layers.
5955 """
60- import numpy as np
61-
62- dt = particle .dt / np .timedelta64 (1 , "s" ) # TODO improve API for converting dt to seconds
56+ dt = particle .dt / np .timedelta64 (1 , "s" ) # noqa TODO improve API for converting dt to seconds
6357 sig_dep = particle .depth / fieldset .H [time , 0 , particle .lat , particle .lon ]
6458
6559 (u1 , v1 , w1 ) = fieldset .UVW [time , particle .depth , particle .lat , particle .lon , particle ]
@@ -103,9 +97,7 @@ def AdvectionRK4_3D_CROCO(particle, fieldset, time): # pragma: no cover
10397
10498def AdvectionEE (particle , fieldset , time ): # pragma: no cover
10599 """Advection of particles using Explicit Euler (aka Euler Forward) integration."""
106- import numpy as np
107-
108- dt = particle .dt / np .timedelta64 (1 , "s" ) # TODO improve API for converting dt to seconds
100+ dt = particle .dt / np .timedelta64 (1 , "s" ) # noqa TODO improve API for converting dt to seconds
109101 (u1 , v1 ) = fieldset .UV [particle ]
110102 particle_dlon += u1 * dt # noqa
111103 particle_dlat += v1 * dt # noqa
@@ -121,11 +113,7 @@ def AdvectionRK45(particle, fieldset, time): # pragma: no cover
121113 Time-step dt is halved if error is larger than fieldset.RK45_tol,
122114 and doubled if error is smaller than 1/10th of tolerance.
123115 """
124- import numpy as np
125-
126- dt = min (particle .next_dt , fieldset .RK45_max_dt ) / np .timedelta64 (
127- 1 , "s"
128- ) # TODO improve API for converting dt to seconds
116+ dt = min (particle .next_dt , fieldset .RK45_max_dt ) / np .timedelta64 (1 , "s" ) # noqa TODO improve API for converting dt to seconds
129117 c = [1.0 / 4.0 , 3.0 / 8.0 , 12.0 / 13.0 , 1.0 , 1.0 / 2.0 ]
130118 A = [
131119 [1.0 / 4.0 , 0.0 , 0.0 , 0.0 , 0.0 ],
0 commit comments