Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey White committed Nov 18, 2024
1 parent 54debe5 commit fed8629
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions course/topics/topic_helene/tutorial.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ def download_image(url, save_path, session):
print(f"Failed to download {url}: {e}")
# Main function to set up the thread pool and download images
def run(image_urls, save_dir, num_threads=4):
def run(image_urls, save_dir, num_threads=None):
"""Creates thread pool and download images from a list of urls"""
if not os.path.exists(save_dir):
os.makedirs(save_dir)
if num_threads is None:
num_threads = os.cpu_count() * 2
with ThreadPoolExecutor(max_workers=num_threads) as executor:
with requests.Session() as session:
futures = []
Expand All @@ -90,7 +93,12 @@ Make sure to set appropriate threads for your system.
#| eval: false
url_list = query_feature_service(flight_id='A0046B')
run(urls=url_list, save_dir="imagery_data/nadir/{flight}", num_threads=32)
run(image_urls=url_list, save_dir="imagery_data/nadir/{flight}", num_threads=32)
```

```{python}
max_threads = os.cpu_count()
print(f"Maximum usable threads: {max_threads}")
```

### Run data in your favorite photogrametry software
Expand Down

0 comments on commit fed8629

Please sign in to comment.