Skip to main content

Hi,
I used a list of timestamps to initialise an eopatch. But, when i used the SentinelHubInputTask() function to download bands data for those timestamps, i was not able to download it. I was getting 2D arrays where each value was 0 for all the bands. Essentially, no data is getting downloaded.

Thanks

Hi,

Could you please share your code snippet including essential parameters which allow us to reproduce your issue? This will help us pin down the issue faster. Thank you!



Here is the screenshot of the code snippet I used.


Hi,

Without the bounding box I cannot reproduce the error. Could you please provide your area of interest as well? Thank you!



This is the bounding box I’ve used.


Hi,

According to the eo-learn example, you will need to define a EO workflow and then execute it as shown below:

add_data = SentinelHubInputTask(
bands_feature=(FeatureType.DATA, "BANDS"),
bands=bands_name,
resolution=10,
maxcc=0.8,
time_difference=datetime.timedelta(minutes=120),
data_collection=DataCollection.SENTINEL2_L2A,
additional_data=[(FeatureType.MASK, "dataMask", "IS_DATA"), (FeatureType.MASK, "CLM"), (FeatureType.DATA, "CLP")],
max_threads=5,
config=config
)
save = SaveTask(EOPATCH_FOLDER, overwrite_permission=OverwritePermission.OVERWRITE_PATCH)
workflow_nodes = linearly_connect_tasks(
add_data,
save
)
workflow = EOWorkflow(workflow_nodes)
%%time

# Time interval for the SH request
time_interval = ["2021-10-16", "2021-10-31"]

# Define additional parameters of the workflow
input_node = workflow_nodes[0]
save_node = workflow_nodes[-1]
execution_args = []
for idx, bbox in enumerate([bbox]):
execution_args.append(
{
input_node: {"bbox": bbox, "time_interval": time_interval},
save_node: {"eopatch_folder": f"eopatch_{idx}"},
}
)

# Execute the workflow
executor = EOExecutor(workflow, execution_args, save_logs=True)
executor.run(workers=1)

executor.make_report()

failed_ids = executor.get_failed_executions()
if failed_ids:
raise RuntimeError(
f"Execution failed EOPatches with IDs:\n{failed_ids}\n"
f"For more info check report at {executor.get_report_path()}"
)

Note that when using SentinelHubInputTask you have less control on the request. With time_difference set to datetime.timedelta(minutes=120), you will be requesting all available acquisitions during the specified time_interval. To request acquisitions you’re interested in only, I’d suggest using SentinelHubEvalscriptTask and applying preProcessScenes function to filter the data.


What if i remove the time_difference set to datetime.timedelta(minutes=120) parameter while using the SentinelHubInputTask function??


also, what if i have multiple bounding boxes stored in a list. how do i cater to all the bounding boxes using the same workflow?


Hi,

What if i remove the time_difference set to datetime.timedelta(minutes=120) parameter while using the SentinelHubInputTask function??

The time_difference argument is used to filter out consecutive acquisition whose timestamp is too close to the previous one. For example, using your AOI with a time range from 2021-10-01 to 2021-10-31 without setting a time_difference will get the following timestamps:

[datetime.datetime(2021, 10, 1, 5, 40, 48),
datetime.datetime(2021, 10, 1, 5, 40, 51),
datetime.datetime(2021, 10, 6, 5, 40, 53),
datetime.datetime(2021, 10, 6, 5, 40, 57),
datetime.datetime(2021, 10, 11, 5, 40, 49),
datetime.datetime(2021, 10, 11, 5, 40, 53),
datetime.datetime(2021, 10, 16, 5, 40, 54),
datetime.datetime(2021, 10, 16, 5, 40, 57),
datetime.datetime(2021, 10, 21, 5, 40, 50),
datetime.datetime(2021, 10, 21, 5, 40, 53),
datetime.datetime(2021, 10, 26, 5, 40, 54),
datetime.datetime(2021, 10, 26, 5, 40, 57),
datetime.datetime(2021, 10, 31, 5, 40, 50),
datetime.datetime(2021, 10, 31, 5, 40, 53)]

As you can see there are 2 timestamps close to each other on 1st, 6th, 11th, 16th, 21st, 26th, and 31st. They are the same data being projected to different tiles (Fig 1) and you may not need them both. In this case we apply time_difference=datetime.timedelta(minutes=120) to get all available acquisitions we need without requesting duplicated data. Below shows the timestamps when time_difference is applied.

[datetime.datetime(2021, 10, 1, 5, 40, 48),
datetime.datetime(2021, 10, 6, 5, 40, 53),
datetime.datetime(2021, 10, 11, 5, 40, 49),
datetime.datetime(2021, 10, 16, 5, 40, 54),
datetime.datetime(2021, 10, 21, 5, 40, 50),
datetime.datetime(2021, 10, 26, 5, 40, 54),
datetime.datetime(2021, 10, 31, 5, 40, 50)]

 


Fig 1

also, what if i have multiple bounding boxes stored in a list. how do i cater to all the bounding boxes using the same workflow?

Please have a look at the example script I provided above. You can create a list of execution_args with your bounding box list. The EOExecutor will help you run all of them.


Reply