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

Preserve metadata with zip archives #109

Merged
merged 13 commits into from
Oct 31, 2024
Merged

Preserve metadata with zip archives #109

merged 13 commits into from
Oct 31, 2024

Conversation

Aariq
Copy link
Collaborator

@Aariq Aariq commented Oct 28, 2024

This closes #58 and supersedes #63 and #106.

Adds a preserve_metadata argument to tar_terra_rast() that when TRUE switches the write and read functions to write to a tempdir and zip files before moving them to path and to unzip that archive before reading in with terra::rast(). This is a blanket solution (I think) that should work for any raster driver. There are notes as to why vsizip/ wasn't used in notes/

Question for reviewers:
Should terra, zip, and withr still be in Suggests? Now that it's more clear the main utility of geotargets is to work with terra, we might consider moving it (and the dependencies needed for preserve_metadata) into Imports

@Aariq Aariq marked this pull request as ready for review October 28, 2024 23:26
@Aariq Aariq requested a review from njtierney October 28, 2024 23:26
Copy link
Owner

@njtierney njtierney left a comment

Choose a reason for hiding this comment

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

This looks great! As mentioned in the review, I think it might be useful/worthwhile to consider using enum / character option instead of TRUE/FALSE for preserve_metadata, as discussed in https://design.tidyverse.org/boolean-strategies.html.

Re

Question for reviewers:
Should terra, zip, and withr still be in Suggests? Now that it's more clear the main utility of geotargets is to work with terra, we might consider moving it (and the dependencies needed for preserve_metadata) into Imports

I agree with you at terra, zip, and withrshould be in Imports now, especially since it is more or less the main goal ofgeotargetsto work withterra` - which we didn't know for sure would be the case when we started the project.

@Aariq
Copy link
Collaborator Author

Aariq commented Oct 29, 2024

Ok, I've got the geotargets option for preserve metadata worked out, if anyone wants to give feedback on naming things.

@Aariq Aariq requested a review from njtierney October 29, 2024 18:12
Copy link
Owner

@njtierney njtierney left a comment

Choose a reason for hiding this comment

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

Looks awesome!

Just some small changes! Not sure if the switch statement is necessary, but it might be useful, maybe?

@Aariq Aariq requested a review from njtierney October 30, 2024 16:36
Copy link
Owner

@njtierney njtierney left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks so much, @Aariq !

@Aariq Aariq merged commit 83af080 into master Oct 31, 2024
7 checks passed
@Aariq Aariq deleted the zip-metadata branch October 31, 2024 17:19
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.

tar_terra_rast() doesn't save metadata
3 participants