Particle-field interaction#
parcels.interaction module#
parcels.interaction.neighborsearch module#
- class parcels.interaction.neighborsearch.BruteFlatNeighborSearch(inter_dist_vert, inter_dist_horiz, max_depth=100000, periodic_domain_zonal=None)[source]#
Bases:
BaseFlatNeighborSearch
Brute force implementation to find the neighbors.
- Attributes
active_idx
Indices of the currently active mask.
Methods
find_neighbors_by_coor
(coor)Get the neighbors around a certain location.
find_neighbors_by_idx
(particle_idx)Get the neighbors around a certain particle.
rebuild
(values[, active_mask])Rebuild the neighbor structure from scratch.
update_values
(new_values[, new_active_mask])Update the coordinates of the particles.
- class parcels.interaction.neighborsearch.BruteSphericalNeighborSearch(inter_dist_vert, inter_dist_horiz, max_depth=100000, periodic_domain_zonal=None)[source]#
Bases:
BaseSphericalNeighborSearch
Brute force implementation to find the neighbors.
- Attributes
active_idx
Indices of the currently active mask.
Methods
find_neighbors_by_coor
(coor)Get the neighbors around a certain location.
find_neighbors_by_idx
(particle_idx)Get the neighbors around a certain particle.
rebuild
(values[, active_mask])Rebuild the neighbor structure from scratch.
update_values
(new_values[, new_active_mask])Update the coordinates of the particles.
- class parcels.interaction.neighborsearch.HashFlatNeighborSearch(inter_dist_vert, inter_dist_horiz, max_depth=100000, periodic_domain_zonal=None)[source]#
Bases:
BaseHashNeighborSearch
,BaseFlatNeighborSearch
Neighbor search using a hashtable (similar to octtrees).
- Attributes
active_idx
Indices of the currently active mask.
Methods
consistency_check
()See if all values are in their proper place.
find_neighbors_by_coor
(coor)Get the neighbors around a certain location.
find_neighbors_by_idx
(particle_idx)Get the neighbors around a certain particle.
rebuild
(values[, active_mask])Rebuild the neighbor structure from scratch.
update_values
(new_values[, new_active_mask])Update the locations of (some) of the particles.
- rebuild(values, active_mask=-1)[source]#
Rebuild the neighbor structure from scratch.
- Parameters
values – numpy array with coordinates of particles (same as update).
active_mask – boolean array indicating active particles. (Default value = -1)
- update_values(new_values, new_active_mask=None)[source]#
Update the locations of (some) of the particles.
Particles that stay in the same location are computationally cheap. The order and number of the particles is assumed to remain the same.
- Parameters
new_values – new (depth, lat, lon) values for particles.
new_active_mask – (Default value = None)
- class parcels.interaction.neighborsearch.HashSphericalNeighborSearch(inter_dist_vert, inter_dist_horiz, max_depth=100000)[source]#
Bases:
BaseHashNeighborSearch
,BaseSphericalNeighborSearch
Neighbor search using a hashtable (similar to octtrees).
- Parameters
inter_dist_vert (float) – Interaction distance (vertical) in m.
inter_dist_horiz (float) – interaction distance (horizontal) in m
max_depth (float, optional) – Maximum depth of the particles (default is 100000m).
- Attributes
active_idx
Indices of the currently active mask.
Methods
consistency_check
()See if all values are in their proper place.
find_neighbors_by_coor
(coor)Get the neighbors around a certain location.
find_neighbors_by_idx
(particle_idx)Get the neighbors around a certain particle.
rebuild
(values[, active_mask])Recreate the tree with new values.
update_values
(new_values[, new_active_mask])Update the locations of (some) of the particles.
- class parcels.interaction.neighborsearch.KDTreeFlatNeighborSearch(inter_dist_vert, inter_dist_horiz, max_depth=100000, periodic_domain_zonal=None)[source]#
Bases:
BaseFlatNeighborSearch
- Attributes
active_idx
Indices of the currently active mask.
Methods
find_neighbors_by_coor
(coor)Get the neighbors around a certain location.
find_neighbors_by_idx
(particle_idx)Get the neighbors around a certain particle.
rebuild
([values, active_mask])Rebuild the neighbor structure from scratch.
update_values
(new_values[, new_active_mask])Update the coordinates of the particles.