landlab.graph.sort.ext package#

Submodules#

landlab.graph.sort.ext.argsort module#

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)#

Reorient links to point up and to the right.

Parameters
  • nodes_at_link (ndarray of int, shape (n_nodes, 2)) – Identifier for node at link tail and head.

  • xy_of_node (ndarray of float, shape (n_nodes, 2)) – Coordinate of node as (x, y).

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#