Dear Okee,
It looks like you’ve ran into an older issue that causes the S1 pre-processing to insert the wrong product footprints into the database. This was fixed in the meanwhile, but you might still have to update those manually.
I have a pair of scripts you can run for that. They’re very slow and ugly, but should hopefully do the job (make sure to replace $SITE_NAME
below with the short site name):
$ sudo yum -y install jq
$ cd /mnt/archive/$SITE_NAME
$ find l2a-s1/ -name '*_AMP.tif' -print0 | while IFS= read -r -d '' line; do IFS='/' read -ra arr <<< $line; ( echo "UPDATE product SET geog = st_geogfromtext(TRIM('"; echo 'POLYGON(('; gdalinfo -json "$line" | jq -r '.wgs84Extent.coordinates[][]' | tr -s "[," " " | tr "]" "," | xargs | rev | cut -c 2- | rev; echo "))')) WHERE name = TRIM('"; echo ${arr[2]} | rev | cut -c 5- | rev; echo "');"; echo "UPDATE product SET footprint = (SELECT '(' || string_agg(REPLACE(replace(ST_AsText(geom) :: text, 'POINT', ''), ' ', ','), ',') || ')' from ST_DumpPoints(ST_Envelope(geog :: geometry)) WHERE path[2] IN (1, 3)) :: POLYGON WHERE name = TRIM('"; echo ${arr[2]} | rev | cut -c 5- | rev; echo "');" ) | cat | tr '\r\n\t' ' ' >> ~/sql_amp.txt; done;
$ find l2a-s1/ -name '*_COHE.tif' -print0 | while IFS= read -r -d '' line; do IFS='/' read -ra arr <<< $line; ( echo "UPDATE product SET geog = st_geogfromtext(TRIM('"; echo 'POLYGON(('; gdalinfo -json "$line" | jq -r '.wgs84Extent.coordinates[][]' | tr -s "[," " " | tr "]" "," | xargs | rev | cut -c 2- | rev; echo "))')) WHERE name = TRIM('"; echo ${arr[2]} | rev | cut -c 5- | rev; echo "');"; echo "UPDATE product SET footprint = (SELECT '(' || string_agg(REPLACE(replace(ST_AsText(geom) :: text, 'POINT', ''), ' ', ','), ',') || ')' from ST_DumpPoints(ST_Envelope(geog :: geometry)) WHERE path[2] IN (1, 3)) :: POLYGON WHERE name = TRIM('"; echo ${arr[2]} | rev | cut -c 5- | rev; echo "');" ) | cat | tr '\r\n\t' ' ' >> ~/sql_cohe.txt; done;
$ psql -U postgres sen4cap -f ~/sql_amp.txt
$ psql -U postgres sen4cap -f ~/sql_cohe.txt