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,
    "time_step": 600,
    "debug": true,
    "reader": {
        "class_name": "oceantracker.reader.generic_unstructured_reader.GenericUnstructuredReader",
        "input_dir": "E:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "demoHindcast2D*.nc",
        "search_sub_dirs": true,
        "dimension_map": {
            "time": "time",
            "node": "nodes"
        },
        "grid_variables": {
            "time": "time_sec",
            "x": [
                "east",
                "north"
            ],
            "triangles": "tri"
        },
        "field_variables": {
            "water_velocity": [
                "east_vel",
                "north_vel"
            ],
            "water_depth": "depth",
            "tide": "tide"
        },
        "time_buffer_size": 15,
        "isodate_of_hindcast_time_zero": "2020-06-01"
    },
    "user_note": "test of notes",
    "dispersion_miss-spelt": {
        "A_H": 0.1
    },
    "dispersion": {
        "A_H": 0.1
    },
    "tracks_writer": {
        "write_dry_cell_index": true,
        "convert": true
    },
    "release_groups": {
        "P1": {
            "points": [
                [
                    1594500,
                    5482700
                ],
                [
                    1598000,
                    5486100
                ],
                [
                    1595500,
                    5489700
                ]
            ],
            "pulse_size": 10,
            "release_interval": 10800
        },
        "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 ": {
        "Oxygen": {
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0,
            "initial_value": 20.0
        },
        "distance_travelled": {
            "class_name": "oceantracker.particle_properties.distance_travelled.DistanceTravelled"
        }
    },
    "particle_properties": {
        "my_constant_prop": {
            "class_name": "oceantracker.particle_properties.load_carrying.ParticleLoad",
            "initial_value": 100,
            "variance": 10.0
        }
    },
    "block_dry_cells": true,
    "trajectory_modifiers": {
        "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": {
        "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
add_date_to_run_output_dir: false
backtracking: true
block_dry_cells: true
debug: true
dispersion:
  A_H: 0.1
dispersion_miss-spelt:
  A_H: 0.1
output_file_base: demo06_reefstranding
particle_properties:
  my_constant_prop:
    class_name: oceantracker.particle_properties.load_carrying.ParticleLoad
    initial_value: 100
    variance: 10.0
'particle_properties ':
  Oxygen:
    class_name: oceantracker.particle_properties.age_decay.AgeDecay
    decay_time_scale: 86400.0
    initial_value: 20.0
  distance_travelled:
    class_name: oceantracker.particle_properties.distance_travelled.DistanceTravelled
particle_statistics:
  polystats1:
    class_name: oceantracker.particle_statistics.polygon_statistics.PolygonStats2D_timeBased
    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:
  class_name: oceantracker.reader.generic_unstructured_reader.GenericUnstructuredReader
  dimension_map:
    node: nodes
    time: time
  field_variables:
    tide: tide
    water_depth: depth
    water_velocity:
    - east_vel
    - north_vel
  file_mask: demoHindcast2D*.nc
  grid_variables:
    time: time_sec
    triangles: tri
    x:
    - east
    - north
  input_dir: E:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
  isodate_of_hindcast_time_zero: '2020-06-01'
  search_sub_dirs: true
  time_buffer_size: 15
release_groups:
  P1:
    points:
    - - 1594500
      - 5482700
    - - 1598000
      - 5486100
    - - 1595500
      - 5489700
    pulse_size: 10
    release_interval: 10800
  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
root_output_dir: output
time_step: 600
tracks_writer:
  convert: true
  write_dry_cell_index: true
trajectory_modifiers:
  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
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,
    "reader": {
        "input_dir": "E:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "demoHindcastSchism3D.nc",
        "field_variables": {
            "water_temperature": "temp"
        },
        "depth_average": false,
        "field_variables_to_depth_average": [
            "water_velocity",
            "salt",
            "water_temperature"
        ]
    },
    "dispersion": {
        "A_H": 0.1,
        "A_V": 0.005
    },
    "release_groups": {
        "P1": {
            "points": [
                [
                    1593000.0,
                    5486000.0,
                    -1
                ]
            ],
            "pulse_size": 10,
            "release_interval": 0
        },
        "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
                ]
            ],
            "z_range": [
                -2,
                -4.0
            ],
            "pulse_size": 10,
            "release_interval": 3600
        },
        "P11": {
            "points": [
                [
                    1593000.0,
                    5486000.0,
                    -1
                ]
            ],
            "pulse_size": 10,
            "release_interval": 0
        }
    },
    "particle_properties": {
        "age_decay": {
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0
        }
    },
    "event_loggers": {
        "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
                        ]
                    ]
                }
            ]
        }
    },
    "velocity_modifiers": {
        "terminal_velocity": {
            "class_name": "oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity",
            "value": -0.002,
            "variance": 0.0002
        }
    },
    "particle_statistics": {
        "grid1": {
            "class_name": "oceantracker.particle_statistics.gridded_statistics.GriddedStats2D_timeBased",
            "update_interval": 3600,
            "particle_property_list": [
                "water_depth"
            ],
            "status_min": "moving",
            "z_min": -2,
            "grid_size": [
                120,
                121
            ]
        }
    },
    "resuspension": {
        "critical_friction_velocity": 0.005
    },
    "backtracking": false,
    "root_output_dir": "output"
}
yaml parameters
../../../demos/demo_param_files/demo58_bottomBounce.yaml
backtracking: false
debug: true
dispersion:
  A_H: 0.1
  A_V: 0.005
event_loggers:
  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:
    - 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:
  age_decay:
    class_name: oceantracker.particle_properties.age_decay.AgeDecay
    decay_time_scale: 86400.0
