2

Is there a way to run gdal commands in a silent and quiet mode, for instance, for command tools such as gdalmdimtranslate? a global configuration perhaps? Other commands tools such as gdalwarp have the -q option, for example.

Any pointers are welcomed,

0

1 Answer 1

4

No. As you've noticed, some GDAL commandline tools support a -q flag, but not all. There's no -q or --quiet type flag in the arguments common to all GDAL raster and vector commandline tools. Nor is there a config option that controls this (see also the old list of config options).

However, there's a standard way to run any commandline program in silent mode and that's to use output redirection to send any output to somewhere other than the terminal. That 'somewhere' can be a file or into the black hole that is /dev/null (Linux/MacOS) or NUL (Windows).

If you just want to silence the standard output but still show errors:

# Linux/MacOS
gdalmdimtranslate in.nc out.nc -array "name=temperature,transpose=[2,1,0]" > /dev/null

REM Windows
gdalmdimtranslate in.nc out.nc -array "name=temperature,transpose=[2,1,0]" > NUL

If you don't want to see anything, even if there's an error:

# Linux/MacOS
gdalmdimtranslate in.nc out.nc -array "name=temperature,transpose=[2,1,0]" > /dev/null 2>&1

REM Windows
gdalmdimtranslate in.nc out.nc -array "name=temperature,transpose=[2,1,0]" > NUL 2>&1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.