landlab.graph.sort.ext package#

Submodules#

landlab.graph.sort.ext.argsort module#

argsort_id_array(signatures, args, kwargs, defaults, _fused_sigindex={})#
sort_children_at_parent(signatures, args, kwargs, defaults, _fused_sigindex={})#

Sort the children of parents based on child values.

Parameters:
  • children_at_parent (ndarray of shape (n_parents, max_family_size)) – Matrix where each row is the IDs of the children (i.e. an index into the value_at_child array) belonging to a parent. A value of -1 indicates the lack of a child. Note that children can belong to multiple parents.

  • value_at_child (ndarray of shape (n_children,)) – A value for each child to sort on.

  • out (ndarray of shape (n_parents, max_family_size)) – Output array that contains the sorted children for each parent. Missing children (i.e. -1 values) are pushed to the each of each row.

sort_id_array(signatures, args, kwargs, defaults, _fused_sigindex={})#

Sort rows of an id-array matrix.

Parameters:
  • children_at_parent (ndarray of shape (n_parents, max_family_size)) – Matrix where each row is the IDs of the children (i.e. an index into the value_at_child array) belonging to a parent. A value of -1 indicates the lack of a child.

  • value_at_child (ndarray of shape (n_children,)) – A value for each child to sort on.

  • out (ndarray of shape (n_parents, max_family_size)) – Output array that contains the sorted children for each parent. Missing children (i.e. -1 values) are pushed to the each of each row.

landlab.graph.sort.ext.remap_element module#

calc_center_of_patch(ndarray links_at_patch, ndarray offset_to_patch, ndarray xy_at_link, ndarray xy_at_patch)#
map_pairs_to_values(ndarray src_pairs, ndarray data, ndarray pairs, ndarray out)#
map_rolling_pairs_to_values(ndarray src_pairs, ndarray data, ndarray pairs, ndarray size_of_row, ndarray out)#
offset_to_sorted_block(ndarray sorted_ids, ndarray offset_to_block)#
pair_isin(ndarray src_pairs, ndarray pairs, ndarray out)#
remap_graph_element(ndarray elements, ndarray old_to_new)#

Remap elements in an array in place.

Parameters:
  • elements (ndarray of int) – Identifiers of elements.

  • old_to_new (ndarray of int) – Mapping from the old identifier to the new identifier.

remap_graph_element_ignore(ndarray elements, ndarray old_to_new, DTYPE_t bad_val)#

Remap elements in an array in place, ignoring bad values.

Parameters:
  • elements (ndarray of int) – Identifiers of elements.

  • old_to_new (ndarray of int) – Mapping from the old identifier to the new identifier.

  • bad_val (int) – Ignore values in the input array when remapping.

reorder_patches(ndarray links_at_patch, ndarray offset_to_patch, ndarray sorted_patches)#
reverse_element_order(ndarray links_at_patch, ndarray patches)#
reverse_one_to_many(ndarray mapping, ndarray out)#
reverse_one_to_one(ndarray mapping, ndarray out)#

landlab.graph.sort.ext.spoke_sort module#

argsort_points_around_hub(ndarray points, ndarray hub, ndarray out)#

Sort spokes by angle around a hub.

Parameters:
  • points (ndarray of float, shape (n_points, 2)) – Coordinates of points as (x, y).

  • out (ndarray of int, shape (n_points, )) – Indices of sorted points.

Returns:

Indices of sorted points.

Return type:

ndarray of int, shape (n_points, )

argsort_spokes_at_wheel(ndarray spokes_at_wheel, ndarray offset_to_wheel, ndarray xy_of_hub, ndarray xy_of_spoke, ndarray ordered)#
calc_spoke_angles(ndarray hub, ndarray spokes, ndarray angles)#
sort_spokes_around_hub(ndarray spokes, ndarray xy_of_spoke, ndarray xy_of_hub)#
sort_spokes_at_wheel(ndarray spokes_at_wheel, ndarray offset_to_wheel, ndarray xy_of_hub, ndarray xy_of_spoke)#

Sort spokes about multiple hubs.

Parameters:
  • spokes_at_wheel (ndarray of int) – Spokes for each wheel.

  • offset_to_wheel (ndarray of int) – Offset into spokes_at_wheel for each wheel.

  • xy_of_hub (ndarray of float, shape (n_hubs, 2)) – Coordinates of each hub as (x, y).

  • xy_of_spoke (ndarray of float, shape (n_spokes, 2)) – Coordinates of the end of each spoke as (x, y).

Module contents#