rompy.core.grid.BaseGrid#
- pydantic model rompy.core.grid.BaseGrid[source]#
Representation of a grid in geographic space.
This is the base class for all Grid objects. The minimum representation of a grid are two NumPy array’s representing the vertices or nodes of some structured or unstructured grid, its bounding box and a boundary polygon. No knowledge of the grid connectivity is expected.
Show JSON schema
{ "title": "BaseGrid", "description": "Representation of a grid in geographic space.\n\nThis is the base class for all Grid objects. The minimum representation of a grid\nare two NumPy array's representing the vertices or nodes of some structured or\nunstructured grid, its bounding box and a boundary polygon. No knowledge of the\ngrid connectivity is expected.", "type": "object", "properties": { "grid_type": { "const": "base", "default": "base", "title": "Grid Type", "type": "string" } }, "additionalProperties": false }
- Fields:
- field grid_type: Literal['base'] = 'base'#
- bbox(buffer=0.0) Bbox [source]#
Returns a bounding box for the spatial grid
This function returns a list [ll_x, ll_y, ur_x, ur_y] where ll_x, ll_y (ur_x, ur_y) are the lower left (upper right) x and y coordinates bounding box of the model domain
- boundary(tolerance=0.2) Polygon [source]#
Returns the convex hull boundary polygon from the grid.
- Parameters:
tolerance (float) – Simplify polygon shape based on maximum distance from original geometry, see https://shapely.readthedocs.io/en/stable/manual.html#object.simplify.
- Returns:
polygon – See https://shapely.readthedocs.io/en/stable/manual.html#Polygon
- Return type:
shapely.Polygon
- boundary_points(spacing=None, tolerance=0.2) tuple [source]#
Returns array of coordinates from boundary polygon.
- Parameters:
tolerance (float) – Simplify polygon shape based on maximum distance from original geometry, see https://shapely.readthedocs.io/en/stable/manual.html#object.simplify.
spacing (float) – If specified, points are returned evenly spaced along the boundary at the specified spacing, otherwise all points are returned.
Returns
--------
points (tuple) – Tuple of x and y coordinates of the boundary points.
- plot(ax=None, figsize=None, fscale=10, buffer=0.1, borders=True, land=True, coastline=True)[source]#
Plot the grid
- property maxx: float#
- property maxy: float#
- property minx: float#
- property miny: float#
- property x: ndarray#
- property y: ndarray#