Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
edbda0b
add info on sensor configuration
j-atkins May 20, 2026
cd5b523
add list of available sensors to documentation
j-atkins May 20, 2026
4668e54
remove redundant TODO
j-atkins May 20, 2026
ae2d528
improve phrasing
j-atkins May 20, 2026
17d5b40
add details on sensor configurations to quickstart guide
j-atkins May 20, 2026
baa982a
update sail_the_ship with sensor configuration instructions
j-atkins May 20, 2026
a8a4978
enahnce phrasing
j-atkins May 20, 2026
6b3628e
add testing that docs match the code for sensor options, ensure instr…
j-atkins May 20, 2026
e23087b
add check that all instruments in code are addressed in sensor table
j-atkins May 20, 2026
a5ff3a4
update environments to pull parcels v4 alpha
j-atkins May 20, 2026
db44324
changed parcels logging api
j-atkins May 20, 2026
6f732d3
first wave of changes to the instrument logic with v4 logic, and part…
j-atkins May 20, 2026
71881cc
remove add dummy UV func, shouldn't be needed in v4 (?)
j-atkins May 20, 2026
62b2b1b
pull v4 from parcels/main
j-atkins May 20, 2026
38afc56
use AdvectionRK2
j-atkins May 20, 2026
573da9e
migrate fieldset ingestion protocol
j-atkins May 20, 2026
d13a036
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 20, 2026
5c7fd29
standardise variable naming for bathy data ingestion
j-atkins May 21, 2026
ee17230
env fixes
j-atkins May 21, 2026
72161df
Merge branch 'main' into migrate-v4
j-atkins May 21, 2026
92e74bd
add ipdb for devs
j-atkins May 21, 2026
0a83437
further changes to suit v4
j-atkins May 21, 2026
ca9e306
first steps considering handling depth positive up or down
j-atkins May 22, 2026
d4093cf
Merge branch 'migrate-v4' of github.com:OceanParcels/virtualship into…
j-atkins May 22, 2026
63122b9
refactor to _compute_max_depths; more changes in line with Parcels v4…
j-atkins May 26, 2026
a6ad631
depth -> z in ParticleSet's
j-atkins May 26, 2026
8e0a33f
times to datetime64 and update fieldset eval output
j-atkins May 28, 2026
8b76854
tmp ds.load() step for v4.0
j-atkins May 29, 2026
27c36e2
Merge branch 'main' into migrate-v4
j-atkins Jun 5, 2026
81f857f
error messaging in argo floats
j-atkins Jun 5, 2026
cd2f9ff
refactor _generate_fieldset()
j-atkins Jun 5, 2026
39e63d1
small tidy up
j-atkins Jun 5, 2026
0dc5975
from zarr -> parquet output
j-atkins Jun 5, 2026
3e52b10
endtime/time_origin API update
j-atkins Jun 5, 2026
07209bf
no temp sampling in phase 3
j-atkins Jun 5, 2026
9cb321c
endtimes access scalars directly
j-atkins Jun 5, 2026
137978d
fix wrong var name in kernel
j-atkins Jun 5, 2026
c29efe6
combined vector fields for instruments
j-atkins Jun 5, 2026
a8242c1
small tweaks/fixes
j-atkins Jun 5, 2026
95d84b7
cmo to pixi.toml and tweaked particleset API
j-atkins Jun 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ documentation/full_sensor_list.md
documentation/copernicus_products.md
documentation/pre_download_data.md
documentation/example_copernicus_download.ipynb
documentation/full_sensor_list.md
```
33 changes: 20 additions & 13 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ setuptools = "*"
setuptools_scm = "*"

[package.run-dependencies] # Keep in sync with `pyproject.toml` and feedstock recipe
python = ">=3.10"
python = "3.11.*"
click = "*"
parcels = ">3.1.0"
pyproj = ">=3,<4"
sortedcontainers = "==2.4.0"
opensimplex = "==0.4.5"
numpy = ">=1,<2"
numpy = ">=2.1.0"
pydantic = ">=2,<3"
pyyaml = "*"
copernicusmarine = ">=2.2.2"
Expand All @@ -33,15 +32,26 @@ textual = "*"

[dependencies]
virtualship = { path = "." }
# Pre-install as conda packages to avoid PyPI source builds
netcdf4 = "*"
numpy = ">=2.1.0"
dask = "*"
zarr = ">=3"
ipdb = ">=0.13.13,<0.14"
cmocean = ">=4.0.3,<5"

[feature.py310.dependencies]
python = "3.10.*"
[pypi-dependencies]
parcels = { git = "https://github.com/Parcels-code/Parcels", branch = "main" }

[feature.py311.dependencies]
python = "3.11.*"
# Commented out whilst parcels v4 alpha only supports Python 3.11 (?)
# [feature.py310.dependencies]
# python = "3.10.*"

# [feature.py311.dependencies]
# python = "3.11.*"

[feature.py312.dependencies]
python = "3.12.*"
# [feature.py312.dependencies]
# python = "3.12.*"

[feature.test.dependencies]
pytest = "*"
Expand Down Expand Up @@ -98,11 +108,8 @@ lxml = "*"
typing = "mypy src/virtualship --install-types"

[environments]
default = { features = ["test", "notebooks", "typing", "pre-commit", "analysis"] }
default = { features = ["test", "notebooks", "typing", "pre-commit", "analysis"] }
test-latest = { features = ["test"], solve-group = "test" }
test-py310 = { features = ["test", "py310"] }
test-py311 = { features = ["test", "py311"] }
test-py312 = { features = ["test", "py312"] }
test-notebooks = { features = ["test", "notebooks"], solve-group = "test" }
analysis = { features = ["analysis"], solve-group = "analysis" }
docs = { features = ["docs"], solve-group = "docs" }
Expand Down
11 changes: 6 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "virtualship"
description = "Code for the Virtual Ship Classroom, where Marine Scientists can combine Copernicus Marine Data with an OceanParcels ship to go on a virtual expedition."
readme = "README.md"
dynamic = ["version"]
authors = [{ name = "oceanparcels.org team" }]
authors = [{ name = "parcels-code.org team" }]
requires-python = ">=3.10"
license = { file = "LICENSE" }
classifiers = [
Expand All @@ -26,11 +26,11 @@ classifiers = [
]
dependencies = [
"click",
"parcels >3.1.0",
"parcels >=4.0.0alpha",
"pyproj >= 3, < 4",
"sortedcontainers == 2.4.0",
"opensimplex == 0.4.5",
"numpy >=1, < 2",
"numpy >=2.1.0",
"pydantic >=2, <3",
"PyYAML",
"copernicusmarine >= 2.2.2",
Expand All @@ -40,7 +40,7 @@ dependencies = [
]

[project.urls]
Homepage = "https://oceanparcels.org/" # TODO: Update this to just be repo?
Homepage = "https://virtualship.parcels-code.org/"
Repository = "https://github.com/OceanParcels/virtualship"
Documentation = "https://virtualship.readthedocs.io/"
"Bug Tracker" = "https://github.com/OceanParcels/virtualship/issues"
Expand Down Expand Up @@ -69,7 +69,8 @@ filterwarnings = [
"error",
"default::DeprecationWarning",
"error::DeprecationWarning:virtualship",
"ignore:ParticleSet is empty.*:RuntimeWarning" # TODO: Probably should be ignored in the source code
"ignore:ParticleSet is empty.*:RuntimeWarning", # TODO: Probably should be ignored in the source code
"ignore:This is an alpha version of Parcels v4.*:UserWarning" # TODO: necessary whilst Parcels v4 is still alpha
]
log_cli_level = "INFO"
testpaths = [
Expand Down
12 changes: 6 additions & 6 deletions src/virtualship/cli/_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@
get_instrument_class,
)

# parcels logger (suppress INFO messages to prevent log being flooded)
external_logger = logging.getLogger("parcels.tools.loggers")
external_logger.setLevel(logging.WARNING)

# copernicusmarine logger (suppress INFO messages to prevent log being flooded)
# suppress INFO messages from copernicusmarine and parcels loggers; prevent log flooding
parcels_logger = logging.getLogger("parcels._logger")
parcels_logger.setLevel(logging.WARNING)
logging.getLogger("copernicusmarine").setLevel("ERROR")


Expand Down Expand Up @@ -204,7 +202,9 @@ def _run(
# execute simulation
instrument.execute(
measurements=measurements,
out_path=expedition_dir.joinpath(RESULTS, f"{itype.name.lower()}.zarr"),
out_path=expedition_dir.joinpath(
RESULTS, f"{itype.name.lower()}.parquet"
),
)
except Exception as e:
# clean up if unexpected error occurs
Expand Down
24 changes: 15 additions & 9 deletions src/virtualship/instruments/adcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import ClassVar

import numpy as np
from parcels import ParticleSet, ScipyParticle
from parcels import ParticleFile, ParticleSet

from virtualship.instruments.base import Instrument
from virtualship.instruments.sensors import SensorType
Expand Down Expand Up @@ -35,9 +35,13 @@ class ADCP:
# =====================================================


def _sample_velocity(particle, fieldset, time):
particle.U, particle.V = fieldset.UV.eval(
time, particle.depth, particle.lat, particle.lon, applyConversion=False
def _sample_velocity(particles, fieldset):
particles.U, particles.V = fieldset.UV.eval(
particles.time,
particles.z,
particles.lat,
particles.lon,
applyConversion=False,
)


Expand Down Expand Up @@ -96,23 +100,22 @@ def simulate(self, measurements, out_path) -> None:
# build dynamic particle class from the active sensors
adcp_config = self.expedition.instruments_config.adcp_config
_ADCPParticle = build_particle_class_from_sensors(
adcp_config.sensors, _ADCP_NONSENSOR_VARIABLES, ScipyParticle
adcp_config.sensors, _ADCP_NONSENSOR_VARIABLES
)

bins = np.linspace(MAX_DEPTH, MIN_DEPTH, NUM_BINS)
num_particles = len(bins)
particleset = ParticleSet.from_list(
particleset = ParticleSet(
fieldset=fieldset,
pclass=_ADCPParticle,
lon=np.full(
num_particles, 0.0
), # initial lat/lon are irrelevant and will be overruled later.s
lat=np.full(num_particles, 0.0),
depth=bins,
time=0,
z=bins,
)

out_file = particleset.ParticleFile(name=out_path, outputdt=np.inf)
out_file = ParticleFile(path=out_path, outputdt=np.inf)

# build kernel list from active sensors only
sampling_kernels = [
Expand All @@ -121,6 +124,9 @@ def simulate(self, measurements, out_path) -> None:
if sc.enabled and sc.sensor_type in self.sensor_kernels
]

# TODO: need to overhaul ADCP/underway instruments generally... don't think this Parcels API works anymore
# TODO: a good time to implement https://github.com/Parcels-code/virtualship/issues/231

for point in measurements:
particleset.lon_nextloop[:] = point.location.lon
particleset.lat_nextloop[:] = point.location.lat
Expand Down
Loading
Loading