Skip to content

Multiple tiny bugs in COG2GRD.sh #13

@oceanites

Description

@oceanites

I started to use the COG2GRD.sh utility and find it super helpful. However I found some tiny bugs:

  • wrong variable name: GRD_zip instead of the more correct COG_zip here
  • also, my IDE complained that curly quotes () instead of straight ones (") are used here, which might lead to errors
  • if no arguments are provided, instead of the usage note the not very descriptive error message ERROR: does not appear to be a valid GRD COG SAFE file. is shown. Below you find a snippet to fix this:

Fix for the missing usage note when no arguments are provided.

if [ $# -eq 0 ]; then
    usage
    exit 1
fi

What is not supported by the script currently to convert COG archives downloaded from the Copernicus Dataspace. They are provided with the ending _COG.SAFE.zip (for instance: S1A_IW_GRDH_1SDV_20250518T064730_20250518T064754_059245_075A15_9505_COG.SAFE.zip), but the script expects the file to be without the .SAFE component. I fixed it in a local version by creating a second script, would you like to have this?

And a improvement of the script to make it more robust would be to make the script more strict and fail more often by using set -euxo pipefail (see: https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions