Part 6. Tracking Lagrangian particles with PARCELS - NOC-MSM/Belize_workshop GitHub Wiki

Part 6. Tracking Lagrangian particles with PARCELS

Finally, let's track Lagrangian particles with the help of PARCELS!

Never heard of PARCELS? Don't worry! In this section we will explain what PARCELS is and how to use it to track and visualize particles.


Before starting with PARCELS, we must install Miniconda in a new Docker container!

Python environment with Miniconda...

What is Miniconda?

Miniconda is a smaller version of Anaconda, the popular data science toolkit. This smaller version contains conda and Python, the packages they depend on and other useful packages. Miniconda will also gives us access to the conda install command, to download additional libraries or packages from the Anaconda repository.

If you want to learn more about Miniconda, visit this website. If you want to learn about Anaconda instead, go to its official website.

Why do we need Miniconda?

Miniconda is a necessary environment to run PARCELS according to its official documentation. Running on a different environment may cause problems during the installation or while running the program.

What is PARCELS?

The project "Probably A Really Computationally Efficient Lagrangian Simulator", or PARCELS for short, is a Python-developed code to create customisable particle tracking simulations, from outputs obtained from ocean circulation models. It is developed by OceanParcels, if you want to learn more about this project, visit their official website.


Installing PARCELS

If this is the first time you are installing PARCELS in your PC, please refer to the section A). If you have installed PARCELS before, go to section B).

A) First time installing PARCELS

  1. Download the Miniconda Linux installer for Python 3.7 64-bit:

https://docs.conda.io/en/latest/miniconda.html

  1. Run your NEMO container:

docker run -v $HOME/Belize_workshop:/Belize_workshop -t -i jelt/nemocompile:firsttry /bin/bash

  1. Install Miniconda:

bash Miniconda3-latest-Linux-x86_64.sh

  • First, press Enter to proceed with the installation.
  • You will have to accept the terms of Miniconda. Keep pressing Enter until a prompt pops up and type "yes" in it.
  • A second prompt will appear. On this one, type "no" or just press Enter.
  • When a message of installation confirmed appears, go to the step 4.
  1. Activate conda:

eval "$(/root/miniconda3/bin/conda shell.bash hook)"

  1. Install PARCELS (~500MB):

conda create -n py3_parcels -c conda-forge python=3.7 parcels jupyter cartopy ffmpeg

  • A prompt will appear specifying all the necessar files for the installation. Type yes and the installation will start.
  1. You have succesfully installed PARCELS!

B) If you have installed PARCELS before:

  1. Activate PARCELS:
  • Linux/macOS:

source $HOME/miniconda3/bin/activate py3_parcels

  • Windows:

activate py3_parcels

  1. You have succesfully activated PARCELS!

Running PARCELS

Once you have completed A) or B) in the previous section, you are ready to run PARCELS! Just follow this instructions:

  1. Activate the PARCELS environment in Python (inside your NEMO container):

conda activate py3_parcels

  1. Download the pytest module (~2MB):

conda install pytest

  • A prompt will appear, press yes and the download will start.
  1. Go to your PARCELS_DEMO folder:

cd PYTHON_TOOLS/PARCELS_DEMO

  1. Run PARCELS:

python tinyBelize_Parcels.py

  1. You have succesfully ran PARCELS!

  2. If you are having problems running the tinyBelize_Parcels.py script, please refer to the known problems section of this repository. Do not proceed with the next step as you will not be able to run it.


Visualizing PARCELS output

Go to your PARCELS_DEMO folder and open the VisualizeParticles.py script to confirm that you have the correct path and output filename (you can do this with any code editor or with the notepad).Once confirmed, run the code:

python VisualizeParticles.py

A trajectory plot should pop up!

This trajectory plot is our final output for this workshop.

If you are having problems running the VisualizeParticles.py script, please refer to the known problems section of this repository.


Congratulations!

You have successfully run PARCELS, and completed this workshop.