equi7grid.core#
Core module defining the Equi7Grid classes.
Module Contents#
Classes#
Defines a tile in the Equi7Grid. |
|
Defines a tiling system for each Equi7Grid continent. |
|
Defines Equi7Grid with all sub-grid. |
Functions#
Get user-defined Equi7Grid definition. |
|
Get standard Equi7Grid definition. |
|
Get Equi7Grid from a grid definition. |
|
Get Equi7Grid from an exported file. |
|
Compute samplings which fit into the given tile size. |
API#
- class equi7grid.core.Equi7Tile#
Bases:
pytileproj.RasterTile[typing.Any]Defines a tile in the Equi7Grid.
- class equi7grid.core.Equi7TilingSystem(/, **data: Any)#
Bases:
pytileproj.RegularProjTilingSystemDefines a tiling system for each Equi7Grid continent.
Initialization
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- get_tile_from_name(ftilename: str) equi7grid.core.Equi7Tile#
Get Equi7 tile from a full tilename.
- Parameters:
ftilename (str) β Full Equi7 tile name.
- Returns:
Equi7 tile corresponding to the given tile name.
- Return type:
- get_tiles_in_geog_bbox(bbox: tuple[float, float, float, float], tiling_id: int | str, *, cover_land: bool = False) equi7grid.core.Equi7TileGenerator#
Get all Equi7 tiles intersecting with the geographic bounding box.
- Parameters:
bbox (tuple[float, float, float, float]) β Bounding box (x_min, y_min, x_max, y_max) for selecting tiles.
tiling_id (int | str) β Tiling level or name. Defaults to the first tiling level.
cover_land (bool, optional) β True if only tiles which cover land should be returned. Defaults to false.
- Returns:
Yields Equi7 tile after tile, which intersects with the given bounding box.
- Return type:
Equi7TileGenerator
- get_tiles_in_geom(proj_geom: pytileproj.ProjGeom, tiling_id: int | str, *, cover_land: bool = False) equi7grid.core.Equi7TileGenerator#
Get all Equi7 tiles intersecting with the geographic bounding box.
- Parameters:
proj_geom (ProjGeom) β Projected geometry representing the region of interest.
tiling_id (int | str) β Tiling level or name. Defaults to the first tiling level.
cover_land (bool, optional) β True if only tiles which cover land should be returned. Defaults to false.
- Returns:
Yields Equi7 tile after tile, which intersects with the given bounding box.
- Return type:
Equi7TileGenerator
- calc_length_distortion(x: float | numpy.ndarray, y: float | numpy.ndarray) float | numpy.ndarray#
Compute local maximum length distortion k.
k equals the local areal distortion (as always h=1 for the Azimuthal Equidistant projection). Uses planar coordinates thus being much faster, than βcalc_length_distortion_on_ellipsoidβ.
- Parameters:
x (float | np.ndarray) β World system coordinates in X direction.
y (float | np.ndarray) β World system coordinates in Y direction.
- Returns:
k β Local max length distortion = local areal distortion.
- Return type:
float | np.ndarray
- get_children_from_name(tilename: str) equi7grid.core.Equi7TileGenerator#
Get all child tiles (next higher tiling level).
- Parameters:
tilename (str) β Tilename.
- Returns:
Yields all tile children as Equi7 tiles.
- Return type:
Equi7TileGenerator
- get_parent_from_name(tilename: str) equi7grid.core.Equi7Tile#
Get parent tile (next lower tiling level).
- Parameters:
tilename (str) β Tilename.
- Returns:
Parent Equi7 tile.
- Return type:
- class equi7grid.core.Equi7Grid#
Bases:
pytileproj.RegularGrid[equi7grid._types.T_co]Defines Equi7Grid with all sub-grid.
- calc_length_distortion_on_ellipsoid(lon: float, lat: float) float#
Compute local maximum length distortion k on the ellipsoid.
k equals the local areal distortion (as always h=1 for the Azimuthal Equidistant projection)
- Parameters:
lon (float) β Longitude.
lat (float) β Latitude.
- Returns:
k β Local max length distortion = local areal distortion.
- Return type:
float
- get_tiles_in_geog_bbox(bbox: tuple[float, float, float, float], tiling_id: int | str, *, cover_land: bool = False) equi7grid.core.Equi7TileGenerator#
Get all Equi7 tiles intersecting with the geographic bounding box.
- Parameters:
bbox (tuple[float, float, float, float]) β Bounding box (x_min, y_min, x_max, y_max) for selecting tiles.
tiling_id (int | str) β Tiling level or name. Defaults to the first tiling level.
cover_land (bool, optional) β True if only tiles which cover land should be returned. Defaults to false.
- Returns:
Yields Equi7 tile after tile, which intersects with the given bounding box.
- Return type:
Equi7TileGenerator
- get_tiles_in_geom(proj_geom: pytileproj.ProjGeom, tiling_id: int | str, *, cover_land: bool = False) equi7grid.core.Equi7TileGenerator#
Get all Equi7 tiles intersecting with the geographic bounding box.
- Parameters:
proj_geom (ProjGeom) β Projected geometry representing the region of interest.
tiling_id (int | str) β Tiling level or name. Defaults to the first tiling level.
cover_land (bool, optional) β True if only tiles which cover land should be returned. Defaults to false.
- Returns:
Yields Equi7 tile after tile, which intersects with the given bounding box.
- Return type:
Equi7TileGenerator
- get_tile_from_name(ftilename: str) equi7grid.core.Equi7Tile#
Get Equi7 tile from a full tilename.
- Parameters:
ftilename (str) β Full Equi7 tile name.
- Returns:
Equi7 tile corresponding to the given tile name.
- Return type:
- equi7grid.core.get_user_equi7grid(sampling: pytileproj._types.SamplingFloatOrMap, tiling_defs: collections.abc.Mapping[int, pytileproj.RegularTilingDefinition], *, buffered: bool = False, continent_order: list[str] | None = None) equi7grid.core.Equi7Grid#
Get user-defined Equi7Grid definition.
- Parameters:
sampling (float | int | Dict[int | str, float | int]) β Grid sampling/pixel size specified as a single value or a dictionary with tiling IDs as keys and samplings as values.
tiling_defs (Dict[int, RegularTilingDefinition]) β Tiling definition (stores name/tiling level and tile size).
buffered (bool, optional) β If this flag is set to true, then the buffered projection zone will be used (defaults to false).
continent_order (list[str] | None, optional) β Defines the usage and order of the continents.
- Returns:
Equi7Grid instance.
- Return type:
- equi7grid.core.get_standard_equi7grid(sampling: pytileproj._types.SamplingFloatOrMap, *, buffered: bool = False, continent_order: list[str] | None = None) equi7grid.core.Equi7Grid#
Get standard Equi7Grid definition.
- Parameters:
sampling (float | int | Dict[int | str, float | int]) β Grid sampling/pixel size specified as a single value or a dictionary with tiling IDs as keys and samplings as values.
buffered (bool, optional) β If this flag is set to true, then the buffered projection zone will be used (defaults to false).
continent_order (list[str] | None, optional) β Defines the usage and order of the continents.
- Returns:
Equi7Grid instance.
- Return type:
- equi7grid.core.get_equi7grid_from_grid_def(json_path: pathlib.Path, sampling: pytileproj._types.SamplingFloatOrMap, *, continent_order: list[str] | None = None) equi7grid.core.Equi7Grid#
Get Equi7Grid from a grid definition.
- Parameters:
json_path (Path) β Path to JSON file storing grid definition.
sampling (float | int | Dict[int | str, float | int]) β Grid sampling/pixel size specified as a single value or a dictionary with tiling IDs as keys and samplings as values.
continent_order (list[str] | None, optional) β Defines the usage and order of the continents.
- Returns:
Equi7Grid instance.
- Return type:
- equi7grid.core.get_equi7grid_from_file(json_path: pathlib.Path) equi7grid.core.Equi7Grid#
Get Equi7Grid from an exported file.
- Parameters:
json_path (Path) β Path to JSON file storing grid definition.
- Returns:
Equi7Grid instance.
- Return type:
- equi7grid.core.allowed_samplings(tile_size: float) list[float]#
Compute samplings which fit into the given tile size.
- Parameters:
tile_size (float) β Tile size.
- Returns:
Divisors/samplings of the given tile size.
- Return type:
list[float]