New Tool: Following a Particle In Ocean
As I mentioned in one of my previous posts, I recently attended an eel meeting. During the meeting, one of the presenters shared a publication he was involved in. The study explored whether a European Eel (Anguilla anguilla) can reach its natural habitat simply by riding the Gulf Stream. This research was conducted in 2015 using the most advanced models available at that time.
What piqued my interest was whether the study accounted for the vertical movement of eels, which is known to occur in some species. Although it’s unclear if European Eels make such vertical movements, I wanted to investigate if this behavior might be key to their successful migration to their natural habitats.
New Tool:
I believe the methods I developed for this experiment can be applied to other areas as well. Essentially, anyone interested in tracking a particle's drift using Copernicus models can use this small script. It doesn't have a graphical user interface (GUI) and isn't very user-friendly, but it can be useful for small tasks and can serve as a groundwork for anyone looking to delve deeper into this line of study.
This tool is new to me and actually a well establised concept. This tool in essence is a Lagrangian simulator with Eulerian methods.
The Experiment:
I divided the experiment into two main phases. The first phase assumes that the eel larvae do not exhibit any movement, while the second phase considers the possibility of movement.
Phase 1: Assumes larvae have no movement.
Phase 2: Explores assumptions about larvae movement.
The first type of movement I considered is distinct diel vertical migrations (DVM), which are known to occur in many eel species during migration (e.g., Anguilla marmorata, Anguilla japonica).
Decisions I Made and Why:
Programming Language: I chose Python because the Copernicus API is natively supported in Python. Later, I realized I could have also used R, as I didn’t utilize any Python-specific features of the API library.
Model Selection: I opted for the GLOBAL_ANALYSIS_FORECAST_PHY_001_024 and cmems_mod_glo_phy-cur_anfc_0.083deg_PT6H-i datasets because they are easily accessible and offer the highest spatial and temporal resolution among the Copernicus models that include water currents. While I could have used the GLOBAL_MULTIYEAR_PHY_001_030 model along with actual larvae observations from past expeditions, its lower temporal resolution was a limiting factor. Additionally, I assumed that larvae start locations are the same as those recorded in a 2007 expedition.
Start Time: Since the model I’m working with only provides data starting from April and covers up to a complete year, I chose to start with the year 2023.
Phase 1: Assuming no movement, I explored how the trajectory would be in the latest model available.
- I established a 3D movement capability by creating a Python class that records the past locations of the particles.
- I adapted the class so that the input of movement could be in kilometers for two dimensions and meters for the third dimension.
- I figured out how to subset and download data from the model since downloading an entire year's worth of data would require about 3 TB.
- To minimize data usage, I decided to download a small section of the Atlantic Ocean and expand the area based on the latest trajectory, using a function for the subset operation. All the data collected was stored in a table for future reference.
- I then combined all these elements into a version where, when the desired dataset wasn't available, it would download a small section for a three-month timeframe.
Phase 2: Assuming vertical movement, the larvae move down during the day and up at night.
I assumed the larvae made vertical movements, traveling at 50 meters depth during the day and 300 meters at night. With four time steps per day in the model (0, 6, 12, and 18 hours), I set the depth to 50 meters between 6 and 18 hours and 300 meters for the rest of the time.
It's proven that migrating adults adjust their depth according to lunar phases—staying in deeper waters during a full moon and closer to the surface during a new moon. I planned to use the moon phase as a percentage but found a library that determines movement based on light flux. Although I haven’t accounted for cloud cover and water turbidity yet, this approach is close enough for now.
I ran my script multiple times in various locations within the Sargasso Sea. Over a year, I didn’t observe many changes. I'm planning to use the multi-year Copernicus model so that particles have more time to move.
Since the multi-year model has a 24-hour temporal resolution, I need to handle vertical movement differently. Assuming that the eels spend half their time in deeper waters, I thought I would modify the existing code to accommodate the change in temporal resolution. However, since the netCDF file handling uses the nearest value at each time step, switching to a dataset with a lower temporal resolution wasn’t an issue.
---
Unfortunately, I haven't blogged much about the tool beyond this point. Developing a habit of writing is something I need to work on. After this stage, I didn’t add many new features, but I did test several scenarios extensively. I encountered memory problems, as running more particles for longer periods consumed a lot of RAM. Additionally, getting the subsetted model data took too long.
To overcome these challenges with the current capabilities of the tool, I moved closer to the dataset. I used a private service called Creodias, which hosts most of the Copernicus datasets, including the ones I was using. They offer hosting services with high-speed connections to the dataset.
Because the connection between the virtual machine (VM) I accessed and the dataset was established through S3, utilizing the s3fs tool, I had to access the dataset multiple times for each particle. I implemented several strategies to speed up the process. To manage the high RAM usage, I periodically saved the history of the particles to another directory, keeping only the most relevant location information. I was stuck at this stage for several days, trying to make everything work.
I will be writing a seperate post about my overall experience with Creodias.
As run times of the script got longer at several different machines I started making adjustments midway of it's runtime I lost track of versioning. I will further continue making adjustments and improvements. Plan to share the tool when I feel ready. In the meantime if you need it let me know I can share it to you it's latest version.
Regarding eel; preliminary result in line with other studies, no major discoveries. I'm working on several more improvements.