I am using eo-learn python pkg to get the Sentinel-1 data. I noticed that each batch has different acquisitions. To solve this problem, I’d like to use MapFeatureTask. I wrote the following script, but I cannot get any results. I would appreciate it if you could guide me to know where is the problem?
# Retrieve S1 data
s1_vv_des = S1IWWCSInput('IW_VV', resx='10m', resy='10m', orbit='descending')
mean = MapFeatureTask((FeatureType.DATA, 'IW_VH'), # input features
(FeatureType.MASK, 'm1'), # output feature
np.mean, # a function to apply to each feature
axis=0)
export_tiff = ExportToTiff(feature=(FeatureType.DATA, 'IW_VH'),
#folder="img_tiff",
crs=CRS.UTM_35N)
# Define the workflow
workflow = LinearWorkflow(
s1_vh_des,
mean,
export_tiff
)
%%time
# Execute the workflow
#time_interval = ['2017-08-07', '2017-08-10'] # before
time_interval = ['2017-08-13', '2017-08-16'] #after
# define additional parameters of the workflow
execution_args = []
for idx, bbox in enumerate(bbox_list):
execution_args.append({
s1_vh_des:{'bbox': bbox, 'time_interval': time_interval},
maximum:{},
export_tiff: {'filename': '{}/eopatch_{}.tiff'.format(tiff_location, idx)}
})
executor = EOExecutor(workflow, execution_args, save_logs=False, logs_folder=OUTPUT_FOLDER)
executor.run(workers=5, multiprocess=False)
executor.make_report()
Just to make sure I understand correctly: you are querying Sentinel-1 data over an area of interest using EoLearn (area is split into patches). For each patch, you retrieve multiple Sentinel-1 scenes over the time-period you have chosen. Looking at your code, you would like to average the acquisitions so that you end up with a single image for the time-period in each patch.
If my understanding is correct, then your script is heading in the right direction. The only part you should change is the following:
mean = MapFeatureTask((FeatureType.DATA, 'IW_VH'), # input features
(FeatureType.DATA_TIMELESS, 'm1'), # output feature
np.mean, # a function to apply to each feature
axis=0)
Using DATA_TIMELESS enables you to create a single band. Then you can export the band you created by changing the task slightly:
Here you save the band you created: m1 (not the input DATA bands).
Does this help?
Maxim
PS: There are a couple of typos in your example (inconsistent naming of variables): i.e. s1_vv_des & s1_vh_des or maximum & mean. They might just be in your example in the forum post, but I thought I would mention it because these are things that can cause problems in scripts (speaking out of experience here).
PPS: Is there a reason to limit the data search to orbit="descending" only? I found a lot more images with orbit="both".
You understood correctly. I noticed that downloading sentinel-1 data using Bash process API could be problematic since each tile can have different acquisition, and it is not easy to merge the images, so I decided to use eo-learn Python package. However, it was required to find a way to aggregate the acquisition in each patch. Is there a better way to deal with it using Bash process API?
What you suggested can solve my problem. Thanks for it
I copied the code from first draft so it is why you can see some typos. Regarding your question, since we use orbit orientation separately, so I only used the specific one in this example.
As I mentioned, if you think there could be better strategy please let me know!