Trajectory modifiers

Trajectory modifiers classes change the path of particles, examples from standard trajectory_modifiers classes below.

Particle behaviour

Particles with a random fraction temporarily frozen on a polygon shaped reef.

  • class: trajectory_modifiers.settlement_in_polygon.SettleInPolygon

json parameters
../../../demos/demo_param_files/demo06_reefstranding.json
{
    "output_file_base": "demo06_reefstranding",
    "add_date_to_run_output_dir": false,
    "NUMBA_cache_code": false,
    "time_step": 600,
    "debug": true,
    "reader": {
        "input_dir": "F:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "Random_order_*.nc",
        "time_buffer_size": 15
    },
    "user_note": "test of notes",
    "dispersion": {
        "A_H": 0.1
    },
    "tracks_writer": {
        "write_dry_cell_flag": true
    },
    "release_groups": [
        {
            "name": "P1",
            "points": [
                [
                    1594500,
                    5482700
                ],
                [
                    1598000,
                    5486100
                ],
                [
                    1595500,
                    5489700
                ]
            ],
            "pulse_size": 10,
            "release_interval": 10800
        },
        {
            "name": "poly1",
            "class_name": "oceantracker.release_groups.polygon_release.PolygonRelease",
            "points": [
                [
                    1597682.1237,
                    5489972.7479
                ],
                [
                    1598604.1667,
                    5490275.5488
                ],
                [
                    1598886.4247,
                    5489464.0424
                ],
                [
                    1597917.3387,
                    5489000
                ],
                [
                    1597300,
                    5489000
                ],
                [
                    1597682.1237,
                    5489972.7479
                ]
            ],
            "pulse_size": 1,
            "release_interval": 0
        }
    ],
    "particle_properties": [
        {
            "name": "Oxygen",
            "class_name": "AgeDecay",
            "decay_time_scale": 86400.0,
            "initial_value": 20.0
        },
        {
            "name": "distance_travelled",
            "class_name": "DistanceTravelled"
        },
        {
            "name": "age_decay",
            "class_name": "AgeDecay",
            "decay_time_scale": 86400.0
        },
        {
            "name": "my_constant_prop",
            "class_name": "ParticleLoad",
            "initial_value": 100
        }
    ],
    "block_dry_cells": true,
    "trajectory_modifiers": [
        {
            "name": "settle_in_polygon",
            "class_name": "oceantracker.trajectory_modifiers.settle_in_polygon.SettleInPolygon",
            "polygon": {
                "points": [
                    [
                        1597682.1237,
                        5489972.7479
                    ],
                    [
                        1598604.1667,
                        5490275.5488
                    ],
                    [
                        1598886.4247,
                        5489464.0424
                    ],
                    [
                        1597917.3387,
                        5489000
                    ],
                    [
                        1597300,
                        5489000
                    ],
                    [
                        1597682.1237,
                        5489972.7479
                    ]
                ]
            },
            "probability_of_settlement": 0.1,
            "settlement_duration": 10800.0
        }
    ],
    "backtracking": true,
    "particle_statistics": [
        {
            "name": "polystats1",
            "class_name": "oceantracker.particle_statistics.polygon_statistics.PolygonStats2D_timeBased",
            "update_interval": 1800,
            "particle_property_list": [
                "water_depth"
            ],
            "use_release_group_polygons": true,
            "polygon_list": [
                {
                    "points": [
                        [
                            1597682.1237,
                            5489972.7479
                        ],
                        [
                            1598604.1667,
                            5490275.5488
                        ],
                        [
                            1598886.4247,
                            5489464.0424
                        ],
                        [
                            1597917.3387,
                            5489000
                        ],
                        [
                            1597300,
                            5489000
                        ],
                        [
                            1597682.1237,
                            5489972.7479
                        ]
                    ]
                }
            ]
        }
    ],
    "root_output_dir": "output"
}
yaml parameters
../../../demos/demo_param_files/demo06_reefstranding.yaml
NUMBA_cache_code: false
add_date_to_run_output_dir: false
backtracking: true
block_dry_cells: true
debug: true
dispersion:
  A_H: 0.1
output_file_base: demo06_reefstranding
particle_properties:
- class_name: AgeDecay
  decay_time_scale: 86400.0
  initial_value: 20.0
  name: Oxygen
- class_name: DistanceTravelled
  name: distance_travelled
