Skip to content

Commit

Permalink
add rio_tiler.io.MultiBandReader bands dependencies (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago authored Feb 12, 2021
1 parent 0422a2f commit e592e04
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* deleted `titiler.models.mosaics` because the models are not used anymore (https://github.com/developmentseed/titiler/pull/221)
* update rio-tiler and cogeo-mosaic minimal versions (https://github.com/developmentseed/titiler/pull/220, https://github.com/developmentseed/titiler/pull/213)
* move STAC related dependencies to `titiler.dependencies (https://github.com/developmentseed/titiler/pull/225)
* add `rio_tiler.io.MultiBandReader` bands dependencies (https://github.com/developmentseed/titiler/pull/226)

## 0.1.0a14 (2021-01-05)

Expand Down
35 changes: 35 additions & 0 deletions titiler/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,41 @@ def __post_init__(self):
)


# Dependencies for MultiBandReader
@dataclass
class BandsParams(DefaultDependency):
"""Band names parameters."""

bands: str = Query(
..., title="bands names", description="comma (',') delimited bands names.",
)

def __post_init__(self):
"""Post Init."""
self.kwargs["bands"] = self.bands.split(",")


@dataclass
class BandsExprParams(DefaultDependency):
"""Band names and Expression parameters."""

bands: Optional[str] = Query(
None, title="bands names", description="comma (',') delimited bands names.",
)
expression: Optional[str] = Query(
None,
title="Band Math expression",
description="rio-tiler's band math expression.",
)

def __post_init__(self):
"""Post Init."""
if self.bands is not None:
self.kwargs["bands"] = self.bands.split(",")
if self.expression is not None:
self.kwargs["expression"] = self.expression


@dataclass
class MetadataParams(DefaultDependency):
"""Common Metadada parameters."""
Expand Down

0 comments on commit e592e04

Please sign in to comment.