pyiem.models.gridnav module#

Grid Navigation Metadata.

class pyiem.models.gridnav.CartesianGridNavigation(*, crs='EPSG:4326', left_edge, bottom_edge, top_edge=None, right_edge=None, dx=None, dy=None, nx=None, ny=None)[source]#

Bases: BaseModel

Navigation for cartesian grid with (0,0) in lower left.

The left_edge and bottom_edge are the only required fields. The rest are optional, but you need to have enough information to define the grid, ie provide dx and dy or nx and ny.

Parameters:
model_config = {'arbitrary_types_allowed': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

crs: str | CRS#
left_edge: float#
bottom_edge: float#
top_edge: float | None#
right_edge: float | None#
dx: float | None#
dy: float | None#
nx: int | None#
ny: int | None#
property x_points: ndarray#

These are the centers of the cells in the x direction.

property y_points: ndarray#

These are the centers of the cells in the y direction.

property x_edges: ndarray#

These are the edges of the x cells (n=NX + 1).

property y_edges: ndarray#

These are the edges of the y cells (n=NY + 1).

property left: float#

The centroid of the left most grid cell.

property right: float#

The centroid of the right most grid cell.

property bottom: float#

The centroid of the bottom most grid cell.

property top: float#

The centroid of the top most grid cell.

property affine#

Return the affine transformation.

property affine_image#

Return the transformation associated with upper left origin.

classmethod complete_definition(values)[source]#

Use information that was provided to compute other fields.

find_ij(lon, lat)[source]#

Find the grid cell that contains the given lon/lat (EPSG: 4326).

Parameters:
Return type:

tuple[int | None, int | None]