OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
237 stars 115 forks source link

Get variables at a given depth #1173

Closed PabloReche closed 3 months ago

PabloReche commented 9 months ago

Hello,

this is Pablo.

I am trying to write a new biological model for mussels larvae. I am stuck at vertical migration. During the day these larvae rest at the halocline. I do not know how to find at what depth the halocline is, because I do not know how to access to salinity (or any ohter variabe) at the same particle position but at different depths than the particle itself (above and below through water column). Is it possible to do that directly with opendrift?

I look forward to read any idea about it.

Thank you.

AndresSepulveda commented 9 months ago

Hi Pablo,

You can get that information from the forcing file (CROCO or other) that gives you the velocities. The trick would be to read it at those times and set the larvae position to the value obtained.

knutfrode commented 9 months ago

Hi,

OpenDrift will also extract and provide the vertical profile at any particle locations, whenever profiles is True in required_variables, such as in e.g. LarvalFish module: https://github.com/OpenDrift/opendrift/blob/master/opendrift/models/larvalfish.py#L68

Whereas self.environment contains environment data exactly at particle locations, self.environment_profiles contains the profiles down to the depth specified by required_profiles_z_range https://github.com/OpenDrift/opendrift/blob/master/opendrift/models/larvalfish.py#L82 environment_profiles is thus a 2D array with dimensions (number of elements, number of depth levels)

Profiles of temperature and salinity are e.g. used to calculate vertical stability and thus terminal velocity. There is no method in OpenDrift to estimate halocline depth, but that would be a useful addition.

PabloReche commented 9 months ago

Thanks to both of you for your quick reply.

I will then give a try to the self.environment_profiles command what should allow me access to salinity through the especified water column to later calculate the halocline depth.

Best regards,