Scripting dhusget.sh

Hi everybody,
I am trying to automatize S1 downloads with dhusget.sh using a bash script but fail because the parameters are not interpreted correctly. The script builds the parameters from individual variables. The resulting string send to dhusget.sh as options looks like this (breaks added for readability):

-u username -p password -o product 
-F '( footprint:"Intersects(POLYGON((74.32613533801684 42.09165163084839,75.01325803171174 42.09165163084839,75.01325803171174 42.838794204226474,74.32613533801684 42.838794204226474,74.32613533801684 42.09165163084839)))" ) AND ( beginPosition:[2015-12-01T00:00:00.000Z TO NOW] AND endPosition:[2015-12-01T00:00:00.000Z TO NOW] ) AND (platformname:Sentinel-1 AND producttype:SLC AND sensoroperationalmode:IW AND relativeorbitnumber:107 AND slicenumber:3 )' 
-O /path/to/output_folder

This work fine when appended manually to the ./dhusget.sh call but fails when executed withing the script in the form:
./dhusget.sh $dhusget_config
($dhustget_config contains exactly the aforementioned string)

Key problem obviously is the search string in the -F option, specifically the handling of blank characters, resulting in the output:
'-F option' is set to '(. This OpenSearch query will be in AND with other search options.
and a useless HTTP request to
https://scihub.copernicus.eu/dhus/search?q= '(&rows=100&start=0

I have tried all kinds of escaping, replaced spaces with %20, excluded different parts, etc., but nothing worked out so far.

A similar problem was reported here: OLCI search and download using dhusget
However, the solution to use coda instead of scihub is all but satisfying and won’t work for S1, I assume.

Any suggestions are highly appreciated!

Cheers,
David

2 Likes