Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

surface asset_expression in MultiBaseTilerFactory (STAC) #367

Closed
vincentsarago opened this issue Sep 6, 2021 · 0 comments · Fixed by #368
Closed

surface asset_expression in MultiBaseTilerFactory (STAC) #367

vincentsarago opened this issue Sep 6, 2021 · 0 comments · Fixed by #368
Labels
enhancement New feature or request

Comments

@vincentsarago
Copy link
Member

https://github.com/cogeotiff/rio-tiler/blob/master/rio_tiler/io/base.py#L458-L460

For this we'll need to update

# Dependencies for MultiBaseReader (e.g STACReader)
@dataclass
class AssetsBidxParams(DefaultDependency):
"""Asset and Band indexes parameters."""
assets: Optional[str] = Query(
..., title="Asset indexes", description="comma (',') delimited asset names.",
)
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.",
)
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 not self.assets and not self.expression:
raise MissingAssets(
"assets must be defined either via expression or assets options."
)
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)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant