Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/user-guide/assignments/Research_Proposal_only.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"\n",
"Please provide a scheme with number of necessary work and in-transit days within the working areas and station times. This can be downloaded from [the NIOZ MFP website](https://nioz.marinefacilitiesplanning.com/cruiselocationplanning#) using the Export button on the right.\n",
"\n",
"Please indicate at each station what instruments you want to deploy (CTD, Argo float, drifter, XBT) and take the deployment time into account. If you plan to use Argo floats, please give the required depth and cycle duration. In case of the CTD the deployment time depends on the depth of the ocean. \n",
"Please indicate at each station what instruments you want to deploy (CTD, Argo float, drifter, XBT) and take the deployment time into account. If you plan to use Argo floats, please give the required depth and cycle duration.\n",
"\n",
"Here is some sample code to sample the depth using the bathymetry data that the Virtual Ship will also use. "
]
Expand Down
5 changes: 0 additions & 5 deletions docs/user-guide/assignments/Research_proposal_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@
"\n",
"In total, therefore, you can expect a CTD deployment to take approximately 50 minutes.\n",
"\n",
"<!-- TODO: this note can be removed when CTD and CTD_BGC are combined to one instrument -->\n",
"<div class=\"alert alert-block alert-info\"> \n",
"**Note**: If you are deploying CTDs in both standard and biogeochemical configurations (`CTD` and `CTD_BGC`) in your [VirtualShip expeditions](./Sail_the_ship.ipynb), you only need to factor in the 50 minutes **once** per waypoint, as both can be deployed on the same cast.\n",
"</div>\n",
"\n",
"<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/7N2UsPDczTw\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
]
},
Expand Down
4 changes: 0 additions & 4 deletions docs/user-guide/assignments/Sail_the_ship.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,6 @@
"\n",
"<div class=\"alert alert-block alert-info\"> \n",
"**Note**: On pressing _Save Changes_ the tool will check the selections are valid (for example that the ship will be able to reach each waypoint in time). If they are, the changes will be saved to the `expedition.yaml` file, ready for the next steps. If your selections are invalid you should be provided with information on how to fix them.\n",
"</div>\n",
"\n",
"<div class=\"alert alert-block alert-warning\"> \n",
"**Caution**: The `virtualship plan` tool will check that the ship can reach each waypoint according to the prescribed ship speed (10 knots). However, before the ultimate simulation step (i.e. step 6 below) there will be a final, automated check that the schedule also accounts for the time taken to conduct the measurements at each site (e.g. a CTD cast in deeper waters will take longer). Therefore, we recommend to take this extra time into account at this stage of the planning by estimating how long each measurement will take and adding this time on.\n",
"</div>"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"source": [
"7. **Scientific work program**\n",
"\n",
"Please upload a screenshot of the MFP website inlcuding port of departure and arrival, all stations (and transects) and total time. Please indicate at each station what instruments you want to deploy (CTD, Argo float, drifter, XBT) and take the deployment time into account. If you plan to use Argo floats, please give the required depth and cycle duration. In case of the CTD the deployment time depends on the depth of the ocean. Note that transit times from the port of departure to the first station and from the last station in the working area to the port of arrival are regarded as work days at sea, so they are deducted from your (three-week) availability. "
"Please upload a screenshot of the MFP website inlcuding port of departure and arrival, all stations (and transects) and total time. Please indicate at each station what instruments you want to deploy (CTD, Argo float, drifter, XBT) and take the deployment time into account. If you plan to use Argo floats, please give the required depth and cycle duration. Note that transit times from the port of departure to the first station and from the last station in the working area to the port of arrival are regarded as work days at sea, so they are deducted from your (three-week) availability. "
]
},
{
Expand Down
4 changes: 0 additions & 4 deletions docs/user-guide/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ When you are happy with your ship configuration and schedule plan, press _Save C
On pressing _Save Changes_ the tool will check the selections are valid (for example that the ship will be able to reach each waypoint in time). If they are, the changes will be saved to the `expedition.yaml` file, ready for the next steps. If your selections are invalid you should be provided with information on how to fix them.
```

```{caution}
The `virtualship plan` tool will check that the ship can reach each waypoint according to the prescribed ship speed. However, before the ultimate [simulation step](#run-the-expedition) there will be a final, automated check that the schedule also accounts for the time taken to conduct the measurements at each site (e.g. a CTD cast in deeper waters will take longer). Therefore, we recommend to take this extra time into account at this stage of the planning by estimating how long each measurement will take and adding this time on.
```

## 4) Run the expedition

You are now ready to run your virtual expedition! This stage will simulate the measurements taken by the instruments you selected at each waypoint in your expedition schedule, using input data sourced from the [Copernicus Marine Data Store](https://data.marine.copernicus.eu/products).
Expand Down
16 changes: 6 additions & 10 deletions docs/user-guide/tutorials/CTD_transects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"\n",
"This notebook demonstrates a simple plotting exercise for CTD data across a transect, using the output of a VirtualShip expedition. There are example plots embedded at the end, but these will ultimately be replaced by your own versions as you work through the notebook.\n",
"\n",
"We can plot physical (temperature, salinity) or biogeochemical data (oxygen, chlorophyll, primary production, phytoplankton, nutrients, pH) as measured by the VirtualShip `CTD` and `CTD_BGC` instruments, respectively.\n",
"We can plot physical (temperature, salinity) or biogeochemical data (oxygen, chlorophyll, primary production, phytoplankton, nutrients, pH) as measured by the VirtualShip `CTD` instrument.\n",
"\n",
"The plot(s) we will produce are simple plots which follow the trajectory of the expedition as a function of distance from the first waypoint, and are intended to be a starting point for your analysis. \n",
"\n",
Expand Down Expand Up @@ -82,13 +82,11 @@
"source": [
"#### Variable choice\n",
"\n",
"You should now consider which variable from your CTD casts you would like to plot. Which ones are available to you will depend on whether you have used the `CTD` (physical variables) or `CTD_BGC` (biogeochemical) instrument, or both. Below is a list of all valid variable choices for both instruments...\n",
"You should now consider which variable from your CTD casts you would like to plot. Which ones are available to you will depend on which sensors you deployed the `CTD` instrument with (via the `virtualship plan` tool and/or your `expedition.yaml` file). Below is the full list of valid variable choices...\n",
"\n",
"`CTD` (physical):\n",
"`CTD`:\n",
"- \"temperature\"\n",
"- \"salinity\"\n",
"\n",
"`CTD_BGC` (biogeochemical):\n",
"- \"oxygen\"\n",
"- \"nitrate\"\n",
"- \"phosphate\"\n",
Expand Down Expand Up @@ -191,15 +189,13 @@
},
{
"cell_type": "code",
"execution_count": 76,
"execution_count": null,
"id": "13f4664b",
"metadata": {},
"outputs": [],
"source": [
"# load CTD data\n",
"filename = (\n",
" \"ctd.zarr\" if plot_variable in [\"temperature\", \"salinity\"] else \"ctd_bgc.zarr\"\n",
")\n",
"filename = \"ctd.zarr\"\n",
"ctd_ds = xr.open_dataset(f\"{data_dir}/{filename}\")\n",
"if ctd_ds[\"trajectory\"].size <= 1:\n",
" raise ValueError(\"Number of waypoints must be > 1\")"
Expand Down Expand Up @@ -482,7 +478,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
"version": "3.12.12"
}
},
"nbformat": 4,
Expand Down
4 changes: 1 addition & 3 deletions docs/user-guide/tutorials/working_with_expedition_yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ schedule: # <-- 1. expedition schedule section
waypoints:
- instrument: # <-- Waypoint 1
- CTD
- CTD_BGC
- ARGO_FLOAT
- DRIFTER
location:
Expand All @@ -53,7 +52,6 @@ instruments_config: # <-- 2. instrument configuration section
ship_underwater_st_config:
period_minutes: 5.0
argo_float_config: ...
ctd_bgc_config: ...
ctd_config: ...
drifter_config: ...
xbt_config: ...
Expand All @@ -75,7 +73,7 @@ This section contains a list of `waypoints` that define the expedition's route.
- **Instruments (`instrument`)**: A list of instruments to be deployed at that waypoint. Add or remove instruments by adding or deleting entries on _new lines_. The instrument selection can also be left empty (i.e., no instruments deployed at that waypoint) by setting the parameter to: `instrument: null`.

```{tip}
Full list of instruments supported for deployment at waypoints (case-sensitive): `CTD`, `CTD_BGC`, `DRIFTER`, `ARGO_FLOAT`, `XBT` (or `null`).
Full list of instruments supported for deployment at waypoints (case-sensitive): `CTD`, `DRIFTER`, `ARGO_FLOAT`, `XBT` (or `null`).
```

```{tip}
Expand Down
10 changes: 0 additions & 10 deletions src/virtualship/cli/_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from virtualship.models import (
ADCPConfig,
ArgoFloatConfig,
CTD_BGCConfig,
CTDConfig,
DrifterConfig,
Expedition,
Expand Down Expand Up @@ -109,15 +108,6 @@ def log_exception_to_file(
{"name": "stationkeeping_time", "minutes": True},
],
},
"ctd_bgc_config": {
"class": CTD_BGCConfig,
"title": "CTD-BGC",
"attributes": [
{"name": "max_depth_meter"},
{"name": "min_depth_meter"},
{"name": "stationkeeping_time", "minutes": True},
],
},
"xbt_config": {
"class": XBTConfig,
"title": "XBT",
Expand Down
24 changes: 1 addition & 23 deletions src/virtualship/expedition/simulate_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from virtualship.instruments.argo_float import ArgoFloat
from virtualship.instruments.ctd import CTD
from virtualship.instruments.ctd_bgc import CTD_BGC
from virtualship.instruments.drifter import Drifter
from virtualship.instruments.types import InstrumentType
from virtualship.instruments.xbt import XBT
Expand Down Expand Up @@ -53,7 +52,6 @@ class MeasurementsToSimulate:
InstrumentType.ARGO_FLOAT: "argo_floats",
InstrumentType.DRIFTER: "drifters",
InstrumentType.CTD: "ctds",
InstrumentType.CTD_BGC: "ctd_bgcs",
InstrumentType.XBT: "xbts",
}

Expand All @@ -67,7 +65,6 @@ def get_attr_for_instrumenttype(cls, instrument_type):
argo_floats: list[ArgoFloat] = field(default_factory=list, init=False)
drifters: list[Drifter] = field(default_factory=list, init=False)
ctds: list[CTD] = field(default_factory=list, init=False)
ctd_bgcs: list[CTD_BGC] = field(default_factory=list, init=False)
xbts: list[XBT] = field(default_factory=list, init=False)


Expand Down Expand Up @@ -265,12 +262,6 @@ def _make_measurements(self, waypoint: Waypoint) -> timedelta:
# time costs of each measurement
time_costs = [timedelta()]

# check if both CTD and CTD_BGC are present
# TODO: this can be avoided if CTD and CTD_BGC are merged into a single instrument
both_ctd_and_bgc = (
InstrumentType.CTD in instruments and InstrumentType.CTD_BGC in instruments
)

for instrument in instruments:
if instrument is InstrumentType.ARGO_FLOAT:
self._measurements_to_simulate.argo_floats.append(
Expand Down Expand Up @@ -302,20 +293,7 @@ def _make_measurements(self, waypoint: Waypoint) -> timedelta:
time_costs.append(
self._expedition.instruments_config.ctd_config.stationkeeping_time
)
elif instrument is InstrumentType.CTD_BGC:
self._measurements_to_simulate.ctd_bgcs.append(
CTD_BGC(
spacetime=Spacetime(self._location, self._time),
min_depth=self._expedition.instruments_config.ctd_bgc_config.min_depth_meter,
max_depth=self._expedition.instruments_config.ctd_bgc_config.max_depth_meter,
)
)
if both_ctd_and_bgc: # only need to add time cost once if both CTD and CTD_BGC are being taken; in reality they would be done on the same instrument
pass
else:
time_costs.append(
self._expedition.instruments_config.ctd_bgc_config.stationkeeping_time
)

elif instrument is InstrumentType.DRIFTER:
self._measurements_to_simulate.drifters.append(
Drifter(
Expand Down
2 changes: 0 additions & 2 deletions src/virtualship/instruments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
adcp,
argo_float,
ctd,
ctd_bgc,
drifter,
ship_underwater_st,
xbt,
Expand All @@ -14,7 +13,6 @@
"adcp",
"argo_float",
"ctd",
"ctd_bgc",
"drifter",
"ship_underwater_st",
"xbt",
Expand Down
43 changes: 43 additions & 0 deletions src/virtualship/instruments/ctd.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class CTD:
# SECTION: Kernels
# =====================================================

## physical variables


def _sample_temperature(particle, fieldset, time):
particle.temperature = fieldset.T[time, particle.depth, particle.lat, particle.lon]
Expand All @@ -58,6 +60,40 @@ def _sample_salinity(particle, fieldset, time):
particle.salinity = fieldset.S[time, particle.depth, particle.lat, particle.lon]


## bgc variables


def _sample_o2(particle, fieldset, time):
particle.o2 = fieldset.o2[time, particle.depth, particle.lat, particle.lon]


def _sample_chlorophyll(particle, fieldset, time):
particle.chl = fieldset.chl[time, particle.depth, particle.lat, particle.lon]


def _sample_nitrate(particle, fieldset, time):
particle.no3 = fieldset.no3[time, particle.depth, particle.lat, particle.lon]


def _sample_phosphate(particle, fieldset, time):
particle.po4 = fieldset.po4[time, particle.depth, particle.lat, particle.lon]


def _sample_ph(particle, fieldset, time):
particle.ph = fieldset.ph[time, particle.depth, particle.lat, particle.lon]


def _sample_phytoplankton(particle, fieldset, time):
particle.phyc = fieldset.phyc[time, particle.depth, particle.lat, particle.lon]


def _sample_primary_production(particle, fieldset, time):
particle.nppv = fieldset.nppv[time, particle.depth, particle.lat, particle.lon]


## cast


def _ctd_cast(particle, fieldset, time):
# lowering
if particle.raising == 0:
Expand All @@ -84,6 +120,13 @@ class CTDInstrument(Instrument):
sensor_kernels: ClassVar[dict[SensorType, Callable]] = {
SensorType.TEMPERATURE: _sample_temperature,
SensorType.SALINITY: _sample_salinity,
SensorType.OXYGEN: _sample_o2,
SensorType.CHLOROPHYLL: _sample_chlorophyll,
SensorType.NITRATE: _sample_nitrate,
SensorType.PHOSPHATE: _sample_phosphate,
SensorType.PH: _sample_ph,
SensorType.PHYTOPLANKTON: _sample_phytoplankton,
SensorType.PRIMARY_PRODUCTION: _sample_primary_production,
}

def __init__(self, expedition, from_data):
Expand Down
Loading
Loading