Comments (4)
the above suggestion would be the following straightforward mod to check_images_available_selected_ROI
def check_images_available_selected_ROI(selected_ROI:dict)->list:
list_of_inputs=[];
if selected_ROI["features"] != []:
for counter, ROI in enumerate(selected_ROI["features"]):
coastSatBBOX=ROI["geometry"]["coordinates"]
polygon=coastSatBBOX
# it's recommended to convert the polygon to the smallest rectangle (sides parallel to coordinate axes)
polygon = SDS_tools.smallest_rectangle(polygon)
# date range
dates = ['2018-12-01', '2019-01-01']
# satellite missions
sat_list = ['S2','L7','L8']
# name of the site
sitename = 'ID'+str(counter)
# directory where the data will be stored
filepath = os.path.join(os.getcwd(), 'data')
# put all the inputs into a dictionnary
inputs = {'polygon': polygon, 'dates': dates, 'sat_list': sat_list, 'sitename': sitename, 'filepath':filepath}
# before downloading the images, check how many images are available for your inputs
SDS_download.check_images_available(inputs)
list_of_inputs.append(inputs)
return list_of_inputs
Images are downloaded into folders named ID0
, ID1
, etc. Good enough, I think
from coastseg.
This is good, but might I suggest the same datestring for all IDs in the same session? That may be easier to deal with for the end user. i.e.
def check_images_available_selected_ROI(selected_ROI:dict)->list:
list_of_inputs=[];
if selected_ROI["features"] != []:
date_str=generate_datestring()
for counter, ROI in enumerate(selected_ROI["features"]):
coastSatBBOX=ROI["geometry"]["coordinates"]
polygon=coastSatBBOX
# it's recommended to convert the polygon to the smallest rectangle (sides parallel to coordinate axes)
polygon = SDS_tools.smallest_rectangle(polygon)
# date range
dates = ['2018-12-01', '2019-01-01']
# satellite missions
sat_list = ['S2','L7','L8']
# name of the site
sitename = 'ID'+str(counter)+date_str
# directory where the data will be stored
filepath = os.path.join(os.getcwd(), 'data')
# put all the inputs into a dictionnary
inputs = {'polygon': polygon, 'dates': dates, 'sat_list': sat_list, 'sitename': sitename, 'filepath':filepath}
# before downloading the images, check how many images are available for your inputs
SDS_download.check_images_available(inputs)
list_of_inputs.append(inputs)
return list_of_inputs
from coastseg.
However, I get a "denied request" error
I did a little digging the reason why you get this error is because we don't have a google maps API key. I don't think we need one for this project, so your second solution is definitely the way to go.
To make sure the data doesn't get overwritten when the user runs the program again I plan on adding a date time string to the sitename. This will also allow the user to check when they downloaded data last.
from coastseg.
check_images_available_selected_ROI()
Here is the working code that creates a unique sitename for each ROI:
def check_images_available_selected_ROI(selected_ROI:dict)->list:
list_of_inputs=[];
if selected_ROI["features"] != []:
for counter, ROI in enumerate(selected_ROI["features"]):
coastSatBBOX=ROI["geometry"]["coordinates"]
polygon=coastSatBBOX
# it's recommended to convert the polygon to the smallest rectangle (sides parallel to coordinate axes)
polygon = SDS_tools.smallest_rectangle(polygon)
# date range
dates = ['2018-12-01', '2019-01-01']
# satellite missions
sat_list = ['S2','L7','L8']
# name of the site
date_str=generate_datestring()
sitename = 'ID'+str(counter)+date_str
# directory where the data will be stored
filepath = os.path.join(os.getcwd(), 'data')
# put all the inputs into a dictionnary
inputs = {'polygon': polygon, 'dates': dates, 'sat_list': sat_list, 'sitename': sitename, 'filepath':filepath}
# before downloading the images, check how many images are available for your inputs
SDS_download.check_images_available(inputs)
list_of_inputs.append(inputs)
return list_of_inputs
generate_datestring()
-This function returns a string containing the current date, hour and minute (24 hr style)
from datetime import datetime
def generate_datestring():
date=datetime.now()
print(date)
return date.strftime('%Y-%m-%d %H_hr_%M_min')
Resulting Folder Names
- ID02022-01-31 13_hr_19_min
- ID12022-01-31 13_hr_19_min
from coastseg.
Related Issues (20)
- Add the CoastSeg Manuscript to the Repository HOT 1
- Paper: Implement reviewer feedback HOT 1
- Add the ability to filter downloads by months
- ModuleNotFoundError: "No module named pyTMD.constants" HOT 2
- Installing Tensorflow on MacOS downgrade CoastSeg to 1.140 HOT 2
- Version attribute is missing HOT 1
- Multiple and different installation instructions HOT 2
- Maybe indicate how to install transformers dependency? HOT 3
- Examples folder contains data HOT 6
- CRS mismatch error when trying to map shorelines with manually-uploaded transects HOT 5
- Why do you need transects to extract the shorelines? HOT 7
- Modify the extract shorelines to not require transects
- Small edit to git clone command in documentation HOT 2
- "No rois found on the map" when redrawing a second/new ROI polygon HOT 2
- Would it be possible to run the UI in the browser outside Jupyter? HOT 3
- In SDS_zoo_classifier.ipynb the instructions and default settings are inconsistent HOT 5
- SDS Zoo classifier: NameError: name 'TFSegformerForSemanticSegmentation' is not defined HOT 3
- CoastSeg paper comments and edits HOT 2
- CoastSeg manuscript review HOT 1
- Double check coastseg/filters/get_kmeans_cluster HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coastseg.