From 1768f7103229c510882242be02d7cc5201fd5552 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Fri, 6 Sep 2024 09:56:00 +0200 Subject: [PATCH] switch to mkdocstrings --- .github/workflows/deploy_mkdocs.yml | 33 +- docs/mkdocs.yml | 34 +- docs/src/api/rio_tiler/colormap.md | 233 +- docs/src/api/rio_tiler/constants.md | 26 +- docs/src/api/rio_tiler/errors.md | 828 +--- docs/src/api/rio_tiler/expression.md | 86 +- docs/src/api/rio_tiler/io/base.md | 955 +---- docs/src/api/rio_tiler/io/stac.md | 432 +-- docs/src/api/rio_tiler/models.md | 3443 +---------------- docs/src/api/rio_tiler/mosaic/methods/base.md | 80 +- .../api/rio_tiler/mosaic/methods/defaults.md | 464 +-- docs/src/api/rio_tiler/mosaic/reader.md | 90 +- docs/src/api/rio_tiler/profiles.md | 896 +---- docs/src/api/rio_tiler/reader.md | 334 +- docs/src/api/rio_tiler/tasks.md | 111 +- docs/src/api/rio_tiler/utils.md | 306 +- pyproject.toml | 9 +- rio_tiler/colormap.py | 4 +- rio_tiler/io/rasterio.py | 4 +- rio_tiler/io/stac.py | 2 +- rio_tiler/models.py | 5 +- 21 files changed, 65 insertions(+), 8310 deletions(-) diff --git a/.github/workflows/deploy_mkdocs.yml b/.github/workflows/deploy_mkdocs.yml index 778eb014..a7fca9f8 100644 --- a/.github/workflows/deploy_mkdocs.yml +++ b/.github/workflows/deploy_mkdocs.yml @@ -18,42 +18,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout main - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install numpy python -m pip install -e .["docs"] - python -m pip install git+https://github.com/timothycrosley/pdocs - - - name: update API docs - run: | - pdocs as_markdown \ - --output_dir docs/src/api/ \ - --exclude_source \ - --overwrite \ - rio_tiler.colormap \ - rio_tiler.constants \ - rio_tiler.errors \ - rio_tiler.expression \ - rio_tiler.models \ - rio_tiler.io.base \ - rio_tiler.io.rasterio \ - rio_tiler.io.stac \ - rio_tiler.io.xarray \ - rio_tiler.mosaic.methods.base \ - rio_tiler.mosaic.methods.defaults \ - rio_tiler.mosaic.reader \ - rio_tiler.profiles \ - rio_tiler.reader \ - rio_tiler.tasks \ - rio_tiler.utils - name: Deploy docs run: mkdocs gh-deploy -f docs/mkdocs.yml --force diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 512459b6..18d5e6a8 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -76,9 +76,33 @@ nav: plugins: - search - mkdocs-jupyter: - include_source: True + include_source: true + ignore: ["**/.ipynb_checkpoints/*.ipynb"] - mkdocstrings: enable_inventory: true + handlers: + python: + paths: [src] + options: + filters: + - "!^__post_init__" + docstring_section_style: list + docstring_style: google + line_length: 100 + separate_signature: true + show_root_heading: true + show_signature_annotations: true + show_source: false + show_symbol_type_toc: true + signature_crossrefs: true + extensions: + - griffe_inherited_docstrings + import: + - https://docs.python.org/3/objects.inv + - https://numpy.org/doc/stable/objects.inv + - https://rasterio.readthedocs.io/en/stable/objects.inv + - https://docs.pydantic.dev/latest/objects.inv + - https://developmentseed.org/morecantile/objects.inv # Theme theme: @@ -94,6 +118,14 @@ theme: text: 'Nunito Sans' code: 'Fira Code' custom_dir: 'src/overrides' + features: + - content.code.annotate + - content.code.copy + - navigation.indexes + - navigation.instant + - navigation.tracking + - search.suggest + - search.share # These extensions are chosen to be a superset of Pandoc's Markdown. # This way, I can write in Pandoc's Markdown and have it be supported here. diff --git a/docs/src/api/rio_tiler/colormap.md b/docs/src/api/rio_tiler/colormap.md index f3bc15fb..45228fed 100644 --- a/docs/src/api/rio_tiler/colormap.md +++ b/docs/src/api/rio_tiler/colormap.md @@ -1,232 +1 @@ -# Module rio_tiler.colormap - -rio-tiler colormap functions and classes. - -None - -## Variables - -```python3 -DEFAULT_CMAPS_FILES -``` - -```python3 -EMPTY_COLORMAP -``` - -```python3 -USER_CMAPS_DIR -``` - -```python3 -cmap -``` - -## Functions - - -### apply_cmap - -```python3 -def apply_cmap( - data: numpy.ndarray, - colormap: Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]]] -) -> Tuple[numpy.ndarray, numpy.ndarray] -``` - - -Apply colormap on data. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ndarray | 1D image array to translate to RGB. | None | -| colormap | dict or sequence | GDAL RGBA Color Table dictionary or sequence (for intervals). | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | Data (numpy.ndarray) and Mask (numpy.ndarray) values. | - -**Raises:** - -| Type | Description | -|---|---| -| InvalidFormat | If data is not a 1 band dataset (1, col, row). | - - -### apply_discrete_cmap - -```python3 -def apply_discrete_cmap( - data: numpy.ndarray, - colormap: Dict[int, Tuple[int, int, int, int]] -) -> Tuple[numpy.ndarray, numpy.ndarray] -``` - - -Apply discrete colormap. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ndarray | 1D image array to translate to RGB. | None | -| color_map | dict | Discrete ColorMap dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | Data (numpy.ndarray) and Alpha band (numpy.ndarray). | - - -### apply_intervals_cmap - -```python3 -def apply_intervals_cmap( - data: numpy.ndarray, - colormap: Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]] -) -> Tuple[numpy.ndarray, numpy.ndarray] -``` - - -Apply intervals colormap. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ndarray | 1D image array to translate to RGB. | None | -| color_map | Sequence | Sequence of intervals and color in form of [([min, max], [r, g, b, a]), ...]. | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | Data (numpy.ndarray) and Alpha band (numpy.ndarray). | - - -### make_lut - -```python3 -def make_lut( - colormap: Dict[int, Tuple[int, int, int, int]] -) -> numpy.ndarray -``` - - -Create a lookup table numpy.ndarray from a GDAL RGBA Color Table dictionary. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| colormap | dict | GDAL RGBA Color Table dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| numpy.ndarray | colormap lookup table. | - - -### parse_color - -```python3 -def parse_color( - rgba: Union[Sequence[int], str] -) -> Tuple[int, int, int, int] -``` - - -Parse RGB/RGBA color and return valid rio-tiler compatible RGBA colormap entry. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| rgba | str or list of int | HEX encoded or list RGB or RGBA colors. | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | RGBA values. | - -## Classes - -### ColorMaps - -```python3 -class ColorMaps( - data: Dict[str, Union[str, Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]]]] = NOTHING -) -``` - -#### Attributes - -| Name | Type | Description | Default | -|---|---|---|---| -| data | dict | colormaps. Defaults to `rio_tiler.colormap.DEFAULTS_CMAPS`. | `rio_tiler.colormap.DEFAULTS_CMAPS` | - -#### Methods - - -#### get - -```python3 -def get( - self, - name: str -) -> Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]]] -``` - - -Fetch a colormap. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| name | str | colormap name. -Returns | None | -| dict | None | colormap dictionary. | None | - - -#### list - -```python3 -def list( - self -) -> List[str] -``` - - -List registered Colormaps. - -Returns - list: list of colormap names. - - -#### register - -```python3 -def register( - self, - custom_cmap: Dict[str, Union[str, Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]]]], - overwrite: bool = False -) -> 'ColorMaps' -``` - - -Register a custom colormap. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| custom_cmap | dict | custom colormap(s) to register. | None | -| overwrite | bool | Overwrite existing colormap with same key. Defaults to False. | False | \ No newline at end of file +::: rio_tiler.colormap diff --git a/docs/src/api/rio_tiler/constants.md b/docs/src/api/rio_tiler/constants.md index ef2b7541..57b57764 100644 --- a/docs/src/api/rio_tiler/constants.md +++ b/docs/src/api/rio_tiler/constants.md @@ -1,23 +1,3 @@ -# Module rio_tiler.constants - -rio-tiler constant values. - -None - -## Variables - -```python3 -MAX_THREADS -``` - -```python3 -WEB_MERCATOR_CRS -``` - -```python3 -WEB_MERCATOR_TMS -``` - -```python3 -WGS84_CRS -``` \ No newline at end of file +::: rio_tiler.constants + options: + show_source: true diff --git a/docs/src/api/rio_tiler/errors.md b/docs/src/api/rio_tiler/errors.md index bdc8b7a4..3d42f708 100644 --- a/docs/src/api/rio_tiler/errors.md +++ b/docs/src/api/rio_tiler/errors.md @@ -1,827 +1 @@ -# Module rio_tiler.errors - -Errors and warnings. - -None - -## Classes - -### AlphaBandWarning - -```python3 -class AlphaBandWarning( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.UserWarning -* builtins.Warning -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### AssetAsBandError - -```python3 -class AssetAsBandError( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### ColorMapAlreadyRegistered - -```python3 -class ColorMapAlreadyRegistered( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### EmptyMosaicError - -```python3 -class EmptyMosaicError( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### ExpressionMixingWarning - -```python3 -class ExpressionMixingWarning( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.UserWarning -* builtins.Warning -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidAssetName - -```python3 -class InvalidAssetName( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidBandName - -```python3 -class InvalidBandName( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidBufferSize - -```python3 -class InvalidBufferSize( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidColorFormat - -```python3 -class InvalidColorFormat( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidColorMapName - -```python3 -class InvalidColorMapName( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidDatatypeWarning - -```python3 -class InvalidDatatypeWarning( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.UserWarning -* builtins.Warning -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidExpression - -```python3 -class InvalidExpression( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidFormat - -```python3 -class InvalidFormat( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidMosaicMethod - -```python3 -class InvalidMosaicMethod( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### InvalidPointDataError - -```python3 -class InvalidPointDataError( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### MissingAssets - -```python3 -class MissingAssets( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### MissingBands - -```python3 -class MissingBands( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### NoOverviewWarning - -```python3 -class NoOverviewWarning( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.UserWarning -* builtins.Warning -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### PointOutsideBounds - -```python3 -class PointOutsideBounds( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### RioTilerError - -```python3 -class RioTilerError( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.Exception -* builtins.BaseException - -#### Descendants - -* rio_tiler.errors.InvalidFormat -* rio_tiler.errors.TileOutsideBounds -* rio_tiler.errors.InvalidBufferSize -* rio_tiler.errors.PointOutsideBounds -* rio_tiler.errors.InvalidBandName -* rio_tiler.errors.InvalidColorMapName -* rio_tiler.errors.InvalidAssetName -* rio_tiler.errors.InvalidExpression -* rio_tiler.errors.MissingAssets -* rio_tiler.errors.MissingBands -* rio_tiler.errors.InvalidMosaicMethod -* rio_tiler.errors.ColorMapAlreadyRegistered -* rio_tiler.errors.EmptyMosaicError -* rio_tiler.errors.InvalidColorFormat -* rio_tiler.errors.AssetAsBandError -* rio_tiler.errors.InvalidPointDataError - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. - -### TileOutsideBounds - -```python3 -class TileOutsideBounds( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.errors.RioTilerError -* builtins.Exception -* builtins.BaseException - -#### Class variables - -```python3 -args -``` - -#### Methods - - -#### with_traceback - -```python3 -def with_traceback( - ... -) -``` - - -Exception.with_traceback(tb) -- - -set self.__traceback__ to tb and return self. \ No newline at end of file +::: rio_tiler.errors diff --git a/docs/src/api/rio_tiler/expression.md b/docs/src/api/rio_tiler/expression.md index b15a43f6..e162bd01 100644 --- a/docs/src/api/rio_tiler/expression.md +++ b/docs/src/api/rio_tiler/expression.md @@ -1,85 +1 @@ -# Module rio_tiler.expression - -rio-tiler.expression: Parse and Apply expression. - -None - -## Functions - - -### apply_expression - -```python3 -def apply_expression( - blocks: Sequence[str], - bands: Sequence[str], - data: numpy.ndarray -) -> numpy.ma.core.MaskedArray -``` - - -Apply rio-tiler expression. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| blocks | sequence | expression for a specific layer. | None | -| bands | sequence | bands names. | None | -| data | numpy.array | array of bands. | None | - -**Returns:** - -| Type | Description | -|---|---| -| numpy.array | output data. | - - -### get_expression_blocks - -```python3 -def get_expression_blocks( - expression: str -) -> List[str] -``` - - -Split expression in blocks. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| expression | str | band math/combination expression. | None | - -**Returns:** - -| Type | Description | -|---|---| -| list | expression blocks (str). | - - -### parse_expression - -```python3 -def parse_expression( - expression: str, - cast: bool = True -) -> Tuple -``` - - -Parse rio-tiler band math expression. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| expression | str | band math/combination expression. | None | -| cast | bool | cast band names to integers (convert to index values). Defaults to True. | True | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | band names/indexes. | \ No newline at end of file +::: rio_tiler.expression diff --git a/docs/src/api/rio_tiler/io/base.md b/docs/src/api/rio_tiler/io/base.md index 322c3746..20ed12f4 100644 --- a/docs/src/api/rio_tiler/io/base.md +++ b/docs/src/api/rio_tiler/io/base.md @@ -1,954 +1 @@ -# Module rio_tiler.io.base - -rio_tiler.io.base: ABC class for rio-tiler readers. - -None - -## Variables - -```python3 -WGS84_CRS -``` - -## Classes - -### BaseReader - -```python3 -class BaseReader( - input: Any, - tms: morecantile.models.TileMatrixSet = rio_tiler.models.ImageData -``` - - -Read a Dataset for a GeoJSON feature. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| shape | dict | Valid GeoJSON feature. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and input spatial info. | - - -#### info - -```python3 -def info( - self -) -> rio_tiler.models.Info -``` - - -Return Dataset's info. - -**Returns:** - -| Type | Description | -|---|---| -| rio_tile.models.Info | Dataset info. | - - -#### part - -```python3 -def part( - self, - bbox: Tuple[float, float, float, float] -) -> rio_tiler.models.ImageData -``` - - -Read a Part of a Dataset. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bbox | tuple | Output bounds (left, bottom, right, top) in target crs. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and input spatial info. | - - -#### point - -```python3 -def point( - self, - lon: float, - lat: float -) -> rio_tiler.models.PointData -``` - - -Read a value from a Dataset. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| lon | float | Longitude. | None | -| lat | float | Latitude. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.PointData | PointData instance with data, mask and spatial info. | - - -#### preview - -```python3 -def preview( - self -) -> rio_tiler.models.ImageData -``` - - -Read a preview of a Dataset. - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and input spatial info. | - - -#### statistics - -```python3 -def statistics( - self -) -> Dict[str, rio_tiler.models.BandStatistics] -``` - - -Return bands statistics from a dataset. - -**Returns:** - -| Type | Description | -|---|---| -| Dict[str, rio_tiler.models.BandStatistics] | bands statistics. | - - -#### tile - -```python3 -def tile( - self, - tile_x: int, - tile_y: int, - tile_z: int -) -> rio_tiler.models.ImageData -``` - - -Read a Map tile from the Dataset. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### tile_exists - -```python3 -def tile_exists( - self, - tile_x: int, - tile_y: int, - tile_z: int -) -> bool -``` - - -Check if a tile intersects the dataset bounds. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | - -**Returns:** - -| Type | Description | -|---|---| -| bool | True if the tile intersects the dataset bounds. | - -### MultiBandReader - -```python3 -class MultiBandReader( - input: Any, - tms: morecantile.models.TileMatrixSet = rio_tiler.models.ImageData -``` - - -Read and merge parts defined by geojson feature from multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| shape | dict | Valid GeoJSON feature. | None | -| bands | sequence of str or str | bands to fetch info from. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| kwargs | optional | Options to forward to the `self.reader.feature` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### info - -```python3 -def info( - self, - bands: Union[Sequence[str], str] = None, - *args, - **kwargs: Any -) -> rio_tiler.models.Info -``` - - -Return metadata from multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bands | sequence of str or str | band names to fetch info from. Required keyword argument. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple bands info in form of {"band1": rio_tile.models.Info}. | - - -#### parse_expression - -```python3 -def parse_expression( - self, - expression: str -) -> Tuple -``` - - -Parse rio-tiler band math expression. - - -#### part - -```python3 -def part( - self, - bbox: Tuple[float, float, float, float], - bands: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge parts from multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bbox | tuple | Output bounds (left, bottom, right, top) in target crs. | None | -| bands | sequence of str or str | bands to fetch info from. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| kwargs | optional | Options to forward to the 'self.reader.part' method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### point - -```python3 -def point( - self, - lon: float, - lat: float, - bands: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - **kwargs: Any -) -> rio_tiler.models.PointData -``` - - -Read a pixel values from multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| lon | float | Longitude. | None | -| lat | float | Latitude. | None | -| bands | sequence of str or str | bands to fetch info from. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| kwargs | optional | Options to forward to the `self.reader.point` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | PointData | - - -#### preview - -```python3 -def preview( - self, - bands: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge previews from multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bands | sequence of str or str | bands to fetch info from. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| kwargs | optional | Options to forward to the `self.reader.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### statistics - -```python3 -def statistics( - self, - bands: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - categorical: bool = False, - categories: Optional[List[float]] = None, - percentiles: Optional[List[int]] = None, - hist_options: Optional[Dict] = None, - max_size: int = 1024, - **kwargs: Any -) -> Dict[str, rio_tiler.models.BandStatistics] -``` - - -Return array statistics for multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bands | sequence of str or str | bands to fetch info from. Required keyword argument. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| categorical | bool | treat input data as categorical data. Defaults to False. | False | -| categories | list of numbers | list of categories to return value for. | None | -| percentiles | list of numbers | list of percentile values to calculate. Defaults to `[2, 98]`. | `[2, 98]` | -| hist_options | dict | Options to forward to numpy.histogram function. | None | -| max_size | int | Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024. | 1024 | -| kwargs | optional | Options to forward to the `self.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple assets statistics in form of {"{band}/{expression}": rio_tiler.models.BandStatistics, ...}. | - - -#### tile - -```python3 -def tile( - self, - tile_x: int, - tile_y: int, - tile_z: int, - bands: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge Web Map tiles multiple bands. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | -| bands | sequence of str or str | bands to fetch info from. | None | -| expression | str | rio-tiler expression for the band list (e.g. b1/b2+b3). | None | -| kwargs | optional | Options to forward to the `self.reader.tile` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### tile_exists - -```python3 -def tile_exists( - self, - tile_x: int, - tile_y: int, - tile_z: int -) -> bool -``` - - -Check if a tile intersects the dataset bounds. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | - -**Returns:** - -| Type | Description | -|---|---| -| bool | True if the tile intersects the dataset bounds. | - -### MultiBaseReader - -```python3 -class MultiBaseReader( - input: Any, - tms: morecantile.models.TileMatrixSet = rio_tiler.models.ImageData -``` - - -Read and merge parts defined by geojson feature from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| shape | dict | Valid GeoJSON feature. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.feature` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### info - -```python3 -def info( - self, - assets: Union[Sequence[str], str] = None, - **kwargs: Any -) -> Dict[str, rio_tiler.models.Info] -``` - - -Return metadata from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. Required keyword argument. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple assets info in form of {"asset1": rio_tile.models.Info}. | - - -#### merged_statistics - -```python3 -def merged_statistics( - self, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - categorical: bool = False, - categories: Optional[List[float]] = None, - percentiles: Optional[List[int]] = None, - hist_options: Optional[Dict] = None, - max_size: int = 1024, - **kwargs: Any -) -> Dict[str, rio_tiler.models.BandStatistics] -``` - - -Return array statistics for multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| categorical | bool | treat input data as categorical data. Defaults to False. | False | -| categories | list of numbers | list of categories to return value for. | None | -| percentiles | list of numbers | list of percentile values to calculate. Defaults to `[2, 98]`. | `[2, 98]` | -| hist_options | dict | Options to forward to numpy.histogram function. | None | -| max_size | int | Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024. | 1024 | -| kwargs | optional | Options to forward to the `self.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| Dict[str, rio_tiler.models.BandStatistics] | bands statistics. | - - -#### parse_expression - -```python3 -def parse_expression( - self, - expression: str, - asset_as_band: bool = False -) -> Tuple -``` - - -Parse rio-tiler band math expression. - - -#### part - -```python3 -def part( - self, - bbox: Tuple[float, float, float, float], - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge parts from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bbox | tuple | Output bounds (left, bottom, right, top) in target crs. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.part` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### point - -```python3 -def point( - self, - lon: float, - lat: float, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.PointData -``` - - -Read pixel value from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| lon | float | Longitude. | None | -| lat | float | Latitude. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.point` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | PointData | - - -#### preview - -```python3 -def preview( - self, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge previews from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### statistics - -```python3 -def statistics( - self, - assets: Union[Sequence[str], str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_expression: Optional[Dict[str, str]] = None, - **kwargs: Any -) -> Dict[str, Dict[str, rio_tiler.models.BandStatistics]] -``` - - -Return array statistics for multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| asset_expression | dict | rio-tiler expression for each asset (e.g. {"asset1": "b1/b2+b3", "asset2": ...}). | None | -| kwargs | optional | Options to forward to the `self.reader.statistics` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple assets statistics in form of {"asset1": {"1": rio_tiler.models.BandStatistics, ...}}. | - - -#### tile - -```python3 -def tile( - self, - tile_x: int, - tile_y: int, - tile_z: int, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge Wep Map tiles from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.tile` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### tile_exists - -```python3 -def tile_exists( - self, - tile_x: int, - tile_y: int, - tile_z: int -) -> bool -``` - - -Check if a tile intersects the dataset bounds. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | - -**Returns:** - -| Type | Description | -|---|---| -| bool | True if the tile intersects the dataset bounds. | - -### SpatialMixin - -```python3 -class SpatialMixin( - tms: morecantile.models.TileMatrixSet = bytes -``` - - -AWS s3 get object content. - - -### fetch - -```python3 -def fetch( - filepath: str, - **kwargs: Any -) -> Dict -``` - - -Fetch STAC items. - -A LRU cache is set on top of this function. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| filepath | str | STAC item URL. | None | -| kwargs | any | additional options to pass to client. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | STAC Item content. | - -## Classes - -### STACReader - -```python3 -class STACReader( - input: str, - item: Union[NoneType, Dict, pystac.item.Item] = None, - tms: morecantile.models.TileMatrixSet = , - reader_options: Dict = NOTHING, - fetch_options: Dict = NOTHING, - ctx: Any = -) -``` - -#### Attributes - -| Name | Type | Description | Default | -|---|---|---|---| -| input | str | STAC Item path, URL or S3 URL. | None | -| item | dict or pystac.Item, STAC | Stac Item. | None | -| tms | morecantile.TileMatrixSet | TileMatrixSet grid definition. Defaults to `WebMercatorQuad`. | `WebMercatorQuad` | -| minzoom | int | Set minzoom for the tiles. | None | -| maxzoom | int | Set maxzoom for the tiles. | None | -| geographic_crs | rasterio.crs.CRS | CRS to use as geographic coordinate system. Defaults to WGS84. | WGS84 | -| include_assets | set of string | Only Include specific assets. | None | -| exclude_assets | set of string | Exclude specific assets. | None | -| include_asset_types | set of string | Only include some assets base on their type. | None | -| exclude_asset_types | set of string | Exclude some assets base on their type. | None | -| reader | rio_tiler.io.BaseReader | rio-tiler Reader. Defaults to `rio_tiler.io.Reader`. | `rio_tiler.io.Reader` | -| reader_options | dict | Additional option to forward to the Reader. Defaults to `{}`. | `{}` | -| fetch_options | dict | Options to pass to `rio_tiler.io.stac.fetch` function fetching the STAC Items. Defaults to `{}`. | `{}` | - -#### Ancestors (in MRO) - -* rio_tiler.io.base.MultiBaseReader -* rio_tiler.io.base.SpatialMixin - -#### Instance variables - -```python3 -geographic_bounds -``` - -Return dataset bounds in geographic_crs. - -#### Methods - - -#### feature - -```python3 -def feature( - self, - shape: Dict, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge parts defined by geojson feature from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| shape | dict | Valid GeoJSON feature. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.feature` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### info - -```python3 -def info( - self, - assets: Union[Sequence[str], str] = None, - **kwargs: Any -) -> Dict[str, rio_tiler.models.Info] -``` - - -Return metadata from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. Required keyword argument. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple assets info in form of {"asset1": rio_tile.models.Info}. | - - -#### merged_statistics - -```python3 -def merged_statistics( - self, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - categorical: bool = False, - categories: Optional[List[float]] = None, - percentiles: Optional[List[int]] = None, - hist_options: Optional[Dict] = None, - max_size: int = 1024, - **kwargs: Any -) -> Dict[str, rio_tiler.models.BandStatistics] -``` - - -Return array statistics for multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| categorical | bool | treat input data as categorical data. Defaults to False. | False | -| categories | list of numbers | list of categories to return value for. | None | -| percentiles | list of numbers | list of percentile values to calculate. Defaults to `[2, 98]`. | `[2, 98]` | -| hist_options | dict | Options to forward to numpy.histogram function. | None | -| max_size | int | Limit the size of the longest dimension of the dataset read, respecting bounds X/Y aspect ratio. Defaults to 1024. | 1024 | -| kwargs | optional | Options to forward to the `self.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| Dict[str, rio_tiler.models.BandStatistics] | bands statistics. | - - -#### parse_expression - -```python3 -def parse_expression( - self, - expression: str, - asset_as_band: bool = False -) -> Tuple -``` - - -Parse rio-tiler band math expression. - - -#### part - -```python3 -def part( - self, - bbox: Tuple[float, float, float, float], - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge parts from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| bbox | tuple | Output bounds (left, bottom, right, top) in target crs. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.part` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### point - -```python3 -def point( - self, - lon: float, - lat: float, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.PointData -``` - - -Read pixel value from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| lon | float | Longitude. | None | -| lat | float | Latitude. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.point` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | PointData | - - -#### preview - -```python3 -def preview( - self, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge previews from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.preview` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### statistics - -```python3 -def statistics( - self, - assets: Union[Sequence[str], str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_expression: Optional[Dict[str, str]] = None, - **kwargs: Any -) -> Dict[str, Dict[str, rio_tiler.models.BandStatistics]] -``` - - -Return array statistics for multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| assets | sequence of str or str | assets to fetch info from. | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| asset_expression | dict | rio-tiler expression for each asset (e.g. {"asset1": "b1/b2+b3", "asset2": ...}). | None | -| kwargs | optional | Options to forward to the `self.reader.statistics` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| dict | Multiple assets statistics in form of {"asset1": {"1": rio_tiler.models.BandStatistics, ...}}. | - - -#### tile - -```python3 -def tile( - self, - tile_x: int, - tile_y: int, - tile_z: int, - assets: Union[Sequence[str], str] = None, - expression: Optional[str] = None, - asset_indexes: Optional[Dict[str, Union[Sequence[int], int]]] = None, - asset_as_band: bool = False, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Read and merge Wep Map tiles from multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | -| assets | sequence of str or str | assets to fetch info from. | None | -| expression | str | rio-tiler expression for the asset list (e.g. asset1/asset2+asset3). | None | -| asset_indexes | dict | Band indexes for each asset (e.g {"asset1": 1, "asset2": (1, 2,)}). | None | -| kwargs | optional | Options to forward to the `self.reader.tile` method. | None | - -**Returns:** - -| Type | Description | -|---|---| -| rio_tiler.models.ImageData | ImageData instance with data, mask and tile spatial info. | - - -#### tile_exists - -```python3 -def tile_exists( - self, - tile_x: int, - tile_y: int, - tile_z: int -) -> bool -``` - - -Check if a tile intersects the dataset bounds. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tile_x | int | Tile's horizontal index. | None | -| tile_y | int | Tile's vertical index. | None | -| tile_z | int | Tile's zoom level index. | None | - -**Returns:** - -| Type | Description | -|---|---| -| bool | True if the tile intersects the dataset bounds. | \ No newline at end of file +::: rio_tiler.io.stac diff --git a/docs/src/api/rio_tiler/models.md b/docs/src/api/rio_tiler/models.md index b4a8bdf9..747e38b5 100644 --- a/docs/src/api/rio_tiler/models.md +++ b/docs/src/api/rio_tiler/models.md @@ -1,3442 +1 @@ -# Module rio_tiler.models - -rio-tiler models. - -None - -## Variables - -```python3 -WGS84_CRS -``` - -```python3 -dtype_ranges -``` - -## Functions - - -### masked_and_3d - -```python3 -def masked_and_3d( - array: numpy.ndarray -) -> numpy.ma.core.MaskedArray -``` - - -Makes sure we have a 3D array and mask - - -### rescale_image - -```python3 -def rescale_image( - array: numpy.ma.core.MaskedArray, - in_range: Sequence[Tuple[Union[float, int], Union[float, int]]], - out_range: Sequence[Tuple[Union[float, int], Union[float, int]]] = ((0, 255),), - out_dtype: Union[str, numpy.number] = 'uint8' -) -> numpy.ma.core.MaskedArray -``` - - -Rescale image data in-place. - - -### to_coordsbbox - -```python3 -def to_coordsbbox( - bbox -) -> Optional[rasterio.coords.BoundingBox] -``` - - -Convert bbox to CoordsBbox nameTuple. - - -### to_masked - -```python3 -def to_masked( - array: numpy.ndarray -) -> numpy.ma.core.MaskedArray -``` - - -Makes sure we have a MaskedArray. - -## Classes - -### BandStatistics - -```python3 -class BandStatistics( - __pydantic_self__, - **data: 'Any' -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.models.RioTilerBaseModel -* pydantic.main.BaseModel - -#### Class variables - -```python3 -model_config -``` - -```python3 -model_fields -``` - -#### Static methods - - -#### construct - -```python3 -def construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - - - -#### from_orm - -```python3 -def from_orm( - obj: 'Any' -) -> 'Model' -``` - - - - -#### model_construct - -```python3 -def model_construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. -Behaves as if `Config.extra = 'allow'` was set since it adds all passed values - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| _fields_set | None | The set of field names accepted for the Model instance. | None | -| values | None | Trusted or pre-validated data dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A new instance of the `Model` class with validated data. | - - -#### model_json_schema - -```python3 -def model_json_schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - schema_generator: 'type[GenerateJsonSchema]' = , - mode: 'JsonSchemaMode' = 'validation' -) -> 'dict[str, Any]' -``` - - -Generates a JSON schema for a model class. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| by_alias | None | Whether to use attribute aliases or not. | None | -| ref_template | None | The reference template. | None | -| schema_generator | None | To override the logic used to generate the JSON schema, as a subclass of -`GenerateJsonSchema` with your desired modifications | None | -| mode | None | The mode in which to generate the schema. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The JSON schema for the given model class. | - - -#### model_parametrized_name - -```python3 -def model_parametrized_name( - params: 'tuple[type[Any], ...]' -) -> 'str' -``` - - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| params | None | Tuple of types of the class. Given a generic class -`Model` with 2 type variables and a concrete model `Model[str, int]`, -the value `(str, int)` would be passed to `params`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | String representing the new class where `params` are passed to `cls` as type variables. | - -**Raises:** - -| Type | Description | -|---|---| -| TypeError | Raised when trying to generate concrete names for non-generic models. | - - -#### model_rebuild - -```python3 -def model_rebuild( - *, - force: 'bool' = False, - raise_errors: 'bool' = True, - _parent_namespace_depth: 'int' = 2, - _types_namespace: 'dict[str, Any] | None' = None -) -> 'bool | None' -``` - - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| force | None | Whether to force the rebuilding of the model schema, defaults to `False`. | None | -| raise_errors | None | Whether to raise errors, defaults to `True`. | None | -| _parent_namespace_depth | None | The depth level of the parent namespace, defaults to 2. | None | -| _types_namespace | None | The types namespace, defaults to `None`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | Returns `None` if the schema is already "complete" and rebuilding was not required. -If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. | - - -#### model_validate - -```python3 -def model_validate( - obj: 'Any', - *, - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate a pydantic model instance. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| obj | None | The object to validate. | None | -| strict | None | Whether to raise an exception on invalid fields. | None | -| from_attributes | None | Whether to extract data from object attributes. | None | -| context | None | Additional context to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated model instance. | - -**Raises:** - -| Type | Description | -|---|---| -| ValidationError | If the object could not be validated. | - - -#### model_validate_json - -```python3 -def model_validate_json( - json_data: 'str | bytes | bytearray', - *, - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate the given JSON data against the Pydantic model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| json_data | None | The JSON data to validate. | None | -| strict | None | Whether to enforce types strictly. | None | -| context | None | Extra variables to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated Pydantic model. | - -**Raises:** - -| Type | Description | -|---|---| -| ValueError | If `json_data` is not a JSON string. | - - -#### parse_file - -```python3 -def parse_file( - path: 'str | Path', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### parse_obj - -```python3 -def parse_obj( - obj: 'Any' -) -> 'Model' -``` - - - - -#### parse_raw - -```python3 -def parse_raw( - b: 'str | bytes', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### schema - -```python3 -def schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}' -) -> 'typing.Dict[str, Any]' -``` - - - - -#### schema_json - -```python3 -def schema_json( - *, - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### update_forward_refs - -```python3 -def update_forward_refs( - **localns: 'Any' -) -> 'None' -``` - - - - -#### validate - -```python3 -def validate( - value: 'Any' -) -> 'Model' -``` - - - -#### Instance variables - -```python3 -model_computed_fields -``` - -Get the computed fields of this model instance. - -```python3 -model_extra -``` - -Get extra fields set during validation. - -```python3 -model_fields_set -``` - -Returns the set of fields that have been set on this model instance. - -#### Methods - - -#### copy - -```python3 -def copy( - self: 'Model', - *, - include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - update: 'typing.Dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Returns a copy of the model. - -!!! warning "Deprecated" - This method is now deprecated; use `model_copy` instead. - -If you need `include` or `exclude`, use: - -```py -data = self.model_dump(include=include, exclude=exclude, round_trip=True) -data = {**data, **(update or {})} -copied = self.model_validate(data) -``` - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| include | None | Optional set or mapping -specifying which fields to include in the copied model. | None | -| exclude | None | Optional set or mapping -specifying which fields to exclude in the copied model. | None | -| update | None | Optional dictionary of field-value pairs to override field values -in the copied model. | None | -| deep | None | If True, the values of fields that are Pydantic models will be deep copied. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A copy of the model with included, excluded and updated fields as specified. | - - -#### dict - -```python3 -def dict( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False -) -> 'typing.Dict[str, Any]' -``` - - - - -#### json - -```python3 -def json( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - encoder: 'typing.Callable[[Any], Any] | None' = PydanticUndefined, - models_as_dict: 'bool' = PydanticUndefined, - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### model_copy - -```python3 -def model_copy( - self: 'Model', - *, - update: 'dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#model_copy - -Returns a copy of the model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| update | None | Values to change/add in the new model. Note: the data is not validated -before creating the new model. You should trust this data. | None | -| deep | None | Set to `True` to make a deep copy of the model. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | New model instance. | - - -#### model_dump - -```python3 -def model_dump( - self, - *, - mode: "Literal['json', 'python'] | str" = 'python', - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'dict[str, Any]' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump - -Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mode | None | The mode in which `to_python` should run. -If mode is 'json', the dictionary will only contain JSON serializable types. -If mode is 'python', the dictionary may contain any Python objects. | None | -| include | None | A list of fields to include in the output. | None | -| exclude | None | A list of fields to exclude from the output. | None | -| by_alias | None | Whether to use the field's alias in the dictionary key if defined. | None | -| exclude_unset | None | Whether to exclude fields that are unset or None from the output. | None | -| exclude_defaults | None | Whether to exclude fields that are set to their default value from the output. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None` from the output. | None | -| round_trip | None | Whether to enable serialization and deserialization round-trip support. | None | -| warnings | None | Whether to log warnings when invalid fields are encountered. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A dictionary representation of the model. | - - -#### model_dump_json - -```python3 -def model_dump_json( - self, - *, - indent: 'int | None' = None, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'str' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump_json - -Generates a JSON representation of the model using Pydantic's `to_json` method. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| indent | None | Indentation to use in the JSON output. If None is passed, the output will be compact. | None | -| include | None | Field(s) to include in the JSON output. Can take either a string or set of strings. | None | -| exclude | None | Field(s) to exclude from the JSON output. Can take either a string or set of strings. | None | -| by_alias | None | Whether to serialize using field aliases. | None | -| exclude_unset | None | Whether to exclude fields that have not been explicitly set. | None | -| exclude_defaults | None | Whether to exclude fields that have the default value. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None`. | None | -| round_trip | None | Whether to use serialization/deserialization between JSON and class instance. | None | -| warnings | None | Whether to show any warnings that occurred during serialization. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A JSON string representation of the model. | - - -#### model_post_init - -```python3 -def model_post_init( - self, - _BaseModel__context: 'Any' -) -> 'None' -``` - - -Override this method to perform additional initialization after `__init__` and `model_construct`. - -This is useful if you want to do some validation that requires the entire model to be initialized. - -### Bounds - -```python3 -class Bounds( - __pydantic_self__, - **data: 'Any' -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.models.RioTilerBaseModel -* pydantic.main.BaseModel - -#### Descendants - -* rio_tiler.models.SpatialInfo - -#### Class variables - -```python3 -model_config -``` - -```python3 -model_fields -``` - -#### Static methods - - -#### construct - -```python3 -def construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - - - -#### from_orm - -```python3 -def from_orm( - obj: 'Any' -) -> 'Model' -``` - - - - -#### model_construct - -```python3 -def model_construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. -Behaves as if `Config.extra = 'allow'` was set since it adds all passed values - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| _fields_set | None | The set of field names accepted for the Model instance. | None | -| values | None | Trusted or pre-validated data dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A new instance of the `Model` class with validated data. | - - -#### model_json_schema - -```python3 -def model_json_schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - schema_generator: 'type[GenerateJsonSchema]' = , - mode: 'JsonSchemaMode' = 'validation' -) -> 'dict[str, Any]' -``` - - -Generates a JSON schema for a model class. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| by_alias | None | Whether to use attribute aliases or not. | None | -| ref_template | None | The reference template. | None | -| schema_generator | None | To override the logic used to generate the JSON schema, as a subclass of -`GenerateJsonSchema` with your desired modifications | None | -| mode | None | The mode in which to generate the schema. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The JSON schema for the given model class. | - - -#### model_parametrized_name - -```python3 -def model_parametrized_name( - params: 'tuple[type[Any], ...]' -) -> 'str' -``` - - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| params | None | Tuple of types of the class. Given a generic class -`Model` with 2 type variables and a concrete model `Model[str, int]`, -the value `(str, int)` would be passed to `params`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | String representing the new class where `params` are passed to `cls` as type variables. | - -**Raises:** - -| Type | Description | -|---|---| -| TypeError | Raised when trying to generate concrete names for non-generic models. | - - -#### model_rebuild - -```python3 -def model_rebuild( - *, - force: 'bool' = False, - raise_errors: 'bool' = True, - _parent_namespace_depth: 'int' = 2, - _types_namespace: 'dict[str, Any] | None' = None -) -> 'bool | None' -``` - - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| force | None | Whether to force the rebuilding of the model schema, defaults to `False`. | None | -| raise_errors | None | Whether to raise errors, defaults to `True`. | None | -| _parent_namespace_depth | None | The depth level of the parent namespace, defaults to 2. | None | -| _types_namespace | None | The types namespace, defaults to `None`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | Returns `None` if the schema is already "complete" and rebuilding was not required. -If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. | - - -#### model_validate - -```python3 -def model_validate( - obj: 'Any', - *, - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate a pydantic model instance. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| obj | None | The object to validate. | None | -| strict | None | Whether to raise an exception on invalid fields. | None | -| from_attributes | None | Whether to extract data from object attributes. | None | -| context | None | Additional context to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated model instance. | - -**Raises:** - -| Type | Description | -|---|---| -| ValidationError | If the object could not be validated. | - - -#### model_validate_json - -```python3 -def model_validate_json( - json_data: 'str | bytes | bytearray', - *, - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate the given JSON data against the Pydantic model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| json_data | None | The JSON data to validate. | None | -| strict | None | Whether to enforce types strictly. | None | -| context | None | Extra variables to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated Pydantic model. | - -**Raises:** - -| Type | Description | -|---|---| -| ValueError | If `json_data` is not a JSON string. | - - -#### parse_file - -```python3 -def parse_file( - path: 'str | Path', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### parse_obj - -```python3 -def parse_obj( - obj: 'Any' -) -> 'Model' -``` - - - - -#### parse_raw - -```python3 -def parse_raw( - b: 'str | bytes', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### schema - -```python3 -def schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}' -) -> 'typing.Dict[str, Any]' -``` - - - - -#### schema_json - -```python3 -def schema_json( - *, - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### update_forward_refs - -```python3 -def update_forward_refs( - **localns: 'Any' -) -> 'None' -``` - - - - -#### validate - -```python3 -def validate( - value: 'Any' -) -> 'Model' -``` - - - -#### Instance variables - -```python3 -model_computed_fields -``` - -Get the computed fields of this model instance. - -```python3 -model_extra -``` - -Get extra fields set during validation. - -```python3 -model_fields_set -``` - -Returns the set of fields that have been set on this model instance. - -#### Methods - - -#### copy - -```python3 -def copy( - self: 'Model', - *, - include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - update: 'typing.Dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Returns a copy of the model. - -!!! warning "Deprecated" - This method is now deprecated; use `model_copy` instead. - -If you need `include` or `exclude`, use: - -```py -data = self.model_dump(include=include, exclude=exclude, round_trip=True) -data = {**data, **(update or {})} -copied = self.model_validate(data) -``` - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| include | None | Optional set or mapping -specifying which fields to include in the copied model. | None | -| exclude | None | Optional set or mapping -specifying which fields to exclude in the copied model. | None | -| update | None | Optional dictionary of field-value pairs to override field values -in the copied model. | None | -| deep | None | If True, the values of fields that are Pydantic models will be deep copied. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A copy of the model with included, excluded and updated fields as specified. | - - -#### dict - -```python3 -def dict( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False -) -> 'typing.Dict[str, Any]' -``` - - - - -#### json - -```python3 -def json( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - encoder: 'typing.Callable[[Any], Any] | None' = PydanticUndefined, - models_as_dict: 'bool' = PydanticUndefined, - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### model_copy - -```python3 -def model_copy( - self: 'Model', - *, - update: 'dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#model_copy - -Returns a copy of the model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| update | None | Values to change/add in the new model. Note: the data is not validated -before creating the new model. You should trust this data. | None | -| deep | None | Set to `True` to make a deep copy of the model. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | New model instance. | - - -#### model_dump - -```python3 -def model_dump( - self, - *, - mode: "Literal['json', 'python'] | str" = 'python', - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'dict[str, Any]' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump - -Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mode | None | The mode in which `to_python` should run. -If mode is 'json', the dictionary will only contain JSON serializable types. -If mode is 'python', the dictionary may contain any Python objects. | None | -| include | None | A list of fields to include in the output. | None | -| exclude | None | A list of fields to exclude from the output. | None | -| by_alias | None | Whether to use the field's alias in the dictionary key if defined. | None | -| exclude_unset | None | Whether to exclude fields that are unset or None from the output. | None | -| exclude_defaults | None | Whether to exclude fields that are set to their default value from the output. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None` from the output. | None | -| round_trip | None | Whether to enable serialization and deserialization round-trip support. | None | -| warnings | None | Whether to log warnings when invalid fields are encountered. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A dictionary representation of the model. | - - -#### model_dump_json - -```python3 -def model_dump_json( - self, - *, - indent: 'int | None' = None, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'str' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump_json - -Generates a JSON representation of the model using Pydantic's `to_json` method. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| indent | None | Indentation to use in the JSON output. If None is passed, the output will be compact. | None | -| include | None | Field(s) to include in the JSON output. Can take either a string or set of strings. | None | -| exclude | None | Field(s) to exclude from the JSON output. Can take either a string or set of strings. | None | -| by_alias | None | Whether to serialize using field aliases. | None | -| exclude_unset | None | Whether to exclude fields that have not been explicitly set. | None | -| exclude_defaults | None | Whether to exclude fields that have the default value. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None`. | None | -| round_trip | None | Whether to use serialization/deserialization between JSON and class instance. | None | -| warnings | None | Whether to show any warnings that occurred during serialization. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A JSON string representation of the model. | - - -#### model_post_init - -```python3 -def model_post_init( - self, - _BaseModel__context: 'Any' -) -> 'None' -``` - - -Override this method to perform additional initialization after `__init__` and `model_construct`. - -This is useful if you want to do some validation that requires the entire model to be initialized. - -### ImageData - -```python3 -class ImageData( - array: numpy.ndarray, - cutline_mask: Optional[numpy.ndarray] = None, - *, - assets: Optional[List] = None, - bounds=None, - crs: Optional[rasterio.crs.CRS] = None, - metadata: Optional[Dict] = NOTHING, - band_names: List[str] = NOTHING, - dataset_statistics: Optional[Sequence[Tuple[float, float]]] = None -) -``` - -#### Attributes - -| Name | Type | Description | Default | -|---|---|---|---| -| array | numpy.ma.MaskedArray | image values. | None | -| assets | list | list of assets used to construct the data values. | None | -| bounds | BoundingBox | bounding box of the data. | None | -| crs | rasterio.crs.CRS | Coordinates Reference System of the bounds. | None | -| metadata | dict | Additional metadata. Defaults to `{}`. | `{}` | -| band_names | list | name of each band. Defaults to `["1", "2", "3"]` for 3 bands image. | `["1", "2", "3"]` for 3 bands image | -| dataset_statistics | list | dataset statistics `[(min, max), (min, max)]` -Note: `mask` should be considered as `PER_BAND` so shape should be similar as the data | None | - -#### Static methods - - -#### create_from_list - -```python3 -def create_from_list( - data: Sequence[ForwardRef('ImageData')] -) -> 'ImageData' -``` - - -Create ImageData from a sequence of ImageData objects. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | sequence | sequence of ImageData. | None | - - -#### from_array - -```python3 -def from_array( - arr: numpy.ndarray -) -> 'ImageData' -``` - - -Create ImageData from a numpy array. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| arr | numpy.ndarray | Numpy array or Numpy masked array. | None | - - -#### from_bytes - -```python3 -def from_bytes( - data: bytes -) -> 'ImageData' -``` - - -Create ImageData from bytes. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | bytes | raster dataset as bytes. | None | - -#### Instance variables - -```python3 -count -``` - -Number of band. - -```python3 -data -``` - -Return data part of the masked array. - -```python3 -height -``` - -Height of the data array. - -```python3 -mask -``` - -Return Mask in form of rasterio dataset mask. - -```python3 -transform -``` - -Returns the affine transform. - -```python3 -width -``` - -Width of the data array. - -#### Methods - - -#### apply_color_formula - -```python3 -def apply_color_formula( - self, - color_formula: Optional[str] -) -``` - - -Apply color-operations formula in place. - - -#### apply_colormap - -```python3 -def apply_colormap( - self, - colormap: Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]]] -) -> 'ImageData' -``` - - -Apply colormap to the image data. - - -#### apply_expression - -```python3 -def apply_expression( - self, - expression: str -) -> 'ImageData' -``` - - -Apply expression to the image data. - - -#### as_masked - -```python3 -def as_masked( - self -) -> numpy.ma.core.MaskedArray -``` - - -return a numpy masked array. - - -#### clip - -```python3 -def clip( - self, - bbox: Tuple[float, float, float, float] -) -> 'ImageData' -``` - - -Clip data and mask to a bbox. - - -#### data_as_image - -```python3 -def data_as_image( - self -) -> numpy.ndarray -``` - - -Return the data array reshaped into an image processing/visualization software friendly order. - -(bands, rows, columns) -> (rows, columns, bands). - - -#### get_coverage_array - -```python3 -def get_coverage_array( - self, - shape: Dict, - shape_crs: rasterio.crs.CRS = CRS.from_epsg(4326), - cover_scale: int = 10 -) -> numpy.ndarray[typing.Any, numpy.dtype[numpy.floating]] -``` - - -cover_scale: int, optional - -Scale used when generating coverage estimates of each - raster cell by vector feature. Coverage is generated by - rasterizing the feature at a finer resolution than the raster then using a summation to aggregate - to the raster resolution and dividing by the square of cover_scale - to get coverage value for each cell. Increasing cover_scale - will increase the accuracy of coverage values; three orders - magnitude finer resolution (cover_scale=1000) is usually enough to - get coverage estimates with <1% error in individual edge cells coverage - estimates, though much smaller values (e.g., cover_scale=10) are often - sufficient (<10% error) and require less memory. - -Note: code adapted from https://github.com/perrygeo/python-rasterstats/pull/136 by @sgoodm - - -#### post_process - -```python3 -def post_process( - self, - in_range: Optional[Sequence[Tuple[Union[float, int], Union[float, int]]]] = None, - out_dtype: Union[str, numpy.number] = 'uint8', - color_formula: Optional[str] = None, - **kwargs: Any -) -> 'ImageData' -``` - - -Post-process image data. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| in_range | tuple | input min/max bounds value to rescale from. | None | -| out_dtype | str | output datatype after rescaling. Defaults to `uint8`. | `uint8` | -| color_formula | str | color-ops formula (see: https://github.com/vincentsarago/color-ops). | None | -| kwargs | optional | keyword arguments to forward to `rio_tiler.utils.linear_rescale`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| ImageData | new ImageData object with the updated data. | - - -#### render - -```python3 -def render( - self, - add_mask: bool = True, - img_format: str = 'PNG', - colormap: Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]], NoneType] = None, - **kwargs -) -> bytes -``` - - -Render data to image blob. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| add_mask | bool | add mask to output image. Defaults to `True`. | `True` | -| img_format | str | output image format. Defaults to `PNG`. | `PNG` | -| colormap | dict or sequence | RGBA Color Table dictionary or sequence. | None | -| kwargs | optional | keyword arguments to forward to `rio_tiler.utils.render`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| bytes | image. | - - -#### rescale - -```python3 -def rescale( - self, - in_range: Sequence[Tuple[Union[float, int], Union[float, int]]], - out_range: Sequence[Tuple[Union[float, int], Union[float, int]]] = ((0, 255),), - out_dtype: Union[str, numpy.number] = 'uint8' -) -``` - - -Rescale data in place. - - -#### resize - -```python3 -def resize( - self, - height: int, - width: int, - resampling_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'gauss', 'rms'] = 'nearest' -) -> 'ImageData' -``` - - -Resize data and mask. - - -#### statistics - -```python3 -def statistics( - self, - categorical: bool = False, - categories: Optional[List[float]] = None, - percentiles: Optional[List[int]] = None, - hist_options: Optional[Dict] = None, - coverage: Optional[numpy.ndarray] = None -) -> Dict[str, rio_tiler.models.BandStatistics] -``` - - -Return statistics from ImageData. - -### Info - -```python3 -class Info( - __pydantic_self__, - **data: 'Any' -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.models.SpatialInfo -* rio_tiler.models.Bounds -* rio_tiler.models.RioTilerBaseModel -* pydantic.main.BaseModel - -#### Class variables - -```python3 -model_config -``` - -```python3 -model_fields -``` - -#### Static methods - - -#### construct - -```python3 -def construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - - - -#### from_orm - -```python3 -def from_orm( - obj: 'Any' -) -> 'Model' -``` - - - - -#### model_construct - -```python3 -def model_construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. -Behaves as if `Config.extra = 'allow'` was set since it adds all passed values - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| _fields_set | None | The set of field names accepted for the Model instance. | None | -| values | None | Trusted or pre-validated data dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A new instance of the `Model` class with validated data. | - - -#### model_json_schema - -```python3 -def model_json_schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - schema_generator: 'type[GenerateJsonSchema]' = , - mode: 'JsonSchemaMode' = 'validation' -) -> 'dict[str, Any]' -``` - - -Generates a JSON schema for a model class. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| by_alias | None | Whether to use attribute aliases or not. | None | -| ref_template | None | The reference template. | None | -| schema_generator | None | To override the logic used to generate the JSON schema, as a subclass of -`GenerateJsonSchema` with your desired modifications | None | -| mode | None | The mode in which to generate the schema. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The JSON schema for the given model class. | - - -#### model_parametrized_name - -```python3 -def model_parametrized_name( - params: 'tuple[type[Any], ...]' -) -> 'str' -``` - - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| params | None | Tuple of types of the class. Given a generic class -`Model` with 2 type variables and a concrete model `Model[str, int]`, -the value `(str, int)` would be passed to `params`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | String representing the new class where `params` are passed to `cls` as type variables. | - -**Raises:** - -| Type | Description | -|---|---| -| TypeError | Raised when trying to generate concrete names for non-generic models. | - - -#### model_rebuild - -```python3 -def model_rebuild( - *, - force: 'bool' = False, - raise_errors: 'bool' = True, - _parent_namespace_depth: 'int' = 2, - _types_namespace: 'dict[str, Any] | None' = None -) -> 'bool | None' -``` - - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| force | None | Whether to force the rebuilding of the model schema, defaults to `False`. | None | -| raise_errors | None | Whether to raise errors, defaults to `True`. | None | -| _parent_namespace_depth | None | The depth level of the parent namespace, defaults to 2. | None | -| _types_namespace | None | The types namespace, defaults to `None`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | Returns `None` if the schema is already "complete" and rebuilding was not required. -If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. | - - -#### model_validate - -```python3 -def model_validate( - obj: 'Any', - *, - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate a pydantic model instance. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| obj | None | The object to validate. | None | -| strict | None | Whether to raise an exception on invalid fields. | None | -| from_attributes | None | Whether to extract data from object attributes. | None | -| context | None | Additional context to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated model instance. | - -**Raises:** - -| Type | Description | -|---|---| -| ValidationError | If the object could not be validated. | - - -#### model_validate_json - -```python3 -def model_validate_json( - json_data: 'str | bytes | bytearray', - *, - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate the given JSON data against the Pydantic model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| json_data | None | The JSON data to validate. | None | -| strict | None | Whether to enforce types strictly. | None | -| context | None | Extra variables to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated Pydantic model. | - -**Raises:** - -| Type | Description | -|---|---| -| ValueError | If `json_data` is not a JSON string. | - - -#### parse_file - -```python3 -def parse_file( - path: 'str | Path', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### parse_obj - -```python3 -def parse_obj( - obj: 'Any' -) -> 'Model' -``` - - - - -#### parse_raw - -```python3 -def parse_raw( - b: 'str | bytes', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### schema - -```python3 -def schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}' -) -> 'typing.Dict[str, Any]' -``` - - - - -#### schema_json - -```python3 -def schema_json( - *, - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### update_forward_refs - -```python3 -def update_forward_refs( - **localns: 'Any' -) -> 'None' -``` - - - - -#### validate - -```python3 -def validate( - value: 'Any' -) -> 'Model' -``` - - - -#### Instance variables - -```python3 -model_computed_fields -``` - -Get the computed fields of this model instance. - -```python3 -model_extra -``` - -Get extra fields set during validation. - -```python3 -model_fields_set -``` - -Returns the set of fields that have been set on this model instance. - -#### Methods - - -#### copy - -```python3 -def copy( - self: 'Model', - *, - include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - update: 'typing.Dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Returns a copy of the model. - -!!! warning "Deprecated" - This method is now deprecated; use `model_copy` instead. - -If you need `include` or `exclude`, use: - -```py -data = self.model_dump(include=include, exclude=exclude, round_trip=True) -data = {**data, **(update or {})} -copied = self.model_validate(data) -``` - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| include | None | Optional set or mapping -specifying which fields to include in the copied model. | None | -| exclude | None | Optional set or mapping -specifying which fields to exclude in the copied model. | None | -| update | None | Optional dictionary of field-value pairs to override field values -in the copied model. | None | -| deep | None | If True, the values of fields that are Pydantic models will be deep copied. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A copy of the model with included, excluded and updated fields as specified. | - - -#### dict - -```python3 -def dict( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False -) -> 'typing.Dict[str, Any]' -``` - - - - -#### json - -```python3 -def json( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - encoder: 'typing.Callable[[Any], Any] | None' = PydanticUndefined, - models_as_dict: 'bool' = PydanticUndefined, - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### model_copy - -```python3 -def model_copy( - self: 'Model', - *, - update: 'dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#model_copy - -Returns a copy of the model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| update | None | Values to change/add in the new model. Note: the data is not validated -before creating the new model. You should trust this data. | None | -| deep | None | Set to `True` to make a deep copy of the model. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | New model instance. | - - -#### model_dump - -```python3 -def model_dump( - self, - *, - mode: "Literal['json', 'python'] | str" = 'python', - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'dict[str, Any]' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump - -Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mode | None | The mode in which `to_python` should run. -If mode is 'json', the dictionary will only contain JSON serializable types. -If mode is 'python', the dictionary may contain any Python objects. | None | -| include | None | A list of fields to include in the output. | None | -| exclude | None | A list of fields to exclude from the output. | None | -| by_alias | None | Whether to use the field's alias in the dictionary key if defined. | None | -| exclude_unset | None | Whether to exclude fields that are unset or None from the output. | None | -| exclude_defaults | None | Whether to exclude fields that are set to their default value from the output. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None` from the output. | None | -| round_trip | None | Whether to enable serialization and deserialization round-trip support. | None | -| warnings | None | Whether to log warnings when invalid fields are encountered. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A dictionary representation of the model. | - - -#### model_dump_json - -```python3 -def model_dump_json( - self, - *, - indent: 'int | None' = None, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'str' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump_json - -Generates a JSON representation of the model using Pydantic's `to_json` method. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| indent | None | Indentation to use in the JSON output. If None is passed, the output will be compact. | None | -| include | None | Field(s) to include in the JSON output. Can take either a string or set of strings. | None | -| exclude | None | Field(s) to exclude from the JSON output. Can take either a string or set of strings. | None | -| by_alias | None | Whether to serialize using field aliases. | None | -| exclude_unset | None | Whether to exclude fields that have not been explicitly set. | None | -| exclude_defaults | None | Whether to exclude fields that have the default value. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None`. | None | -| round_trip | None | Whether to use serialization/deserialization between JSON and class instance. | None | -| warnings | None | Whether to show any warnings that occurred during serialization. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A JSON string representation of the model. | - - -#### model_post_init - -```python3 -def model_post_init( - self, - _BaseModel__context: 'Any' -) -> 'None' -``` - - -Override this method to perform additional initialization after `__init__` and `model_construct`. - -This is useful if you want to do some validation that requires the entire model to be initialized. - -### PointData - -```python3 -class PointData( - array: numpy.ndarray, - *, - band_names: List[str] = NOTHING, - coordinates: Optional[Tuple[float, float]] = None, - crs: Optional[rasterio.crs.CRS] = None, - assets: Optional[List] = None, - metadata: Optional[Dict] = NOTHING -) -``` - -#### Attributes - -| Name | Type | Description | Default | -|---|---|---|---| -| array | numpy.ma.MaskedArray | pixel values. | None | -| band_names | list | name of each band. Defaults to `["1", "2", "3"]` for 3 bands image. | `["1", "2", "3"]` for 3 bands image | -| coordinates | tuple | Point's coordinates. | None | -| crs | rasterio.crs.CRS | Coordinates Reference System of the bounds. | None | -| assets | list | list of assets used to construct the data values. | None | -| metadata | dict | Additional metadata. Defaults to `{}`. | `{}` | - -#### Static methods - - -#### create_from_list - -```python3 -def create_from_list( - data: Sequence[ForwardRef('PointData')] -) -``` - - -Create PointData from a sequence of PointsData objects. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | sequence | sequence of PointData. | None | - -#### Instance variables - -```python3 -count -``` - -Number of band. - -```python3 -data -``` - -Return data part of the masked array. - -```python3 -mask -``` - -Return Mask in form of rasterio dataset mask. - -#### Methods - - -#### apply_expression - -```python3 -def apply_expression( - self, - expression: str -) -> 'PointData' -``` - - -Apply expression to the image data. - - -#### as_masked - -```python3 -def as_masked( - self -) -> numpy.ma.core.MaskedArray -``` - - -return a numpy masked array. - -### RioTilerBaseModel - -```python3 -class RioTilerBaseModel( - __pydantic_self__, - **data: 'Any' -) -``` - -#### Ancestors (in MRO) - -* pydantic.main.BaseModel - -#### Descendants - -* rio_tiler.models.Bounds -* rio_tiler.models.BandStatistics - -#### Class variables - -```python3 -model_config -``` - -```python3 -model_fields -``` - -#### Static methods - - -#### construct - -```python3 -def construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - - - -#### from_orm - -```python3 -def from_orm( - obj: 'Any' -) -> 'Model' -``` - - - - -#### model_construct - -```python3 -def model_construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. -Behaves as if `Config.extra = 'allow'` was set since it adds all passed values - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| _fields_set | None | The set of field names accepted for the Model instance. | None | -| values | None | Trusted or pre-validated data dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A new instance of the `Model` class with validated data. | - - -#### model_json_schema - -```python3 -def model_json_schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - schema_generator: 'type[GenerateJsonSchema]' = , - mode: 'JsonSchemaMode' = 'validation' -) -> 'dict[str, Any]' -``` - - -Generates a JSON schema for a model class. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| by_alias | None | Whether to use attribute aliases or not. | None | -| ref_template | None | The reference template. | None | -| schema_generator | None | To override the logic used to generate the JSON schema, as a subclass of -`GenerateJsonSchema` with your desired modifications | None | -| mode | None | The mode in which to generate the schema. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The JSON schema for the given model class. | - - -#### model_parametrized_name - -```python3 -def model_parametrized_name( - params: 'tuple[type[Any], ...]' -) -> 'str' -``` - - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| params | None | Tuple of types of the class. Given a generic class -`Model` with 2 type variables and a concrete model `Model[str, int]`, -the value `(str, int)` would be passed to `params`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | String representing the new class where `params` are passed to `cls` as type variables. | - -**Raises:** - -| Type | Description | -|---|---| -| TypeError | Raised when trying to generate concrete names for non-generic models. | - - -#### model_rebuild - -```python3 -def model_rebuild( - *, - force: 'bool' = False, - raise_errors: 'bool' = True, - _parent_namespace_depth: 'int' = 2, - _types_namespace: 'dict[str, Any] | None' = None -) -> 'bool | None' -``` - - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| force | None | Whether to force the rebuilding of the model schema, defaults to `False`. | None | -| raise_errors | None | Whether to raise errors, defaults to `True`. | None | -| _parent_namespace_depth | None | The depth level of the parent namespace, defaults to 2. | None | -| _types_namespace | None | The types namespace, defaults to `None`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | Returns `None` if the schema is already "complete" and rebuilding was not required. -If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. | - - -#### model_validate - -```python3 -def model_validate( - obj: 'Any', - *, - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate a pydantic model instance. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| obj | None | The object to validate. | None | -| strict | None | Whether to raise an exception on invalid fields. | None | -| from_attributes | None | Whether to extract data from object attributes. | None | -| context | None | Additional context to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated model instance. | - -**Raises:** - -| Type | Description | -|---|---| -| ValidationError | If the object could not be validated. | - - -#### model_validate_json - -```python3 -def model_validate_json( - json_data: 'str | bytes | bytearray', - *, - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate the given JSON data against the Pydantic model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| json_data | None | The JSON data to validate. | None | -| strict | None | Whether to enforce types strictly. | None | -| context | None | Extra variables to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated Pydantic model. | - -**Raises:** - -| Type | Description | -|---|---| -| ValueError | If `json_data` is not a JSON string. | - - -#### parse_file - -```python3 -def parse_file( - path: 'str | Path', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### parse_obj - -```python3 -def parse_obj( - obj: 'Any' -) -> 'Model' -``` - - - - -#### parse_raw - -```python3 -def parse_raw( - b: 'str | bytes', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### schema - -```python3 -def schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}' -) -> 'typing.Dict[str, Any]' -``` - - - - -#### schema_json - -```python3 -def schema_json( - *, - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### update_forward_refs - -```python3 -def update_forward_refs( - **localns: 'Any' -) -> 'None' -``` - - - - -#### validate - -```python3 -def validate( - value: 'Any' -) -> 'Model' -``` - - - -#### Instance variables - -```python3 -model_computed_fields -``` - -Get the computed fields of this model instance. - -```python3 -model_extra -``` - -Get extra fields set during validation. - -```python3 -model_fields_set -``` - -Returns the set of fields that have been set on this model instance. - -#### Methods - - -#### copy - -```python3 -def copy( - self: 'Model', - *, - include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - update: 'typing.Dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Returns a copy of the model. - -!!! warning "Deprecated" - This method is now deprecated; use `model_copy` instead. - -If you need `include` or `exclude`, use: - -```py -data = self.model_dump(include=include, exclude=exclude, round_trip=True) -data = {**data, **(update or {})} -copied = self.model_validate(data) -``` - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| include | None | Optional set or mapping -specifying which fields to include in the copied model. | None | -| exclude | None | Optional set or mapping -specifying which fields to exclude in the copied model. | None | -| update | None | Optional dictionary of field-value pairs to override field values -in the copied model. | None | -| deep | None | If True, the values of fields that are Pydantic models will be deep copied. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A copy of the model with included, excluded and updated fields as specified. | - - -#### dict - -```python3 -def dict( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False -) -> 'typing.Dict[str, Any]' -``` - - - - -#### json - -```python3 -def json( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - encoder: 'typing.Callable[[Any], Any] | None' = PydanticUndefined, - models_as_dict: 'bool' = PydanticUndefined, - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### model_copy - -```python3 -def model_copy( - self: 'Model', - *, - update: 'dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#model_copy - -Returns a copy of the model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| update | None | Values to change/add in the new model. Note: the data is not validated -before creating the new model. You should trust this data. | None | -| deep | None | Set to `True` to make a deep copy of the model. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | New model instance. | - - -#### model_dump - -```python3 -def model_dump( - self, - *, - mode: "Literal['json', 'python'] | str" = 'python', - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'dict[str, Any]' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump - -Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mode | None | The mode in which `to_python` should run. -If mode is 'json', the dictionary will only contain JSON serializable types. -If mode is 'python', the dictionary may contain any Python objects. | None | -| include | None | A list of fields to include in the output. | None | -| exclude | None | A list of fields to exclude from the output. | None | -| by_alias | None | Whether to use the field's alias in the dictionary key if defined. | None | -| exclude_unset | None | Whether to exclude fields that are unset or None from the output. | None | -| exclude_defaults | None | Whether to exclude fields that are set to their default value from the output. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None` from the output. | None | -| round_trip | None | Whether to enable serialization and deserialization round-trip support. | None | -| warnings | None | Whether to log warnings when invalid fields are encountered. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A dictionary representation of the model. | - - -#### model_dump_json - -```python3 -def model_dump_json( - self, - *, - indent: 'int | None' = None, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'str' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump_json - -Generates a JSON representation of the model using Pydantic's `to_json` method. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| indent | None | Indentation to use in the JSON output. If None is passed, the output will be compact. | None | -| include | None | Field(s) to include in the JSON output. Can take either a string or set of strings. | None | -| exclude | None | Field(s) to exclude from the JSON output. Can take either a string or set of strings. | None | -| by_alias | None | Whether to serialize using field aliases. | None | -| exclude_unset | None | Whether to exclude fields that have not been explicitly set. | None | -| exclude_defaults | None | Whether to exclude fields that have the default value. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None`. | None | -| round_trip | None | Whether to use serialization/deserialization between JSON and class instance. | None | -| warnings | None | Whether to show any warnings that occurred during serialization. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A JSON string representation of the model. | - - -#### model_post_init - -```python3 -def model_post_init( - self, - _BaseModel__context: 'Any' -) -> 'None' -``` - - -Override this method to perform additional initialization after `__init__` and `model_construct`. - -This is useful if you want to do some validation that requires the entire model to be initialized. - -### SpatialInfo - -```python3 -class SpatialInfo( - __pydantic_self__, - **data: 'Any' -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.models.Bounds -* rio_tiler.models.RioTilerBaseModel -* pydantic.main.BaseModel - -#### Descendants - -* rio_tiler.models.Info - -#### Class variables - -```python3 -model_config -``` - -```python3 -model_fields -``` - -#### Static methods - - -#### construct - -```python3 -def construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - - - -#### from_orm - -```python3 -def from_orm( - obj: 'Any' -) -> 'Model' -``` - - - - -#### model_construct - -```python3 -def model_construct( - _fields_set: 'set[str] | None' = None, - **values: 'Any' -) -> 'Model' -``` - - -Creates a new instance of the `Model` class with validated data. - -Creates a new model setting `__dict__` and `__pydantic_fields_set__` from trusted or pre-validated data. -Default values are respected, but no other validation is performed. -Behaves as if `Config.extra = 'allow'` was set since it adds all passed values - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| _fields_set | None | The set of field names accepted for the Model instance. | None | -| values | None | Trusted or pre-validated data dictionary. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A new instance of the `Model` class with validated data. | - - -#### model_json_schema - -```python3 -def model_json_schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - schema_generator: 'type[GenerateJsonSchema]' = , - mode: 'JsonSchemaMode' = 'validation' -) -> 'dict[str, Any]' -``` - - -Generates a JSON schema for a model class. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| by_alias | None | Whether to use attribute aliases or not. | None | -| ref_template | None | The reference template. | None | -| schema_generator | None | To override the logic used to generate the JSON schema, as a subclass of -`GenerateJsonSchema` with your desired modifications | None | -| mode | None | The mode in which to generate the schema. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The JSON schema for the given model class. | - - -#### model_parametrized_name - -```python3 -def model_parametrized_name( - params: 'tuple[type[Any], ...]' -) -> 'str' -``` - - -Compute the class name for parametrizations of generic classes. - -This method can be overridden to achieve a custom naming scheme for generic BaseModels. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| params | None | Tuple of types of the class. Given a generic class -`Model` with 2 type variables and a concrete model `Model[str, int]`, -the value `(str, int)` would be passed to `params`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | String representing the new class where `params` are passed to `cls` as type variables. | - -**Raises:** - -| Type | Description | -|---|---| -| TypeError | Raised when trying to generate concrete names for non-generic models. | - - -#### model_rebuild - -```python3 -def model_rebuild( - *, - force: 'bool' = False, - raise_errors: 'bool' = True, - _parent_namespace_depth: 'int' = 2, - _types_namespace: 'dict[str, Any] | None' = None -) -> 'bool | None' -``` - - -Try to rebuild the pydantic-core schema for the model. - -This may be necessary when one of the annotations is a ForwardRef which could not be resolved during -the initial attempt to build the schema, and automatic rebuilding fails. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| force | None | Whether to force the rebuilding of the model schema, defaults to `False`. | None | -| raise_errors | None | Whether to raise errors, defaults to `True`. | None | -| _parent_namespace_depth | None | The depth level of the parent namespace, defaults to 2. | None | -| _types_namespace | None | The types namespace, defaults to `None`. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | Returns `None` if the schema is already "complete" and rebuilding was not required. -If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`. | - - -#### model_validate - -```python3 -def model_validate( - obj: 'Any', - *, - strict: 'bool | None' = None, - from_attributes: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate a pydantic model instance. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| obj | None | The object to validate. | None | -| strict | None | Whether to raise an exception on invalid fields. | None | -| from_attributes | None | Whether to extract data from object attributes. | None | -| context | None | Additional context to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated model instance. | - -**Raises:** - -| Type | Description | -|---|---| -| ValidationError | If the object could not be validated. | - - -#### model_validate_json - -```python3 -def model_validate_json( - json_data: 'str | bytes | bytearray', - *, - strict: 'bool | None' = None, - context: 'dict[str, Any] | None' = None -) -> 'Model' -``` - - -Validate the given JSON data against the Pydantic model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| json_data | None | The JSON data to validate. | None | -| strict | None | Whether to enforce types strictly. | None | -| context | None | Extra variables to pass to the validator. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | The validated Pydantic model. | - -**Raises:** - -| Type | Description | -|---|---| -| ValueError | If `json_data` is not a JSON string. | - - -#### parse_file - -```python3 -def parse_file( - path: 'str | Path', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### parse_obj - -```python3 -def parse_obj( - obj: 'Any' -) -> 'Model' -``` - - - - -#### parse_raw - -```python3 -def parse_raw( - b: 'str | bytes', - *, - content_type: 'str | None' = None, - encoding: 'str' = 'utf8', - proto: '_deprecated_parse.Protocol | None' = None, - allow_pickle: 'bool' = False -) -> 'Model' -``` - - - - -#### schema - -```python3 -def schema( - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}' -) -> 'typing.Dict[str, Any]' -``` - - - - -#### schema_json - -```python3 -def schema_json( - *, - by_alias: 'bool' = True, - ref_template: 'str' = '#/$defs/{model}', - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### update_forward_refs - -```python3 -def update_forward_refs( - **localns: 'Any' -) -> 'None' -``` - - - - -#### validate - -```python3 -def validate( - value: 'Any' -) -> 'Model' -``` - - - -#### Instance variables - -```python3 -model_computed_fields -``` - -Get the computed fields of this model instance. - -```python3 -model_extra -``` - -Get extra fields set during validation. - -```python3 -model_fields_set -``` - -Returns the set of fields that have been set on this model instance. - -#### Methods - - -#### copy - -```python3 -def copy( - self: 'Model', - *, - include: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - exclude: 'AbstractSetIntStr | MappingIntStrAny | None' = None, - update: 'typing.Dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Returns a copy of the model. - -!!! warning "Deprecated" - This method is now deprecated; use `model_copy` instead. - -If you need `include` or `exclude`, use: - -```py -data = self.model_dump(include=include, exclude=exclude, round_trip=True) -data = {**data, **(update or {})} -copied = self.model_validate(data) -``` - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| include | None | Optional set or mapping -specifying which fields to include in the copied model. | None | -| exclude | None | Optional set or mapping -specifying which fields to exclude in the copied model. | None | -| update | None | Optional dictionary of field-value pairs to override field values -in the copied model. | None | -| deep | None | If True, the values of fields that are Pydantic models will be deep copied. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A copy of the model with included, excluded and updated fields as specified. | - - -#### dict - -```python3 -def dict( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False -) -> 'typing.Dict[str, Any]' -``` - - - - -#### json - -```python3 -def json( - self, - *, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - encoder: 'typing.Callable[[Any], Any] | None' = PydanticUndefined, - models_as_dict: 'bool' = PydanticUndefined, - **dumps_kwargs: 'Any' -) -> 'str' -``` - - - - -#### model_copy - -```python3 -def model_copy( - self: 'Model', - *, - update: 'dict[str, Any] | None' = None, - deep: 'bool' = False -) -> 'Model' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#model_copy - -Returns a copy of the model. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| update | None | Values to change/add in the new model. Note: the data is not validated -before creating the new model. You should trust this data. | None | -| deep | None | Set to `True` to make a deep copy of the model. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | New model instance. | - - -#### model_dump - -```python3 -def model_dump( - self, - *, - mode: "Literal['json', 'python'] | str" = 'python', - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'dict[str, Any]' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump - -Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mode | None | The mode in which `to_python` should run. -If mode is 'json', the dictionary will only contain JSON serializable types. -If mode is 'python', the dictionary may contain any Python objects. | None | -| include | None | A list of fields to include in the output. | None | -| exclude | None | A list of fields to exclude from the output. | None | -| by_alias | None | Whether to use the field's alias in the dictionary key if defined. | None | -| exclude_unset | None | Whether to exclude fields that are unset or None from the output. | None | -| exclude_defaults | None | Whether to exclude fields that are set to their default value from the output. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None` from the output. | None | -| round_trip | None | Whether to enable serialization and deserialization round-trip support. | None | -| warnings | None | Whether to log warnings when invalid fields are encountered. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A dictionary representation of the model. | - - -#### model_dump_json - -```python3 -def model_dump_json( - self, - *, - indent: 'int | None' = None, - include: 'IncEx' = None, - exclude: 'IncEx' = None, - by_alias: 'bool' = False, - exclude_unset: 'bool' = False, - exclude_defaults: 'bool' = False, - exclude_none: 'bool' = False, - round_trip: 'bool' = False, - warnings: 'bool' = True -) -> 'str' -``` - - -Usage docs: https://docs.pydantic.dev/2.2/usage/serialization/#modelmodel_dump_json - -Generates a JSON representation of the model using Pydantic's `to_json` method. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| indent | None | Indentation to use in the JSON output. If None is passed, the output will be compact. | None | -| include | None | Field(s) to include in the JSON output. Can take either a string or set of strings. | None | -| exclude | None | Field(s) to exclude from the JSON output. Can take either a string or set of strings. | None | -| by_alias | None | Whether to serialize using field aliases. | None | -| exclude_unset | None | Whether to exclude fields that have not been explicitly set. | None | -| exclude_defaults | None | Whether to exclude fields that have the default value. | None | -| exclude_none | None | Whether to exclude fields that have a value of `None`. | None | -| round_trip | None | Whether to use serialization/deserialization between JSON and class instance. | None | -| warnings | None | Whether to show any warnings that occurred during serialization. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | A JSON string representation of the model. | - - -#### model_post_init - -```python3 -def model_post_init( - self, - _BaseModel__context: 'Any' -) -> 'None' -``` - - -Override this method to perform additional initialization after `__init__` and `model_construct`. - -This is useful if you want to do some validation that requires the entire model to be initialized. \ No newline at end of file +::: rio_tiler.models diff --git a/docs/src/api/rio_tiler/mosaic/methods/base.md b/docs/src/api/rio_tiler/mosaic/methods/base.md index f4e8904a..46f5bf23 100644 --- a/docs/src/api/rio_tiler/mosaic/methods/base.md +++ b/docs/src/api/rio_tiler/mosaic/methods/base.md @@ -1,79 +1 @@ -# Module rio_tiler.mosaic.methods.base - -rio-tiler.mosaic.methods abc class. - -None - -## Classes - -### MosaicMethodBase - -```python3 -class MosaicMethodBase( - -) -``` - -#### Ancestors (in MRO) - -* abc.ABC - -#### Descendants - -* rio_tiler.mosaic.methods.defaults.FirstMethod -* rio_tiler.mosaic.methods.defaults.HighestMethod -* rio_tiler.mosaic.methods.defaults.LowestMethod -* rio_tiler.mosaic.methods.defaults.MeanMethod -* rio_tiler.mosaic.methods.defaults.MedianMethod -* rio_tiler.mosaic.methods.defaults.StdevMethod -* rio_tiler.mosaic.methods.defaults.LastBandHighMethod -* rio_tiler.mosaic.methods.defaults.LastBandLowMethod - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: numpy.ma.core.MaskedArray -) -``` - - -Fill mosaic array. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| array | numpy.ma.ndarray | data | None | \ No newline at end of file +::: rio_tiler.mosaic.methods.base diff --git a/docs/src/api/rio_tiler/mosaic/methods/defaults.md b/docs/src/api/rio_tiler/mosaic/methods/defaults.md index e7775cc1..ac07d047 100644 --- a/docs/src/api/rio_tiler/mosaic/methods/defaults.md +++ b/docs/src/api/rio_tiler/mosaic/methods/defaults.md @@ -1,463 +1 @@ -# Module rio_tiler.mosaic.methods.defaults - -rio_tiler.mosaic.methods.defaults: default mosaic filling methods. - -None - -## Classes - -### FirstMethod - -```python3 -class FirstMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add data to the mosaic array. - -### HighestMethod - -```python3 -class HighestMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add data to the mosaic array. - -### LastBandHighMethod - -```python3 -class LastBandHighMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add data to the mosaic array. - -### LastBandLowMethod - -```python3 -class LastBandLowMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add data to the mosaic array. - -### LowestMethod - -```python3 -class LowestMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return data. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add data to the mosaic array. - -### MeanMethod - -```python3 -class MeanMethod( - enforce_data_type: bool = True -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -enforce_data_type -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return Mean of the data stack. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: numpy.ma.core.MaskedArray -) -``` - - -Add array to the stack. - -### MedianMethod - -```python3 -class MedianMethod( - enforce_data_type: bool = True -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -enforce_data_type -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return Median of the data stack. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add array to the stack. - -### StdevMethod - -```python3 -class StdevMethod( - -) -``` - -#### Ancestors (in MRO) - -* rio_tiler.mosaic.methods.base.MosaicMethodBase -* abc.ABC - -#### Class variables - -```python3 -cutline_mask -``` - -```python3 -exit_when_filled -``` - -```python3 -mosaic -``` - -#### Instance variables - -```python3 -data -``` - -Return STDDEV of the data stack. - -```python3 -is_done -``` - -Check if the mosaic filling is done. - -#### Methods - - -#### feed - -```python3 -def feed( - self, - array: Optional[numpy.ma.core.MaskedArray] -) -``` - - -Add array to the stack. \ No newline at end of file +::: rio_tiler.mosaic.methods.defaults diff --git a/docs/src/api/rio_tiler/mosaic/reader.md b/docs/src/api/rio_tiler/mosaic/reader.md index af564537..d31fd409 100644 --- a/docs/src/api/rio_tiler/mosaic/reader.md +++ b/docs/src/api/rio_tiler/mosaic/reader.md @@ -1,89 +1 @@ -# Module rio_tiler.mosaic.reader - -rio_tiler.mosaic: create tile from multiple assets. - -None - -## Variables - -```python3 -MAX_THREADS -``` - -## Functions - - -### mosaic_point_reader - -```python3 -def mosaic_point_reader( - mosaic_assets: Sequence, - reader: Callable[..., rio_tiler.models.PointData], - *args: Any, - pixel_selection: Union[Type[rio_tiler.mosaic.methods.base.MosaicMethodBase], rio_tiler.mosaic.methods.base.MosaicMethodBase] = , - chunk_size: Optional[int] = None, - threads: int = 40, - allowed_exceptions: Tuple = (,), - **kwargs -) -> Tuple[rio_tiler.models.PointData, List] -``` - - -Merge multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mosaic_assets | sequence | List of assets. | None | -| reader | callable | Reader function. The function MUST take `(asset, *args, **kwargs)` as arguments, and MUST return a PointData object. | None | -| args | Any | Argument to forward to the reader function. | None | -| pixel_selection | MosaicMethod | Instance of MosaicMethodBase class. Defaults to `rio_tiler.mosaic.methods.defaults.FirstMethod`. | `rio_tiler.mosaic.methods.defaults.FirstMethod` | -| chunk_size | int | Control the number of asset to process per loop. | None | -| threads | int | Number of threads to use. If <= 1, runs single threaded without an event loop. By default reads from the MAX_THREADS environment variable, and if not found defaults to multiprocessing.cpu_count() * 5. | None | -| allowed_exceptions | tuple | List of exceptions which will be ignored. Note: `PointOutsideBounds` is likely to be raised and should be included in the allowed_exceptions. Defaults to `(TileOutsideBounds, )`. | `(TileOutsideBounds, )` | -| kwargs | optional | Reader callable's keywords options. | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | PointData and assets (list). | - - -### mosaic_reader - -```python3 -def mosaic_reader( - mosaic_assets: Sequence, - reader: Callable[..., rio_tiler.models.ImageData], - *args: Any, - pixel_selection: Union[Type[rio_tiler.mosaic.methods.base.MosaicMethodBase], rio_tiler.mosaic.methods.base.MosaicMethodBase] = , - chunk_size: Optional[int] = None, - threads: int = 40, - allowed_exceptions: Tuple = (,), - **kwargs -) -> Tuple[rio_tiler.models.ImageData, List] -``` - - -Merge multiple assets. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| mosaic_assets | sequence | List of assets. | None | -| reader | callable | Reader function. The function MUST take `(asset, *args, **kwargs)` as arguments, and MUST return an ImageData. | None | -| args | Any | Argument to forward to the reader function. | None | -| pixel_selection | MosaicMethod | Instance of MosaicMethodBase class. Defaults to `rio_tiler.mosaic.methods.defaults.FirstMethod`. | `rio_tiler.mosaic.methods.defaults.FirstMethod` | -| chunk_size | int | Control the number of asset to process per loop. | None | -| threads | int | Number of threads to use. If <= 1, runs single threaded without an event loop. By default reads from the MAX_THREADS environment variable, and if not found defaults to multiprocessing.cpu_count() * 5. | None | -| allowed_exceptions | tuple | List of exceptions which will be ignored. Note: `TileOutsideBounds` is likely to be raised and should be included in the allowed_exceptions. Defaults to `(TileOutsideBounds, )`. | `(TileOutsideBounds, )` | -| kwargs | optional | Reader callable's keywords options. | None | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | ImageData and assets (list). | \ No newline at end of file +::: rio_tiler.mosaic.reader diff --git a/docs/src/api/rio_tiler/profiles.md b/docs/src/api/rio_tiler/profiles.md index 2cbd51b6..acbb449b 100644 --- a/docs/src/api/rio_tiler/profiles.md +++ b/docs/src/api/rio_tiler/profiles.md @@ -1,895 +1 @@ -# Module rio_tiler.profiles - -Image file profiles. - -None - -## Variables - -```python3 -img_profiles -``` - -## Classes - -### ImagesProfiles - -```python3 -class ImagesProfiles( - -) -``` - -#### Ancestors (in MRO) - -* collections.UserDict -* collections.abc.MutableMapping -* collections.abc.Mapping -* collections.abc.Collection -* collections.abc.Sized -* collections.abc.Iterable -* collections.abc.Container - -#### Static methods - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None -) -``` - - - -#### Methods - - -#### clear - -```python3 -def clear( - self -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - self -) -``` - - - - -#### get - -```python3 -def get( - self, - key, - default=None -) -``` - - -Like normal item access but return a copy of the key. - - -#### items - -```python3 -def items( - self -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - self -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - self, - key, - default= -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, d is returned if given, otherwise KeyError is raised. - - -#### popitem - -```python3 -def popitem( - self -) -``` - - -D.popitem() -> (k, v), remove and return some (key, value) pair - -as a 2-tuple; but raise KeyError if D is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None -) -``` - - -D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - - -#### update - -```python3 -def update( - self, - other=(), - /, - **kwds -) -``` - - -D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - -If E present and has a .keys() method, does: for k in E: D[k] = E[k] -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v -In either case, this is followed by: for k, v in F.items(): D[k] = v - - -#### values - -```python3 -def values( - self -) -``` - - -D.values() -> an object providing a view on D's values - -### JPEGProfile - -```python3 -class JPEGProfile( - data={}, - **kwds -) -``` - -#### Ancestors (in MRO) - -* rasterio.profiles.Profile -* collections.UserDict -* collections.abc.MutableMapping -* collections.abc.Mapping -* collections.abc.Collection -* collections.abc.Sized -* collections.abc.Iterable -* collections.abc.Container - -#### Class variables - -```python3 -defaults -``` - -#### Static methods - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None -) -``` - - - -#### Methods - - -#### clear - -```python3 -def clear( - self -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - self -) -``` - - - - -#### get - -```python3 -def get( - self, - key, - default=None -) -``` - - -D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - - -#### items - -```python3 -def items( - self -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - self -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - self, - key, - default= -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, d is returned if given, otherwise KeyError is raised. - - -#### popitem - -```python3 -def popitem( - self -) -``` - - -D.popitem() -> (k, v), remove and return some (key, value) pair - -as a 2-tuple; but raise KeyError if D is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None -) -``` - - -D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - - -#### update - -```python3 -def update( - self, - other=(), - /, - **kwds -) -``` - - -D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - -If E present and has a .keys() method, does: for k in E: D[k] = E[k] -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v -In either case, this is followed by: for k, v in F.items(): D[k] = v - - -#### values - -```python3 -def values( - self -) -``` - - -D.values() -> an object providing a view on D's values - -### PNGProfile - -```python3 -class PNGProfile( - data={}, - **kwds -) -``` - -#### Ancestors (in MRO) - -* rasterio.profiles.Profile -* collections.UserDict -* collections.abc.MutableMapping -* collections.abc.Mapping -* collections.abc.Collection -* collections.abc.Sized -* collections.abc.Iterable -* collections.abc.Container - -#### Class variables - -```python3 -defaults -``` - -#### Static methods - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None -) -``` - - - -#### Methods - - -#### clear - -```python3 -def clear( - self -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - self -) -``` - - - - -#### get - -```python3 -def get( - self, - key, - default=None -) -``` - - -D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - - -#### items - -```python3 -def items( - self -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - self -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - self, - key, - default= -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, d is returned if given, otherwise KeyError is raised. - - -#### popitem - -```python3 -def popitem( - self -) -``` - - -D.popitem() -> (k, v), remove and return some (key, value) pair - -as a 2-tuple; but raise KeyError if D is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None -) -``` - - -D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - - -#### update - -```python3 -def update( - self, - other=(), - /, - **kwds -) -``` - - -D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - -If E present and has a .keys() method, does: for k in E: D[k] = E[k] -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v -In either case, this is followed by: for k, v in F.items(): D[k] = v - - -#### values - -```python3 -def values( - self -) -``` - - -D.values() -> an object providing a view on D's values - -### PNGRAWProfile - -```python3 -class PNGRAWProfile( - data={}, - **kwds -) -``` - -#### Ancestors (in MRO) - -* rasterio.profiles.Profile -* collections.UserDict -* collections.abc.MutableMapping -* collections.abc.Mapping -* collections.abc.Collection -* collections.abc.Sized -* collections.abc.Iterable -* collections.abc.Container - -#### Class variables - -```python3 -defaults -``` - -#### Static methods - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None -) -``` - - - -#### Methods - - -#### clear - -```python3 -def clear( - self -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - self -) -``` - - - - -#### get - -```python3 -def get( - self, - key, - default=None -) -``` - - -D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - - -#### items - -```python3 -def items( - self -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - self -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - self, - key, - default= -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, d is returned if given, otherwise KeyError is raised. - - -#### popitem - -```python3 -def popitem( - self -) -``` - - -D.popitem() -> (k, v), remove and return some (key, value) pair - -as a 2-tuple; but raise KeyError if D is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None -) -``` - - -D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - - -#### update - -```python3 -def update( - self, - other=(), - /, - **kwds -) -``` - - -D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - -If E present and has a .keys() method, does: for k in E: D[k] = E[k] -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v -In either case, this is followed by: for k, v in F.items(): D[k] = v - - -#### values - -```python3 -def values( - self -) -``` - - -D.values() -> an object providing a view on D's values - -### WEBPProfile - -```python3 -class WEBPProfile( - data={}, - **kwds -) -``` - -#### Ancestors (in MRO) - -* rasterio.profiles.Profile -* collections.UserDict -* collections.abc.MutableMapping -* collections.abc.Mapping -* collections.abc.Collection -* collections.abc.Sized -* collections.abc.Iterable -* collections.abc.Container - -#### Class variables - -```python3 -defaults -``` - -#### Static methods - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None -) -``` - - - -#### Methods - - -#### clear - -```python3 -def clear( - self -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - self -) -``` - - - - -#### get - -```python3 -def get( - self, - key, - default=None -) -``` - - -D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - - -#### items - -```python3 -def items( - self -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - self -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - self, - key, - default= -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, d is returned if given, otherwise KeyError is raised. - - -#### popitem - -```python3 -def popitem( - self -) -``` - - -D.popitem() -> (k, v), remove and return some (key, value) pair - -as a 2-tuple; but raise KeyError if D is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None -) -``` - - -D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - - -#### update - -```python3 -def update( - self, - other=(), - /, - **kwds -) -``` - - -D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - -If E present and has a .keys() method, does: for k in E: D[k] = E[k] -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v -In either case, this is followed by: for k, v in F.items(): D[k] = v - - -#### values - -```python3 -def values( - self -) -``` - - -D.values() -> an object providing a view on D's values \ No newline at end of file +::: rio_tiler.profiles diff --git a/docs/src/api/rio_tiler/reader.md b/docs/src/api/rio_tiler/reader.md index 9870398f..ec4dbfdc 100644 --- a/docs/src/api/rio_tiler/reader.md +++ b/docs/src/api/rio_tiler/reader.md @@ -1,333 +1 @@ -# Module rio_tiler.reader - -rio-tiler.reader: low level reader. - -None - -## Variables - -```python3 -WGS84_CRS -``` - -## Functions - - -### part - -```python3 -def part( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - bounds: Tuple[float, float, float, float], - height: Optional[int] = None, - width: Optional[int] = None, - max_size: Optional[int] = None, - dst_crs: Optional[rasterio.crs.CRS] = None, - bounds_crs: Optional[rasterio.crs.CRS] = None, - indexes: Union[Sequence[int], int, NoneType] = None, - minimum_overlap: Optional[float] = None, - padding: Optional[int] = None, - buffer: Optional[float] = None, - force_binary_mask: bool = True, - nodata: Union[float, int, str, NoneType] = None, - vrt_options: Optional[Dict] = None, - resampling_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'gauss', 'rms'] = 'nearest', - reproject_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'sum', 'rms'] = 'nearest', - unscale: bool = False, - post_process: Optional[Callable[[numpy.ma.core.MaskedArray], numpy.ma.core.MaskedArray]] = None -) -> rio_tiler.models.ImageData -``` - - -Read part of a dataset. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| bounds | tuple | Output bounds (left, bottom, right, top). By default the coordinates are considered to be in either the dataset CRS or in the `dst_crs` if set. Use `bounds_crs` to set a specific CRS. | None | -| height | int | Output height of the image. | None | -| width | int | Output width of the image. | None | -| max_size | int | Limit output size image if not width and height. | None | -| dst_crs | rasterio.crs.CRS | Target coordinate reference system. | None | -| bounds_crs | rasterio.crs.CRS | Overwrite bounds Coordinate Reference System. | None | -| indexes | sequence of int or int | Band indexes. | None | -| minimum_overlap | float | Minimum % overlap for which to raise an error with dataset not covering enough of the tile. | None | -| padding | int | Padding to apply to each bbox edge. Helps reduce resampling artefacts along edges. Defaults to `0`. | `0` | -| buffer | float | Buffer to apply to each bbox edge. Defaults to `0.`. | `0.` | -| nodata | int or float | Overwrite dataset internal nodata value. | None | -| vrt_options | dict | Options to be passed to the rasterio.warp.WarpedVRT class. | None | -| resampling_method | RIOResampling | RasterIO resampling algorithm. Defaults to `nearest`. | `nearest` | -| reproject_method | WarpResampling | WarpKernel resampling algorithm. Defaults to `nearest`. | `nearest` | -| unscale | bool | Apply 'scales' and 'offsets' on output data value. Defaults to `False`. | `False` | -| post_process | callable | Function to apply on output data and mask values. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | ImageData | - - -### point - -```python3 -def point( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - coordinates: Tuple[float, float], - indexes: Union[Sequence[int], int, NoneType] = None, - coord_crs: rasterio.crs.CRS = CRS.from_epsg(4326), - force_binary_mask: bool = True, - nodata: Union[float, int, str, NoneType] = None, - vrt_options: Optional[Dict] = None, - resampling_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'gauss', 'rms'] = 'nearest', - reproject_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'sum', 'rms'] = 'nearest', - unscale: bool = False, - post_process: Optional[Callable[[numpy.ma.core.MaskedArray], numpy.ma.core.MaskedArray]] = None -) -> rio_tiler.models.PointData -``` - - -Read a pixel value for a point. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| coordinates | tuple | Coordinates in form of (X, Y). | None | -| indexes | sequence of int or int | Band indexes. | None | -| coord_crs | rasterio.crs.CRS | Coordinate Reference System of the input coords. Defaults to `epsg:4326`. | `epsg:4326` | -| nodata | int or float | Overwrite dataset internal nodata value. | None | -| vrt_options | dict | Options to be passed to the rasterio.warp.WarpedVRT class. | None | -| resampling_method | RIOResampling | RasterIO resampling algorithm. Defaults to `nearest`. | `nearest` | -| reproject_method | WarpResampling | WarpKernel resampling algorithm. Defaults to `nearest`. | `nearest` | -| unscale | bool | Apply 'scales' and 'offsets' on output data value. Defaults to `False`. | `False` | -| post_process | callable | Function to apply on output data and mask values. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | PointData | - - -### read - -```python3 -def read( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - dst_crs: Optional[rasterio.crs.CRS] = None, - height: Optional[int] = None, - width: Optional[int] = None, - max_size: Optional[int] = None, - indexes: Union[Sequence[int], int, NoneType] = None, - window: Optional[rasterio.windows.Window] = None, - force_binary_mask: bool = True, - nodata: Union[float, int, str, NoneType] = None, - vrt_options: Optional[Dict] = None, - resampling_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'gauss', 'rms'] = 'nearest', - reproject_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'sum', 'rms'] = 'nearest', - unscale: bool = False, - post_process: Optional[Callable[[numpy.ma.core.MaskedArray], numpy.ma.core.MaskedArray]] = None -) -> rio_tiler.models.ImageData -``` - - -Low level read function. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| dst_crs | rasterio.crs.CRS | Target coordinate reference system. | None | -| height | int | Output height of the image. | None | -| width | int | Output width of the image. | None | -| max_size | int | Limit output size image if not width and height. | None | -| indexes | sequence of int or int | Band indexes. | None | -| window | rasterio.windows.Window | Window to read. | None | -| nodata | int or float | Overwrite dataset internal nodata value. | None | -| vrt_options | dict | Options to be passed to the rasterio.warp.WarpedVRT class. | None | -| resampling_method | RIOResampling | RasterIO resampling algorithm. Defaults to `nearest`. | `nearest` | -| reproject_method | WarpResampling | WarpKernel resampling algorithm. Defaults to `nearest`. | `nearest` | -| force_binary_mask | bool | Cast returned mask to binary values (0 or 255). Defaults to `True`. | `True` | -| unscale | bool | Apply 'scales' and 'offsets' on output data value. Defaults to `False`. | `False` | -| post_process | callable | Function to apply on output data and mask values. | None | - -**Returns:** - -| Type | Description | -|---|---| -| None | ImageData | - -## Classes - -### Options - -```python3 -class Options( - /, - *args, - **kwargs -) -``` - -#### Ancestors (in MRO) - -* builtins.dict - -#### Methods - - -#### clear - -```python3 -def clear( - ... -) -``` - - -D.clear() -> None. Remove all items from D. - - -#### copy - -```python3 -def copy( - ... -) -``` - - -D.copy() -> a shallow copy of D - - -#### fromkeys - -```python3 -def fromkeys( - iterable, - value=None, - / -) -``` - - -Create a new dictionary with keys from iterable and values set to value. - - -#### get - -```python3 -def get( - self, - key, - default=None, - / -) -``` - - -Return the value for key if key is in the dictionary, else default. - - -#### items - -```python3 -def items( - ... -) -``` - - -D.items() -> a set-like object providing a view on D's items - - -#### keys - -```python3 -def keys( - ... -) -``` - - -D.keys() -> a set-like object providing a view on D's keys - - -#### pop - -```python3 -def pop( - ... -) -``` - - -D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - -If key is not found, default is returned if given, otherwise KeyError is raised - - -#### popitem - -```python3 -def popitem( - self, - / -) -``` - - -Remove and return a (key, value) pair as a 2-tuple. - -Pairs are returned in LIFO (last-in, first-out) order. -Raises KeyError if the dict is empty. - - -#### setdefault - -```python3 -def setdefault( - self, - key, - default=None, - / -) -``` - - -Insert key with a value of default if key is not in the dictionary. - -Return the value for key if key is in the dictionary, else default. - - -#### update - -```python3 -def update( - ... -) -``` - - -D.update([E, ]**F) -> None. Update D from dict/iterable E and F. - -If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] -If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v -In either case, this is followed by: for k in F: D[k] = F[k] - - -#### values - -```python3 -def values( - ... -) -``` - - -D.values() -> an object providing a view on D's values \ No newline at end of file +::: rio_tiler.reader diff --git a/docs/src/api/rio_tiler/tasks.md b/docs/src/api/rio_tiler/tasks.md index 7f2bddf6..e8448a68 100644 --- a/docs/src/api/rio_tiler/tasks.md +++ b/docs/src/api/rio_tiler/tasks.md @@ -1,110 +1 @@ -# Module rio_tiler.tasks - -rio_tiler.tasks: tools for handling rio-tiler's future tasks. - -None - -## Variables - -```python3 -MAX_THREADS -``` - -```python3 -TaskType -``` - -## Functions - - -### create_tasks - -```python3 -def create_tasks( - reader: Callable, - asset_list: Sequence, - threads: int, - *args, - **kwargs -) -> Sequence[Tuple[Union[concurrent.futures._base.Future, Callable], Any]] -``` - - -Create Future Tasks. - - -### filter_tasks - -```python3 -def filter_tasks( - tasks: Sequence[Tuple[Union[concurrent.futures._base.Future, Callable], Any]], - allowed_exceptions: Optional[Tuple] = None -) -> Generator -``` - - -Filter Tasks to remove Exceptions. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| tasks | sequence | Sequence of 'concurrent.futures._base.Future' or 'Callable' | None | -| allowed_exceptions | tuple | List of exceptions which won't be raised. | None | - -**Yields:** - -| Type | Description | -|---|---| -| None | Task results. | - - -### multi_arrays - -```python3 -def multi_arrays( - asset_list: Sequence, - reader: Callable[..., rio_tiler.models.ImageData], - *args: Any, - threads: int = 40, - allowed_exceptions: Optional[Tuple] = None, - **kwargs: Any -) -> rio_tiler.models.ImageData -``` - - -Merge arrays returned from tasks. - - -### multi_points - -```python3 -def multi_points( - asset_list: Sequence, - reader: Callable[..., rio_tiler.models.PointData], - *args: Any, - threads: int = 40, - allowed_exceptions: Optional[Tuple] = None, - **kwargs: Any -) -> rio_tiler.models.PointData -``` - - -Merge points returned from tasks. - - -### multi_values - -```python3 -def multi_values( - asset_list: Sequence, - reader: Callable, - *args: Any, - threads: int = 40, - allowed_exceptions: Optional[Tuple] = None, - **kwargs: Any -) -> Dict -``` - - -Merge values returned from tasks. \ No newline at end of file +::: rio_tiler.tasks diff --git a/docs/src/api/rio_tiler/utils.md b/docs/src/api/rio_tiler/utils.md index ca6dc3e5..a1198928 100644 --- a/docs/src/api/rio_tiler/utils.md +++ b/docs/src/api/rio_tiler/utils.md @@ -1,305 +1 @@ -# Module rio_tiler.utils - -rio_tiler.utils: utility functions. - -None - -## Variables - -```python3 -WEB_MERCATOR_CRS -``` - -## Functions - - -### create_cutline - -```python3 -def create_cutline( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - geometry: Dict, - geometry_crs: rasterio.crs.CRS = None -) -> str -``` - - -Create WKT Polygon Cutline for GDALWarpOptions. - -Ref: https://gdal.org/api/gdalwarp_cpp.html?highlight=vrt#_CPPv415GDALWarpOptions - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| geometry | dict | GeoJSON feature or GeoJSON geometry. By default the coordinates are considered to be in the dataset CRS. Use `geometry_crs` to set a specific CRS. | None | -| geometry_crs | rasterio.crs.CRS | Input geometry Coordinate Reference System | None | - -**Returns:** - -| Type | Description | -|---|---| -| str | WKT geometry in form of `POLYGON ((x y, x y, ...))) | - - -### get_array_statistics - -```python3 -def get_array_statistics( - data: numpy.ma.core.MaskedArray, - categorical: bool = False, - categories: Optional[List[float]] = None, - percentiles: Optional[List[int]] = None, - coverage: Optional[numpy.ndarray[Any, numpy.dtype[numpy.floating]]] = None, - **kwargs: Any -) -> List[Dict[Any, Any]] -``` - - -Calculate per band array statistics. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ma.MaskedArray | input masked array data to get the statistics from. | None | -| categorical | bool | treat input data as categorical data. Defaults to `False`. | `False` | -| categories | list of numbers | list of categories to return value for. | None | -| percentiles | list of numbers | list of percentile values to calculate. Defaults to `[2, 98]`. | `[2, 98]` | -| coverage | numpy.array | Data coverage fraction. | None | -| kwargs | optional | options to forward to `numpy.histogram` function (only applies for non-categorical data). | None | - -**Returns:** - -| Type | Description | -|---|---| -| list | list of array statistics (dict) | - - -### get_overview_level - -```python3 -def get_overview_level( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - bounds: Tuple[float, float, float, float], - height: int, - width: int, - dst_crs: rasterio.crs.CRS = CRS.from_epsg(3857) -) -> int -``` - - -Return the overview level corresponding to the tile resolution. - -Freely adapted from https://github.com/OSGeo/gdal/blob/41993f127e6e1669fbd9e944744b7c9b2bd6c400/gdal/apps/gdalwarp_lib.cpp#L2293-L2362 - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| bounds | tuple | Bounding box coordinates in target crs (**dst_crs**). | None | -| height | int | Desired output height of the array for the input bounds. | None | -| width | int | Desired output width of the array for the input bounds. | None | -| dst_crs | rasterio.crs.CRS | Target Coordinate Reference System. Defaults to `epsg:3857`. | `epsg:3857` | - -**Returns:** - -| Type | Description | -|---|---| -| int | Overview level. | - - -### get_vrt_transform - -```python3 -def get_vrt_transform( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT], - bounds: Tuple[float, float, float, float], - height: Optional[int] = None, - width: Optional[int] = None, - dst_crs: rasterio.crs.CRS = CRS.from_epsg(3857), - window_precision: int = 6 -) -> Tuple[affine.Affine, int, int] -``` - - -Calculate VRT transform. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| src_dst | rasterio.io.DatasetReader or rasterio.io.DatasetWriter or rasterio.vrt.WarpedVRT | Rasterio dataset. | None | -| bounds | tuple | Bounding box coordinates in target crs (**dst_crs**). | None | -| height | int | Desired output height of the array for the input bounds. | None | -| width | int | Desired output width of the array for the input bounds. | None | -| dst_crs | rasterio.crs.CRS | Target Coordinate Reference System. Defaults to `epsg:3857`. | `epsg:3857` | - -**Returns:** - -| Type | Description | -|---|---| -| tuple | VRT transform (affine.Affine), width (int) and height (int) | - - -### has_alpha_band - -```python3 -def has_alpha_band( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT] -) -> bool -``` - - -Check for alpha band or mask in source. - - -### has_mask_band - -```python3 -def has_mask_band( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT] -) -> bool -``` - - -Check for mask band in source. - - -### linear_rescale - -```python3 -def linear_rescale( - image: numpy.ndarray, - in_range: Tuple[Union[float, int], Union[float, int]], - out_range: Tuple[Union[float, int], Union[float, int]] = (0, 255) -) -> numpy.ndarray -``` - - -Apply linear rescaling to a numpy array. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| image | numpy.ndarray | array to rescale. | None | -| in_range | tuple | array min/max value to rescale from. | None | -| out_range | tuple | output min/max bounds to rescale to. Defaults to `(0, 255)`. | `(0, 255)` | - -**Returns:** - -| Type | Description | -|---|---| -| numpy.ndarray | linear rescaled array. | - - -### mapzen_elevation_rgb - -```python3 -def mapzen_elevation_rgb( - data: numpy.ndarray -) -> numpy.ndarray -``` - - -Encode elevation value to RGB values compatible with Mapzen tangram. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ndarray | Image array to encode. -Returns | None | -| numpy.ndarray | None | Elevation encoded in a RGB array. | None | - - -### non_alpha_indexes - -```python3 -def non_alpha_indexes( - src_dst: Union[rasterio.io.DatasetReader, rasterio.io.DatasetWriter, rasterio.vrt.WarpedVRT] -) -> Tuple -``` - - -Return indexes of non-alpha bands. - - -### normalize_bounds - -```python3 -def normalize_bounds( - bounds: Tuple[float, float, float, float] -) -> Tuple[float, float, float, float] -``` - - -Return BBox in correct minx, miny, maxx, maxy order. - - -### pansharpening_brovey - -```python3 -def pansharpening_brovey( - rgb: numpy.ndarray, - pan: numpy.ndarray, - weight: float, - pan_dtype: str -) -> numpy.ndarray -``` - - -Apply Brovey pansharpening method. - -Brovey Method: Each resampled, multispectral pixel is -multiplied by the ratio of the corresponding -panchromatic pixel intensity to the sum of all the -multispectral intensities. - -Original code from https://github.com/mapbox/rio-pansharpen - - -### render - -```python3 -def render( - data: numpy.ndarray, - mask: Optional[numpy.ndarray] = None, - img_format: str = 'PNG', - colormap: Union[Dict[int, Tuple[int, int, int, int]], Sequence[Tuple[Tuple[Union[float, int], Union[float, int]], Tuple[int, int, int, int]]], NoneType] = None, - **creation_options: Any -) -> bytes -``` - - -Translate numpy.ndarray to image bytes. - -**Parameters:** - -| Name | Type | Description | Default | -|---|---|---|---| -| data | numpy.ndarray | Image array to encode. | None | -| mask | numpy.ndarray | Mask array. | None | -| img_format | str | Image format. See: for the list of supported format by GDAL: https://www.gdal.org/formats_list.html. Defaults to `PNG`. | `PNG` | -| colormap | dict or sequence | RGBA Color Table dictionary or sequence. | None | -| creation_options | optional | Image driver creation options to forward to GDAL. -Returns | None | -| bytes | None | image body. | None | - - -### resize_array - -```python3 -def resize_array( - data: numpy.ndarray, - height: int, - width: int, - resampling_method: Literal['nearest', 'bilinear', 'cubic', 'cubic_spline', 'lanczos', 'average', 'mode', 'gauss', 'rms'] = 'nearest' -) -> numpy.ndarray -``` - - -resize array to a given height and width. \ No newline at end of file +::: rio_tiler.utils diff --git a/pyproject.toml b/pyproject.toml index bb1b7e93..c232ba11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,10 +68,11 @@ xarray = [ "rioxarray", ] docs = [ - "nbconvert", - "mkdocs", - "mkdocs-jupyter", - "mkdocs-material", + "mkdocs>=1.4.3", + "mkdocs-jupyter>=0.24.5", + "mkdocs-material[imaging]>=9.5", + "griffe-inherited-docstrings>=1.0.0", + "mkdocstrings[python]>=0.25.1", "pygments", ] diff --git a/rio_tiler/colormap.py b/rio_tiler/colormap.py index 7c680527..0f65aa2a 100644 --- a/rio_tiler/colormap.py +++ b/rio_tiler/colormap.py @@ -129,7 +129,7 @@ def apply_discrete_cmap(data: numpy.ndarray, colormap: GDALColorMapType) -> Data Args: data (numpy.ndarray): 1D image array to translate to RGB. - color_map (dict): Discrete ColorMap dictionary. + colormap (GDALColorMapType): Discrete ColorMap dictionary. Returns: tuple: Data (numpy.ndarray) and Alpha band (numpy.ndarray). @@ -168,7 +168,7 @@ def apply_intervals_cmap( Args: data (numpy.ndarray): 1D image array to translate to RGB. - color_map (Sequence): Sequence of intervals and color in form of [([min, max], [r, g, b, a]), ...]. + colormap (IntervalColorMapType): Sequence of intervals and color in form of [([min, max], [r, g, b, a]), ...]. Returns: tuple: Data (numpy.ndarray) and Alpha band (numpy.ndarray). diff --git a/rio_tiler/io/rasterio.py b/rio_tiler/io/rasterio.py index 6a397ae4..b2b4477e 100644 --- a/rio_tiler/io/rasterio.py +++ b/rio_tiler/io/rasterio.py @@ -822,8 +822,8 @@ def point( # type: ignore """Read a pixel value from an Image. Args: - lon (float): X coordinate. - lat (float): Y coordinate. + x (float): X coordinate. + y (float): Y coordinate. indexes (sequence of int or int, optional): Band indexes. expression (str, optional): rio-tiler expression (e.g. b1/b2+b3). unscale (bool, optional): Apply 'scales' and 'offsets' on output data value. Defaults to `False`. diff --git a/rio_tiler/io/stac.py b/rio_tiler/io/stac.py index e5ac2a98..e2723a37 100644 --- a/rio_tiler/io/stac.py +++ b/rio_tiler/io/stac.py @@ -173,7 +173,7 @@ def _to_pystac_item(item: Union[None, Dict, pystac.Item]) -> Union[None, pystac. """Attr converter to convert to Dict to pystac.Item Args: - stac_item (Union[Dict, pystac.Item]): STAC Item. + item (Union[Dict, pystac.Item]): STAC Item. Returns pystac.Item: pystac STAC item object. diff --git a/rio_tiler/models.py b/rio_tiler/models.py index 7806ddc9..6bf57a2d 100644 --- a/rio_tiler/models.py +++ b/rio_tiler/models.py @@ -796,9 +796,8 @@ def get_coverage_array( """Post-process image data. Args: - in_range (tuple): input min/max bounds value to rescale from. - out_dtype (str, optional): output datatype after rescaling. Defaults to `uint8`. - color_formula (str, optional): color-ops formula (see: https://github.com/vincentsarago/color-ops). + shape (Dict): GeoJSON geometry or Feature. + shape_crs (rasterio.crs.CRS): Coordinates Reference System of shape. cover_scale (int, optional): Scale used when generating coverage estimates of each raster cell by vector feature. Coverage is generated by