vascobnunes / fetchLandsatSentinelFromGoogleCloud

Find and download Landsat and Sentinel-2 data from the public Google Cloud
https://vascobnunes.github.io/fetchLandsatSentinelFromGoogleCloud/
MIT License
52 stars 22 forks source link

Added functionality to fetch script #15

Closed bendv closed 7 years ago

bendv commented 7 years ago

@vascobnunes check out these changes and see if they work for you. The idea is to return all urls that match the cloud_cover and date criteria. I find the -l (--list) switch particularly useful, because it allows the user to see whats available before initiating a download. For example:

python fetchFromGoogleCloud.py -l -o . -c 0 17RNJ S2 2013-01-01 2018-01-01

will show all available cloud-free S2 scenes over tile 17RNJ without downloading.

Yes, you can use the --best or --latest switch to isolate that to one scene. But if you have multiple scenes with the same cloud cover, I am not sure which one to choose (ie. what do you mean by 'closer to what the user wants'?). Anyway, feel free to make changes before merging this to your master branch.

vascobnunes commented 7 years ago

@bendv If there are more than one images with the same criteria it will download the first that is found.

bendv commented 7 years ago

Ok, that should be easy to implement. Do you mean 'first' as in earliest acquisition date? I have noticed that the (Sentinel-2) results are not always chronologically ordered, so the urls would need to be sorted by date first, then just select the first from that list. Unless '--latest' is used, in which case you just select the last element instead of the first.

vascobnunes commented 7 years ago

Well, actually I think first is not the best option, latest should be better. So:

bendv commented 7 years ago

I agree with that, so I removed the '--best' switch altogether, and just kept the '--latest' switch, which will just return the most recent image satisfying the given criteria. e.g.:

python fetchFromGoogleCloud.py -o . -l --latest 17RNJ S2 2013-01-01 2018-01-01

will return the latest scene regardless of cloud cover and

python fetchFromGoogleCloud.py -o . -c 0 -l --latest 17RNJ S2 2013-01-01 2018-01-01

will return the latest cloud-free scene for S2 tile 17RNJ.

bendv commented 7 years ago

Yes, you're right, thanks for checking! I forgot to test the Landsat version of the script, and was a bit sloppy. It should be fixed now - see latest commit.

vascobnunes commented 7 years ago

@bendv I'm sorry for the intense scrutinizing of your collaboration, but I'm not sure if we're good with removing the --best switch. Imagine if you set the cloud limit to 20 and you get 5 images with different cloud_cover values. with the --latest switch it will download the most recent one, but that can be the one that has the highest cloud_cover value, and that's not what we want. We want the latest and less cloudy image bellow the given threshold. This doesn't need to be an option, but as I understand this behavior is currently not implemented.

bendv commented 7 years ago

Yes, that does make sense. In that case both options should be in there -- I think I had that in an earlier commit

vascobnunes commented 7 years ago

I already implemented that and merged your Pull Request. Thank you and hope for more of your contributions.

2017-01-17 14:16 GMT+00:00 Ben notifications@github.com:

Yes, that does make sense. In that case both options should be in there -- I think I had that in an earlier commit

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/vascobnunes/fetchLandsatSentinelFromGoogleCloud/pull/15#issuecomment-273174943, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzXxZxSBstzgkBFzJT1yGaoknzs0tEks5rTM1JgaJpZM4Lkx1P .

-- Vasco B. Nunes