- class_name: AgeDecay
  decay_time_scale: 86400.0
  name: age_decay
- class_name: ParticleLoad
  initial_value: 100
  name: my_constant_prop
particle_statistics:
- class_name: oceantracker.particle_statistics.polygon_statistics.PolygonStats2D_timeBased
  name: polystats1
  particle_property_list:
  - water_depth
  polygon_list:
  - points:
    - - 1597682.1237
      - 5489972.7479
    - - 1598604.1667
      - 5490275.5488
    - - 1598886.4247
      - 5489464.0424
    - - 1597917.3387
      - 5489000
    - - 1597300
      - 5489000
    - - 1597682.1237
      - 5489972.7479
  update_interval: 1800
  use_release_group_polygons: true
reader:
  file_mask: Random_order_*.nc
  input_dir: F:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
  time_buffer_size: 15
release_groups:
- name: P1
  points:
  - - 1594500
    - 5482700
  - - 1598000
    - 5486100
  - - 1595500
    - 5489700
  pulse_size: 10
  release_interval: 10800
- class_name: oceantracker.release_groups.polygon_release.PolygonRelease
  name: poly1
  points:
  - - 1597682.1237
    - 5489972.7479
  - - 1598604.1667
    - 5490275.5488
  - - 1598886.4247
    - 5489464.0424
  - - 1597917.3387
    - 5489000
  - - 1597300
    - 5489000
  - - 1597682.1237
    - 5489972.7479
  pulse_size: 1
  release_interval: 0
root_output_dir: output
time_step: 600
tracks_writer:
  write_dry_cell_flag: true
trajectory_modifiers:
- class_name: oceantracker.trajectory_modifiers.settle_in_polygon.SettleInPolygon
  name: settle_in_polygon
  polygon:
    points:
    - - 1597682.1237
      - 5489972.7479
    - - 1598604.1667
      - 5490275.5488
    - - 1598886.4247
      - 5489464.0424
    - - 1597917.3387
      - 5489000
    - - 1597300
      - 5489000
    - - 1597682.1237
      - 5489972.7479
  probability_of_settlement: 0.1
  settlement_duration: 10800.0
user_note: test of notes

Resuspension

Particles with fall velocity and resuspension based on critical friction velocity.

  • class trajectory_modifiers.resuspension.BasicResuspension

../../_images/demo59_crit_shear_resupension_section.jpeg

Vertical slice showing one example of a falling particle and resuspension, with particle on bottom during low flows around low and high tides. Blue line is particle status, 10= moving, 6 = on the bottom.

json parameters
../../../demos/demo_param_files/demo58_bottomBounce.json
{
    "output_file_base": "demo58_bottomBounce",
    "debug": true,
    "time_step": 120,
    "NUMBA_cache_code": false,
    "use_A_Z_profile": false,
    "regrid_z_to_uniform_sigma_levels": true,
    "reader": {
        "input_dir": "F:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "demo_hindcast_schisim3D_00.nc",
        "load_fields": [
            "water_temperature"
        ]
    },
    "dispersion": {
        "A_H": 0.1,
        "A_V": 0.005
    },
    "release_groups": [
        {
            "name": "P11",
            "pulse_size": 10,
            "release_interval": 0,
            "points": [
                [
                    1593000.0,
                    5486000.0,
                    -1
                ]
            ],
            "release_at_surface": true
        }
    ],
    "particle_properties": [
        {
            "name": "age_decay",
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0
        }
    ],
    "event_loggers": [
        {
            "name": "inoutpoly",
            "class_name": "oceantracker.event_loggers.log_polygon_entry_and_exit.LogPolygonEntryAndExit",
            "particle_prop_to_write_list": [
                "ID",
                "x",
                "IDrelease_group",
                "status",
                "age"
            ],
            "polygon_list": [
                {
                    "user_polygon_name": "A",
                    "points": [
                        [
                            1592682.1237,
                            5489972.7479
                        ],
                        [
                            1593604.1667,
                            5490275.5488
                        ],
                        [
                            1593886.4247,
                            5489464.0424
                        ],
                        [
                            1592917.3387,
                            5489000.0
                        ],
                        [
                            1592300.0,
                            5489000.0
                        ],
                        [
                            1592682.1237,
                            5489972.7479
                        ]
                    ]
                },
                {
                    "user_polygon_name": "B",
                    "points": [
                        [
                            1597682.1237,
                            5489972.7479
                        ],
                        [
                            1598604.1667,
                            5490275.5488
                        ],
                        [
                            1598886.4247,
                            5489464.0424
                        ],
                        [
                            1597917.3387,
                            5487000
                        ],
                        [
                            1597300,
                            5487000
                        ],
                        [
                            1597682.1237,
                            5489972.7479
                        ]
                    ]
                }
            ]
        }
    ],
    "particle_statistics": [
        {
            "name": "grid1",
            "class_name": "oceantracker.particle_statistics.gridded_statistics2D.GriddedStats2D_timeBased",
            "update_interval": 3600,
            "particle_property_list": [
                "water_depth"
            ],
            "status_list": [
                "moving"
            ],
            "z_min": -2,
            "grid_span": [
                10000,
                10000
            ],
            "grid_size": [
                120,
                121
            ]
        }
    ],
    "resuspension": {
        "critical_friction_velocity": 0.005
    },
    "velocity_modifiers": [
        {
            "name": "terminal_velocity",
            "class_name": "oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity",
            "value": -0.002,
            "variance": 0.0002
        }
    ],
    "backtracking": false,
    "root_output_dir": "output"
}
yaml parameters
../../../demos/demo_param_files/demo58_bottomBounce.yaml
NUMBA_cache_code: false
backtracking: false
debug: true
dispersion:
  A_H: 0.1
  A_V: 0.005
