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.
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
Allow GeoDataset to list files in VSI path(s) #1399
base: main
Are you sure you want to change the base?
Allow GeoDataset to list files in VSI path(s) #1399
Changes from 48 commits
72702ef
b68dd5a
e90d01c
dfad079
7291f3e
6b41f18
2b2be02
3f91e97
f0d9475
7ca3cb7
d519061
a841fb7
2ee3c85
5c6e444
2da9c4a
e79061f
00594de
9ef7669
8a61108
e8367ca
014e5f5
0bf5d68
41e3dfb
56b1c76
e96cfa9
d03120d
dfc571e
aaea729
740dcec
ba014af
e00b356
65ef978
5192acd
9f800f1
93de375
37c4980
395b4bf
6f041ee
dc334d5
0b80c12
dbbcec7
0cc7e15
c990591
ccdbe9b
a2dd0d6
ecce011
08fde98
26920ae
3baa587
be142aa
e7659a9
c88111e
cffd707
04740a2
51a3d64
7b33550
b81591d
c786a57
bb3ad78
0824026
6a3d128
8ea368f
0ad5db2
87ea802
94c3835
3ddee3a
46e2375
2d54680
d1d8a4a
d22a594
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably be using the
tmp_path
fixture here instead of creating the archive in a git-tracked location. This will require the default function scope though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a module-scoped fixture instead, but I can opt for class-scoped if it will only be used for TestGeoDataset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To simplify the testing drastically, I think I would rather:
tests/data/<whatever>
and store them in git so we don't have to generate and delete them on the flyThis will remove a lot of the code duplication and make things easier to add new tests for (just a single line in parametrize). What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look! I like the idea.
Might be annoying to keep the archives up-to-date with the source if we ever modify them though. The tests does not seem to be much slower when archiving on the fly, but it would reduce code-complexity for the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be more specific about what we raise here. Is this try-except really the only way to do this? Seems dirty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would checking the error message and raising our own error be better?
Here is the error that might occur:
https://github.com/Toblerity/Fiona/blob/7490643d145ce0be506a210abd2802fd0fff63f4/fiona/ogrext.pyx#L2171
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Fiona accepts this, would this better? (Would still need some workaround until then).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the feedback from fiona is that "torchgeo use a dedicated package like fsspec or the Azure Python module." But then we don't get the silver bullet for all of them, and it seems like additional libraries for each file system will have to be installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're definitely trying to minimize our dependencies when possible (0.6 actually removes more dependencies than it adds) so I would prefer not to do this. Worst case, users can always use these libraries themselves to get a list of files, then pass these to a GeoDataset (like in 0.5).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what do you think, merge this, or go with my first proposal; make it easier to handle "non-local-files" by adding a method that the users can override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return a set instead of a list? The
files
method is the only place they are used and uses a set.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats ok by me. The only reason I did not is because similar methods returns a list (iglob, fnmatch etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could change this method to remove duplicates (set) and sort it, then return a list as well. Or is it better to be explicit about that in the files-property?