Skip to content

move stac related dependencies in titiler.dependencies.py #222

Closed
@vincentsarago

Description

@dataclass
class AssetsBidxParams(DefaultDependency):
"""Asset and Band indexes parameters."""
assets: Optional[str] = Query(
None,
title="Asset indexes",
description="comma (',') delimited asset names (might not be an available options of some readers)",
)
bidx: Optional[str] = Query(
None, title="Band indexes", description="comma (',') delimited band indexes",
)
def __post_init__(self):
"""Post Init."""
if self.assets is not None:
self.kwargs["assets"] = self.assets.split(",")
if self.bidx is not None:
self.kwargs["indexes"] = tuple(
int(s) for s in re.findall(r"\d+", self.bidx)
)
@dataclass
class AssetsBidxExprParams(DefaultDependency):
"""Assets, Band Indexes and Expression parameters."""
assets: Optional[str] = Query(
None,
title="Asset indexes",
description="comma (',') delimited asset names (might not be an available options of some readers)",
)
expression: Optional[str] = Query(
None,
title="Band Math expression",
description="rio-tiler's band math expression (e.g B1/B2)",
)
bidx: Optional[str] = Query(
None, title="Band indexes", description="comma (',') delimited band indexes",
)
def __post_init__(self):
"""Post Init."""
if self.assets is not None:
self.kwargs["assets"] = self.assets.split(",")
if self.expression is not None:
self.kwargs["expression"] = self.expression
if self.bidx is not None:
self.kwargs["indexes"] = tuple(
int(s) for s in re.findall(r"\d+", self.bidx)
)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions