seamsh.field module

class seamsh.field.Distance(domain, sampling, tags=None, projection=None)

Bases: object

Callable evaluating the distance to a set of discretized curves.

The curves are discretized as sets of points, then the distance to the closest point is computed.

Parameters:
  • domain (Domain) – a Domain object containing the set of curves

  • sampling (float) – the interval between two consecutive sampling points.

  • tags (Optional[List[str]]) – List of physical tags specifying the curve from the domain. if None, all curves are taken into account.

  • projection (Optional[SpatialReference]) – coordinates system used to search for nearest neighbours if None, the domain projection is used.

__call__(x, projection)

Computes the distance between each point of x and the curves.

Parameters:
  • x (ndarray) – the points [n,2]

  • projection (SpatialReference) – the coordinate system of the points, should be the same coordinate system as the domain, otherwise no conversion is done and an exception is raised.

Return type:

ndarray

Returns:

The distance expressed in the domain unit. [n]

class seamsh.field.Inpoly(domain, tags=None)

Bases: object

Callable evaluating the membership to a set of polygons

Parameters:
  • domain (Domain) – a Domain object containing the set of curves

  • tags (Optional[List[str]]) – List of physical tags specifying the curve from the domain. if None, all curves are taken into account.

__call__(x, projection)

Indicate for each point of x if it belongs to a set of polygons.

Parameters:
  • x (ndarray) – the points [n,2]

  • projection (SpatialReference) – the coordinate system of the points, should be the same coordinate system as the domain, otherwise no conversion is done and an exception is raised.

Return type:

ndarray

Returns:

True if the point belongs to a polygon / False otherwise. [n]

class seamsh.field.Raster(filename)

Bases: object

Callable to evaluate a raster field loaded from a file.

Parameters:

filename (str) – A geotiff file or any other raster supported by gdal.

__call__(x, projection)

Evaluates the field value on each point of x.

Keyword Arguments:
  • x – the points [n,2]

  • projection – the coordinate system of the points

Return type:

ndarray

Returns:

The field value on points x. [n]