Add taget factory for splitting raster into tiles #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I took a shot at creating a
tar_terra_tiles()
which is a target factory that creates three targets:y
argument ofterra::makeTiles()
), splits the raster into tiles, saves them to disk, and returns a vector of file paths.makeTiles()
using a target with format = "file" or "file_fast"This downstream target is a pattern that is ready to use in further targets with
pattern = map()
and starts to address #74.This is heavily inspired by
tarchetypes::tar_files()
The main downside to this pattern is that it basically duplicates the tiles on disk—once saved in a directory defined by the
tiles_dir
argument and again in the targets store when those files are read back in. Deleting those files would invalidate the files target, but not the upstream target that creates them, so I'm forced to have the upstream target always re-run withcue = tar_cue("always")
. This is not ideal as making tiles is often a computationally expensive step. I've left#TODO
comments with questions and aspirations about how this might work better and would love feedback.