sisppeo.utils.products.CoordinatesMixin

class sisppeo.utils.products.CoordinatesMixin[source]

Bases: object

A Mixin which adds extra properties and methods related to coordinates.

__init__()

Methods

__init__()

extract_point(data_var, coordinates[, ...])

Returns value(s) at the given coordinates.

extract_points(data_var, lst_coordinates[, ...])

Returns value(s) at each tuple of coordinates of the given list.

index(x, y)

Gets (i, j) from (x, y)

xy(i, j)

Gets (x, y) from (i, j).

Attributes

bounds

(xmin, ymin, xmax, ymax).

res

Returns the spatial resolution of this product.

x

Returns x-coords.

y

Returns y-coords.

property bounds

(xmin, ymin, xmax, ymax).

Type

Returns the boundaries of this product

extract_point(data_var, coordinates, buffer=None, epsg=4326, mode='xy')[source]

Returns value(s) at the given coordinates.

Parameters
  • data_var – The name of the variable/DataArray of interest (e.g., a band, aCDOM, etc).

  • coordinates – A tuple of geographic or projected coordinates; see “mode”.

  • buffer – Optional; The radius (in pixels) of the circle (centered on coordinates) to extract. Defaults to None.

  • epsg – Optional; The EPSG code. Defaults to 4326.

  • mode – Optional; Either ‘xy’ or ‘latlon’. Defaults to ‘xy’.

Returns

An xr.DataArray containing the wanted information.

extract_points(data_var, lst_coordinates, buffer=None, epsg=4326, mode='xy')[source]

Returns value(s) at each tuple of coordinates of the given list.

Parameters
  • data_var – The name of the variable/DataArray of interest (e.g., a band, aCDOM, etc).

  • lst_coordinates – A list of tuples of geographic or projected coordinates; see “mode”.

  • buffer – Optional; The radius (in pixels) of the circle (centered on coordinates) to extract. Defaults to None.

  • epsg – Optional; The EPSG code. Defaults to 4326.

  • mode – Optional; Either ‘xy’ or ‘latlon’. Defaults to ‘xy’.

Returns

A list of xr.DataArray (one per coordinates tuple) containing the wanted information.

index(x, y)[source]

Gets (i, j) from (x, y)

property res

Returns the spatial resolution of this product.

property x

Returns x-coords.

xy(i, j)[source]

Gets (x, y) from (i, j).

property y

Returns y-coords.