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

Issue81 catch errors #89

Merged

Conversation

h-a-graham
Copy link
Contributor

Fixes issues mentioned in: #81

1 - adds some extra error handling to download.R (408605f)

2 - Catch early when user provides a geometry without an extent: f244c22

Cheers, Hugh

@h-a-graham
Copy link
Contributor Author

Oh I also forgot that I added a capture.output to silence the printing of extents by terra when mosaicing: f244c22#diff-685b6463d352268b0100e26e0ebfbadeebcbb739b54de14e1920ddd9dff909a9R739-R747

I can remove this if you want to keep it out of this PR but I was finding the printing for large mosaics a bit overwhelming.

This was linked to issues Jan 21, 2025
mikemahoney218
mikemahoney218 previously approved these changes Jan 21, 2025
Copy link
Collaborator

@mikemahoney218 mikemahoney218 left a comment

Choose a reason for hiding this comment

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

Looks great! Few small changes which I'm going to commit alongside this PR. Thank you so much for the help here!

R/download.R Outdated Show resolved Hide resolved
R/download.R Outdated Show resolved Hide resolved
"Failed to download {items$features[[which_item]]$id %||% 'UNKNOWN'} from {items$features[[which_item]]$properties$datetime %||% 'UNKNOWN'}" # nolint
# stop if failure occurs when merging.
if (merge) {
rlang::abort(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, this was a warning in the past in the hope that users would be able to resume an interrupted download, or take the successful files and run with those... but I don't know if that's actually that easy all things considered. Happy to leave as an abort and revisit in the future though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So (if I understand this correctly) the error will now only be thrown if the user is attempting to merge multiple files in this download step - for example when composite_fun = "merge" - I believe this was the main problem in #81 where gdalwarp was attempting to warp >180 input source files into a single one. In the common use case where we are using the other composite methods or composite=NULL, only one source file passes through this itertor at a time and so, the warning will be triggered as expected. Does that sound right to you? as you say happy to revisit if it causes futher issues :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The thinking is that you could move forward with your downloaded 180 tiles and figure stuff out from there. Erroring here means (I think!) that no matter what you do next, you need to re-download anything that rsi did successfully grab, even if you decide to VRT your tiles or something like that. I haven't actually traced the logic thoroughly to see if that's actually what happened, though -- obviously enough I sort of lost track of things here as it was!

R/get_stac_data.R Outdated Show resolved Hide resolved
@mikemahoney218 mikemahoney218 merged commit e0f8133 into Permian-Global-Research:main Jan 21, 2025
8 checks passed
@h-a-graham
Copy link
Contributor Author

Looks great! Few small changes which I'm going to commit alongside this PR. Thank you so much for the help here!

No porblem at all - thanks so much for merging! :)

@h-a-graham h-a-graham deleted the issue81-catch-errors branch January 21, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhelpful error message Consider disabling terra progress bars
2 participants