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

Improve download image function #2057

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion geemap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13092,6 +13092,7 @@ def download_ee_image_tiles_parallel(
unmask_value=None,
column=None,
job_args={"n_jobs": -1},
ee_init=True,
**kwargs,
):
"""Download an Earth Engine Image as small tiles based on ee.FeatureCollection. Images larger than the `Earth Engine size limit are split and downloaded as
Expand Down Expand Up @@ -13127,6 +13128,7 @@ def download_ee_image_tiles_parallel(
you should set the unmask value to a non-zero value so that the zero values are not treated as missing data. Defaults to None.
column (str, optional): The column name in the feature collection to use as the filename. Defaults to None.
job_args (dict, optional): The arguments to pass to joblib.Parallel. Defaults to {"n_jobs": -1}.
ee_init (bool, optional): Whether to initialize Earth Engine. Defaults to True.

"""
import joblib
Expand Down Expand Up @@ -13157,7 +13159,8 @@ def download_ee_image_tiles_parallel(
collection = features.toList(count)

def download_data(index):
ee_initialize(opt_url="https://earthengine-highvolume.googleapis.com")
if ee_init:
ee_initialize(opt_url="https://earthengine-highvolume.googleapis.com")
region = ee.Feature(collection.get(index)).geometry()
filename = os.path.join(
out_dir, "{}{}.tif".format(prefix, names[index].replace("/", "_"))
Expand Down