particle_statistics:
  grid1:
    class_name: oceantracker.particle_statistics.gridded_statistics.GriddedStats2D_timeBased
    grid_size:
    - 120
    - 121
    particle_property_list:
    - water_depth
    status_min: moving
    update_interval: 3600
    z_min: -2
reader:
  depth_average: false
  field_variables:
    water_temperature: temp
  field_variables_to_depth_average:
  - water_velocity
  - salt
  - water_temperature
  file_mask: demoHindcastSchism3D.nc
  input_dir: E:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
release_groups:
  P1: &id001
    points:
    - - 1593000.0
      - 5486000.0
      - -1
    pulse_size: 10
    release_interval: 0
  P11: *id001
  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: 10
    release_interval: 3600
    z_range:
    - -2
    - -4.0
resuspension:
  critical_friction_velocity: 0.005
root_output_dir: output
time_step: 120
velocity_modifiers:
  terminal_velocity:
    class_name: oceantracker.velocity_modifiers.terminal_velocity.TerminalVelocity
    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,
    "time_step": 600,
    "debug": true,
    "reader": {
        "class_name": "oceantracker.reader.generic_unstructured_reader.GenericUnstructuredReader",
        "input_dir": "E:\\H_Local_drive\\ParticleTracking\\oceantracker\\demos\\demo_hindcast",
        "file_mask": "demoHindcast2D*.nc",
        "search_sub_dirs": true,
        "dimension_map": {
            "time": "time",
            "node": "nodes"
        },
        "grid_variables": {
            "time": "time_sec",
            "x": [
                "east",
                "north"
            ],
            "triangles": "tri"
        },
        "field_variables": {
            "water_velocity": [
                "east_vel",
                "north_vel"
            ],
            "water_depth": "depth",
            "tide": "tide"
        },
        "time_buffer_size": 15,
        "isodate_of_hindcast_time_zero": "2020-06-01"
    },
    "user_note": "test of notes",
    "dispersion_miss-spelt": {
        "A_H": 0.1
    },
    "dispersion": {
        "A_H": 0.1
    },
    "tracks_writer": {
        "write_dry_cell_index": true,
        "convert": true
    },
    "release_groups": {
        "P1": {
            "points": [
                [
                    1594500,
                    5483500
                ],
                [
                    1594500,
                    5486500
                ]
            ],
            "pulse_size": 1,
            "release_interval": 0
        }
    },
    "particle_properties ": {
        "Oxygen": {
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0,
            "initial_value": 20.0
        },
        "distance_travelled": {
            "class_name": "oceantracker.particle_properties.distance_travelled.DistanceTravelled"
        }
    },
    "particle_properties": {
        "age_decay": {
            "class_name": "oceantracker.particle_properties.age_decay.AgeDecay",
            "decay_time_scale": 86400.0
        }
    },
    "block_dry_cells": true,
    "event_loggers": {
        "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,
    "particle_buffer_size": 5000,
    "trajectory_modifiers": {
        "part_spliting": {
            "class_name": "oceantracker.trajectory_modifiers.split_particles.SplitParticles",
            "splitting_interval": 21600,
            "split_status_greater_than": "frozen"
        },
        "part_culling": {
            "class_name": "oceantracker.trajectory_modifiers.cull_particles.CullParticles",
            "cull_interval": 21600,
            "cull_status_greater_than": "dead",
            "probability_of_culling": 0.05
        }
    },
    "root_output_dir": "output"
}
yaml parameters
../../../demos/demo_param_files/demo08_particle_splitting.yaml
add_date_to_run_output_dir: false
block_dry_cells: true
debug: true
dispersion:
  A_H: 0.1
dispersion_miss-spelt:
  A_H: 0.1
event_loggers:
  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:
    - 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_buffer_size: 5000
particle_properties:
  age_decay:
    class_name: oceantracker.particle_properties.age_decay.AgeDecay
    decay_time_scale: 86400.0
'particle_properties ':
  Oxygen:
    class_name: oceantracker.particle_properties.age_decay.AgeDecay
    decay_time_scale: 86400.0
    initial_value: 20.0
  distance_travelled:
    class_name: oceantracker.particle_properties.distance_travelled.DistanceTravelled
reader:
  class_name: oceantracker.reader.generic_unstructured_reader.GenericUnstructuredReader
  dimension_map:
    node: nodes
    time: time
  field_variables:
    tide: tide
    water_depth: depth
    water_velocity:
    - east_vel
    - north_vel
  file_mask: demoHindcast2D*.nc
  grid_variables:
    time: time_sec
    triangles: tri
    x:
    - east
    - north
  input_dir: E:\H_Local_drive\ParticleTracking\oceantracker\demos\demo_hindcast
  isodate_of_hindcast_time_zero: '2020-06-01'
  search_sub_dirs: true
  time_buffer_size: 15
release_groups:
  P1:
    points:
    - - 1594500
      - 5483500
    - - 1594500
      - 5486500
    pulse_size: 1
    release_interval: 0
root_output_dir: output
time_step: 600
tracks_writer:
  convert: true
  write_dry_cell_index: true
trajectory_modifiers:
  part_culling:
    class_name: oceantracker.trajectory_modifiers.cull_particles.CullParticles
    cull_interval: 21600
    cull_status_greater_than: dead
    probability_of_culling: 0.05
  part_spliting:
    class_name: oceantracker.trajectory_modifiers.split_particles.SplitParticles
    split_status_greater_than: frozen
    splitting_interval: 21600
user_note: test of notes