event_loggers:
- class_name: oceantracker.event_loggers.log_polygon_entry_and_exit.LogPolygonEntryAndExit
  name: inoutpoly
  particle_prop_to_write_list:
  - ID
  - x
  - IDrelease_group
  - status
  - age
  polygon_list:
  - points:
    - - 1592682.1237
      - 5489972.7479
    - - 1593604.1667
      - 5490275.5488
    - - 1593886.4247
      - 5489464.0424
    - - 1592917.3387
      - 5489000.0
    - - 1592300.0
      - 5489000.0
    - - 1592682.1237
      - 5489972.7479
    user_polygon_name: A
  - points:
    - - 1597682.1237
      - 5489972.7479
    - - 1598604.1667
      - 5490275.5488
    - - 1598886.4247
      - 5489464.0424
    - - 1597917.3387
      - 5487000
    - - 1597300
      - 5487000
    - - 1597682.1237
      - 5489972.7479
    user_polygon_name: B
output_file_base: demo58_bottomBounce
particle_properties:
- class_name: oceantracker.particle_properties.age_decay.AgeDecay
  decay_time_scale: 86400.0
  name: age_decay
particle_statistics:
- class_name: oceantracker.particle_statistics.gridded_statistics2D.GriddedStats2D_timeBased
  grid_size:
  - 120
  - 121
  grid_span:
  - 10000
  - 10000
  name: grid1
  particle_property_list:
  - water_depth
  status_list:
  - moving
  update_interval: 3600
  z_min: -2
reader:
  file_mask: demo_hindcast_schisim3D_00.nc
  input_dir: F:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
  load_fields:
  - water_temperature
regrid_z_to_uniform_sigma_levels: true
release_groups:
- name: P11
  points:
  - - 1593000.0
    - 5486000.0
    - -1
  pulse_size: 10
  release_at_surface: true
  release_interval: 0
resuspension:
  critical_friction_velocity: 0.005
root_output_dir: output
time_step: 120
use_A_Z_profile: false
velocity_modifiers:
- class_name: oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity
  name: terminal_velocity
  value: -0.002
  variance: 0.0002

Splitting particles

Particles with splitting in two every 6 hours and a 5% chance of dying every 6 hours.

  • class: trajectory_modifiers.split_particles.SplitParticles

  • class: trajectory_modifiers.cull_particles.CullParticles

