mapchete.validate module¶
Convenience validator functions for core and extension packages.
- mapchete.validate.deprecated_kwargs(func)¶
Decorator for open() functions warning of keyword argument usage.
- mapchete.validate.validate_bounds(bounds) tilematrix._funcs.Bounds ¶
Return validated bounds.
Bounds must be a list or tuple with exactly four elements.
- Parameters
- boundslist or tuple
- Returns
- Bounds
- Raises
- TypeError if type is invalid.
- mapchete.validate.validate_bufferedtilepyramid(pyramid)¶
Return BufferedTilePyramid.
- Parameters
- pyramidBufferedTilePyramid
- Returns
- BufferedTilePyramid
- Raises
- TypeError if type is invalid.
- mapchete.validate.validate_crs(crs)¶
Return crs as rasterio.crs.CRS.
- Parameters
- crsrasterio.crs.CRS, str, int or dict
- Returns
- rasterio.crs.CRS
- Raises
- TypeError if type is invalid.
- mapchete.validate.validate_tile(tile, pyramid)¶
Return BufferedTile object.
- Parameters
- tiletuple or BufferedTile
- pyramidBufferedTilePyramid
pyramid tile is being generated from if tile is tuple
- Returns
- BufferedTile
- Raises
- TypeError if tile type is invalid.
- mapchete.validate.validate_values(config, values)¶
Return True if all values are given and have the desired type.
- Parameters
- configdict
configuration dictionary
- valueslist
list of (str, type) tuples of values and value types expected in config
- Returns
- True if config is valid.
- Raises
- Exception if value is not found or has the wrong type.
- mapchete.validate.validate_write_window_params(in_tile, out_tile, in_data, out_profile)¶
Raise Exception if write window parameters are invalid.
- mapchete.validate.validate_zoom(zoom)¶
Return validated zoom.
Assert zoom value is positive integer.
- Returns
- zoom
- Raises
- TypeError if type is invalid.
- mapchete.validate.validate_zooms(zooms, expand=True)¶
Return a list of zoom levels.
Following inputs are converted: - int –> [int] - dict{min, max} –> [min … max + 1] - [int] –> [int] - [int, int] –> [smaller int, bigger int + 1]
- Parameters
- zoomdict, int or list
- expandbool
Return full list of zoom levels instead of [min, max]
- Returns
- List of zoom levels.