Wiki

Clone wiki

lagrangian / Usage

Map of FLE

The map_of_fle script computes a map of FSLE or FTLE from a set of NetCDF grids containing velocity fields.

To run this example you must download the test data here .

Then you must create a configuration file as follows:

U = dt_upd_global_merged_madt_uv_20091230_20091230_20110329.nc
U = dt_upd_global_merged_madt_uv_20100106_20100106_20110329.nc
U = dt_upd_global_merged_madt_uv_20100113_20100113_20110329.nc
U = dt_upd_global_merged_madt_uv_20100120_20100120_20110329.nc
U = dt_upd_global_merged_madt_uv_20100127_20100127_20110329.nc
U = dt_upd_global_merged_madt_uv_20100203_20100203_20110329.nc
U = dt_upd_global_merged_madt_uv_20100210_20100210_20110329.nc
U = dt_upd_global_merged_madt_uv_20100217_20100217_20110329.nc
U = dt_upd_global_merged_madt_uv_20100224_20100224_20110329.nc
U = dt_upd_global_merged_madt_uv_20100303_20100303_20110329.nc
U = dt_upd_global_merged_madt_uv_20100310_20100310_20110329.nc
U = dt_upd_global_merged_madt_uv_20100317_20100317_20110329.nc
U = dt_upd_global_merged_madt_uv_20100324_20100324_20110329.nc
U = dt_upd_global_merged_madt_uv_20100331_20100331_20110329.nc
U = dt_upd_global_merged_madt_uv_20100407_20100407_20110329.nc
V = dt_upd_global_merged_madt_uv_20091230_20091230_20110329.nc
V = dt_upd_global_merged_madt_uv_20100106_20100106_20110329.nc
V = dt_upd_global_merged_madt_uv_20100113_20100113_20110329.nc
V = dt_upd_global_merged_madt_uv_20100120_20100120_20110329.nc
V = dt_upd_global_merged_madt_uv_20100127_20100127_20110329.nc
V = dt_upd_global_merged_madt_uv_20100203_20100203_20110329.nc
V = dt_upd_global_merged_madt_uv_20100210_20100210_20110329.nc
V = dt_upd_global_merged_madt_uv_20100217_20100217_20110329.nc
V = dt_upd_global_merged_madt_uv_20100224_20100224_20110329.nc
V = dt_upd_global_merged_madt_uv_20100303_20100303_20110329.nc
V = dt_upd_global_merged_madt_uv_20100310_20100310_20110329.nc
V = dt_upd_global_merged_madt_uv_20100317_20100317_20110329.nc
V = dt_upd_global_merged_madt_uv_20100324_20100324_20110329.nc
V = dt_upd_global_merged_madt_uv_20100331_20100331_20110329.nc
V = dt_upd_global_merged_madt_uv_20100407_20100407_20110329.nc
U_NAME = Grid_0001
V_NAME = Grid_0002
FILL_VALUE = 0

The file contains several keys representing the following data:

  • U defines the netCDF files containing the eastward velocities.
  • V defines the netCDF files containing the northward velocities.
  • U_NAME defines the NetCDF variable containing the eastward velocities.
  • V_NAME defines the NetCDF variable containing the northward velocities.
  • FILL_VALUE value to be taken into account when the reader encounters an undefined value. This value must be 0 if you do not wish to generate undefined values ​​when integrating or nan if the calculation must generate undefined values​​.

The path to the NetCDF file must contain an absolute path, for example:

U = /home/lagrangian/dt_upd_global_merged_madt_uv_20100407_20100407_20110329.nc

To compute a map of FSLE, in forwards mode, on selected area enter the command (don't forget to set OMP_NUM_THREADS to accelerate the calculation to use multi-threading):

map_of_fle.py list.ini fsle.nc "2010-01-01" --advection_time 89 --resolution=0.05 \
    --final_separation 0.2 --x_min 40 --x_max 60 --y_min -60 --y_max -40 \
    --final_separation 0.2 --verbose --time_direction forward

or in backwards mode:

map_of_fle.py list.ini fsle_backwards.nc "2010-01-01" --advection_time 89 --resolution=0.05 \
    --final_separation 0.2 --x_min 40 --x_max 60 --y_min -60 --y_max -40 \
    --final_separation 0.2 --verbose --time_direction backward

Type map_of_fle --help to see the available options.

If you see this error message:

Traceback (most recent call last):
  File "../src/etc/map_of_fle", line 17, in <module>     import lagrangian
ImportError: No module named lagrangian

You must set the PYTHONPATH variable with the directory that contains the lagrangian library (lagrangian.so)

Mapping

This script, provided with the library, allows to view the grids generated by the previous example"

To view the grid created previously enter the following command:

mapping --range 0 0.320 320 --colormap=terrain fsle.nc fsle.png lambda1

The script produce the fallowing figure, for the FSLE computed in forwards mode:

https://bitbucket.org/cnes_aviso/lagrangian/downloads/fsle.png

For the FSLE computed in forwards mode:

mapping --range -0.320 0 320 --colormap=terrain --invert \
fsle_backwards.nc fsle_backwards.png lambda1

and the image created:

https://bitbucket.org/cnes_aviso/lagrangian/downloads/fsle_backwards.png

Updated