json parameters
../../../demos/demo_param_files/demo08_particle_splitting.json
{
    "output_file_base": "demo08_particle_splitting",
    "add_date_to_run_output_dir": false,
    "NUMBA_cache_code": false,
    "time_step": 600,
    "debug": true,
    "reader": {
        "input_dir": "F:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "Random_order_*.nc",
        "time_buffer_size": 15
    },
    "user_note": "test of notes",
    "dispersion": {
        "A_H": 0.1
    },
    "tracks_writer": {
        "write_dry_cell_flag": true
    },
    "release_groups": [
        {
            "name": "P1",
            "points": [
                [
                    1594500,
                    5483500
                ],
                [
                    1594500,
                    5486500
                ]
            ],
            "pulse_size": 1,
            "release_interval": 0
        }
    ],
    "particle_properties": [
        {
            "name": "age_decay",
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0
        }
    ],
    "block_dry_cells": true,
    "event_loggers": [
        {
            "name": "in_out_poly",
            "class_name": "oceantracker.event_loggers.log_polygon_entry_and_exit.LogPolygonEntryAndExit",
            "particle_prop_to_write_list": [
                "ID",
                "x",
                "IDrelease_group",
                "status",
                "age"
            ],
            "polygon_list": [
                {
                    "user_polygon_name": "A",
                    "points": [
                        [
                            1592682.1237,
                            5489972.7479
                        ],
                        [
                            1593604.1667,
                            5490275.5488
                        ],
                        [
                            1593886.4247,
                            5489464.0424
                        ],
                        [
                            1592917.3387,
                            5489000.0
                        ],
                        [
                            1592300.0,
                            5489000.0
                        ],
                        [
                            1592682.1237,
                            5489972.7479
                        ]
                    ]
                },
                {
                    "user_polygon_name": "B",
                    "points": [
                        [
                            1597682.1237,
                            5489972.7479
                        ],
                        [
                            1598604.1667,
                            5490275.5488
                        ],
                        [
                            1598886.4247,
                            5489464.0424
                        ],
                        [
                            1597917.3387,
                            5487000
                        ],
                        [
                            1597300,
                            5487000
                        ],
                        [
                            1597682.1237,
                            5489972.7479
                        ]
                    ]
                }
            ]
        }
    ],
    "max_particles": 1000,
    "trajectory_modifiers": [
        {
            "name": "part_spliting",
            "class_name": "oceantracker.trajectory_modifiers.split_particles.SplitParticles",
            "interval": 21600,
            "statuses": [
                "moving"
            ]
        },
        {
            "name": "part_culling",
            "class_name": "oceantracker.trajectory_modifiers.cull_particles.CullParticles",
            "interval": 21600,
            "statuses": [
                "moving"
            ],
            "probability": 0.05
        }
    ],
    "root_output_dir": "output"
}
yaml parameters
../../../demos/demo_param_files/demo08_particle_splitting.yaml
NUMBA_cache_code: false
add_date_to_run_output_dir: false
block_dry_cells: true
debug: true
dispersion:
  A_H: 0.1
event_loggers:
- class_name: oceantracker.event_loggers.log_polygon_entry_and_exit.LogPolygonEntryAndExit
  name: in_out_poly
  particle_prop_to_write_list:
  - ID
  - x
  - IDrelease_group
  - status
  - age
  polygon_list:
  - points:
    - - 1592682.1237
      - 5489972.7479
    - - 1593604.1667
      - 5490275.5488
    - - 1593886.4247
      - 5489464.0424
    - - 1592917.3387
      - 5489000.0
    - - 1592300.0
      - 5489000.0
    - - 1592682.1237
      - 5489972.7479
    user_polygon_name: A
  - points:
    - - 1597682.1237
      - 5489972.7479
    - - 1598604.1667
      - 5490275.5488
    - - 1598886.4247
      - 5489464.0424
    - - 1597917.3387
      - 5487000
    - - 1597300
      - 5487000
    - - 1597682.1237
      - 5489972.7479
    user_polygon_name: B
max_particles: 1000
output_file_base: demo08_particle_splitting
particle_properties:
- class_name: oceantracker.particle_properties.age_decay.AgeDecay
  decay_time_scale: 86400.0
  name: age_decay
reader:
  file_mask: Random_order_*.nc
  input_dir: F:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
  time_buffer_size: 15
release_groups:
- name: P1
  points:
  - - 1594500
    - 5483500
  - - 1594500
    - 5486500
  pulse_size: 1
  release_interval: 0
root_output_dir: output
time_step: 600
tracks_writer:
  write_dry_cell_flag: true
trajectory_modifiers:
- class_name: oceantracker.trajectory_modifiers.split_particles.SplitParticles
  interval: 21600
  name: part_spliting
  statuses:
  - moving
- class_name: oceantracker.trajectory_modifiers.cull_particles.CullParticles
  interval: 21600
  name: part_culling
  probability: 0.05
  statuses:
  - moving
user_note: test of notes