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

add MultiAssetsReader base class and refactor STACReader #225

Merged
merged 13 commits into from
Aug 20, 2020

Conversation

vincentsarago
Copy link
Member

closes #224
closes #213

In addition to ☝️, this PR adds a new Abstract base for Multiple Assets merging (mainly for rio-tiler-pds but also used in STACReader). With this, we can specify any kind of Reader within the MultiAssetsReader. Before we were using the rio_tiler.io.cogeo.multi_* methods tied to COGReader.

cc @kylebarron @geospatial-jeff

README.md Outdated Show resolved Hide resolved
rio_tiler/io/base.py Outdated Show resolved Hide resolved
rio_tiler/io/base.py Outdated Show resolved Hide resolved
rio_tiler/io/stac.py Outdated Show resolved Hide resolved
"center": self.center,
"minzoom": self.minzoom,
"maxzoom": self.maxzoom,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we were creating a Class with COGReader as parent so both center and spatial_info existed. I added those back for compatibility

for (t, m), asset in _filter_tasks(tasks):
tasks = create_tasks(reader, chunks, threads, *args, **kwargs)
for (t, m), asset in filter_tasks(
tasks, allowed_exceptions=(TileOutsideBounds,)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref #224, we allow TileOutsideBounds errors to be passed, they will still be logged

for asset in assets
]
else:
return ((reader(asset, *args, **kwargs), asset) for asset in assets)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New submodule because those functions are not just used in mosaic now

rio_tiler/io/stac.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
if not tile_exists(self.bounds, tile_z, tile_x, tile_y):
raise TileOutsideBounds(
"Tile {}/{}/{} is outside image bounds".format(tile_z, tile_x, tile_y)
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove this. Checking if the tile is outside the bounds here lets us raise before doing more file reading BUT it makes the class not really extendable for rio-tiler-crs

README.md Show resolved Hide resolved
rio_tiler/tasks.py Show resolved Hide resolved
rio_tiler/tasks.py Outdated Show resolved Hide resolved
rio_tiler/io/base.py Outdated Show resolved Hide resolved
rio_tiler/io/base.py Outdated Show resolved Hide resolved
rio_tiler/io/base.py Outdated Show resolved Hide resolved
rio_tiler/io/base.py Show resolved Hide resolved
rio_tiler/io/base.py Show resolved Hide resolved
rio_tiler/io/cogeo.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants