Skip to content

Commit

Permalink
use new parcels api for particle class
Browse files Browse the repository at this point in the history
  • Loading branch information
surgura committed Jun 2, 2024
1 parent fe47b0c commit 4956494
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 8 additions & 5 deletions virtual_ship/instruments/ctd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ class CTDInstrument:
max_depth: float


class _CTDParticle(JITParticle):
salinity = Variable("salinity", initial=np.nan)
temperature = Variable("temperature", initial=np.nan)
raising = Variable("raising", dtype=np.int32, initial=0.0)
max_depth = Variable("max_depth", dtype=np.float32)
_CTDParticle = JITParticle.add_variables(
[
Variable("salinity", initial=np.nan),
Variable("temperature", initial=np.nan),
Variable("raising", dtype=np.int32, initial=0.0),
Variable("max_depth", dtype=np.float32),
]
)


def _sample_temperature(particle, fieldset, time):
Expand Down
10 changes: 5 additions & 5 deletions virtual_ship/instruments/drifter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class Drifter:
min_depth: float


class _DrifterParticle(JITParticle):
temperature = Variable(
"temperature",
initial=np.nan,
)
_DrifterParticle = JITParticle.add_variables(
[
Variable("temperature", initial=np.nan),
]
)


def _sample_temperature(particle, fieldset, time):
Expand Down

0 comments on commit 4956494

Please sign in to comment.