Add XBT instrument simulation based on CTD#76
Add XBT instrument simulation based on CTD#76erikvansebille merged 26 commits intoParcels-code:mainfrom
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
It passed the tests (including the one I created for XBT), but I have not tried or implemented it in a tutorial. I hope I made your day with this PR, @ammedd ! haha |
erikvansebille
left a comment
There was a problem hiding this comment.
Nice addition, @iuryt! Thanks for the contribution. Can you lok at these review comments I provided?
Co-authored-by: Erik van Sebille <e.vansebille@uu.nl>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Erik van Sebille <e.vansebille@uu.nl>
|
It seems like this is failing the test because it is reaching almost at the maximum depth, but not really there (e.g. Do you have any idea what it could be? FAILED tests/instruments/test_xbt.py::test_simulate_xbts - AssertionError: Observation incorrect xbt_i=0 loc='maxdepth' var='temperature' obs_value=7.965900421142578 exp_value=8.Edit: I think I know. Maybe this is because the fall speed is a float number and basically we reach the condition ( If you agree, we can either change the |
Yes I agree that would be the likely culprit
Hmm, changing # Delete particle if depth is exactly max_depth
if particle.depth + particle_ddepth == particle.max_depth:
particle.delete()
# Set particle depth to max depth if it's too deep
if particle.depth + particle_ddepth < particle.max_depth:
particle_ddepth = particle.max_depth - particle.depthSince the second |
for more information, see https://pre-commit.ci
|
It was never reaching the first condition, I changed it to particle.depth == particle.max_depth I ran the pytests and it worked locally. What do you think? |
|
Yep that sounds correct. |
|
@erikvansebille |
Summary
This PR introduces a new instrument simulation,
xbt.py, located in theinstruments/directory. Thexbt.pyfile is modeled onctd.pyand is designed to simulate data collection for Expendable Bathythermographs (XBTs), which capture water temperature at varying depths.Changes
xbt.pytoinstruments/directory for XBT data simulation.test_xbt.pybased ontest_ctd.pyinstruments/__init__.pyto includexbt.pyin the module exports.Notes
Next Steps