polaris.mesh.spherical.coastline.signed_distance_from_ocean_mask

polaris.mesh.spherical.coastline.signed_distance_from_ocean_mask(ocean_mask, lon, lat, distance_chunk_size=64, workers=1)[source]

Compute the signed distance to the coastline of an ocean mask.

Parameters:
  • ocean_mask (numpy.ndarray) – A boolean ocean mask with dimensions (lat, lon)

  • lon (numpy.ndarray) – The longitude coordinate in degrees

  • lat (numpy.ndarray) – The latitude coordinate in degrees

  • distance_chunk_size (int, optional) – Number of latitude rows per signed-distance query chunk

  • workers (int, optional) – Number of workers to use in KD-tree queries

Returns:

signed_distance (numpy.ndarray) – The signed distance in meters to the nearest coastline sample (positive over ocean, negative over land)