#!/bin/bash

cd $(readlink -f $(dirname $0))

source /home/losafe/users/oarcher/conda3/etc/profile.d/conda.sh
conda activate /home/losafe/users/oarcher/conda_sentinelRequest
sentinelRequest --user=oarcher --password=nliqt6u3  --filename='S1?_?W_GRD*.SAFE' --date="2020-01-15 00:00" --date="now" --wkt='POLYGON ((-59.83 11.29, -57.99 7.22, -51.53 7.28, -51.49 11.28, -51.42 14.24, -51.34 15.53, -59.77 15.57, -59.83 11.29))' --cachedir=/home1/scratch/oarcher/scihub_cache/ | grep -v filename > EUREC4A_large.txt

if [ $? -ne 0 ] ; then
    exit 1
fi


rsh datarmor /home1/datahome/oarcher/sarwing_cluster/tools/runForBuildAutoRetry.sh -p QL -r sarwingL2X 6bc9df9 ftp://ftp.ifremer.fr/ifremer/cersat/datarmor/project/sarwing/users/oarcher/listings/EUREC4A_large.txt

