Eo-learn executor - appending vector as argument in VectorToRaster task

would appreciate any help on this; I am developing a workflow in eo-learn to iterate over a set of polygons and calculate average NDVI over a time period. I am creating individual eo-patches for each polygon. I need to apply a timeless mask to each eo-patch in order to calculate average NDVI across the time series. I am using eo-executor to iterate over bbox for each polygon and then using vector to raster to create a mask for each eo-patch. The issue I am having is that the VectorToRaster eo-task requires vector_input as argument in the task definition so I can I append this to execution arguments for EOExecutor?

Hi @haselwimmer ,

I might not properly understand your problem, but in principle the code flow would be something along this:
a) define EOTasks
b) combine said tasks to EOWorkflow
c) run the workflow with EOExecutor.

or in python:

vector_to_raster = VectorToRasterTask(vector_input = ...)
workflow = LinearWorkflow( ... , vector_to_raster, ...)
executor = EOExecutor(...)

The execution_arguments (way to pass parameters to specific tasks’ execute methods) is as an example shown in LULC notebook:

execution_args = []
for idx, bbox in enumerate(bbox_list[patchIDs]):
        add_data: {'bbox': bbox, 'time_interval': time_interval},
        save: {'eopatch_folder': f'eopatch_{idx}'}

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

I hope this answers your question.

Just as a side note: perhaps you should have a look at Statistical API and example within sentinelhub-py, where you could request Sentinel-Hub services to provide you the time series of aggregated data.

Hi @batic
thanks for your response and I my apologies that I haven’t easily described my issues.

The core of the issue is whether its possible to assign a vector input to the execution_arguments for a vector_to_raster task?

For example if I have a vector_to_raster task called aoiMask can I iteratively define the vector_input argument? In the example below polys is a geodataframe with polygons.

execution_args = []
for index, bbox in enumerate(bbox_list):
        addData: {'bbox': bbox, 'time_interval': time_interval},
        meta: {'data': polys.iloc[index]['ID']},
        aoiMask: {'vector_input': polys.iloc[[index]]}, 
        save: {'eopatch_folder': f'eopatch_{index}'}

Thanks for suggesting the use of statistical api; I would like the ability to also download the data and create timelapse animations etc…

Any particular reason you don’t import your vector data to eopatches using VectorImportTask? This way, you would only need to specify vector_input in the init of the VectorToRasterTask (using the feature).

Well I have one geodataframe (created from a shapefile) with multiple polygons that I am iterating over and creating an eo-patch for each polygon. Can I import each gdf row polygon using vector_input? If so I will give what you suggest a try.

@batic I figured this out with your guidance, thanks.