0

I am processing satellite data in R and need to merge sat images of different UTM zones, which is where I ran into unexpected problems. I think I have solved them, but before moving to the production server I'd like to (have to) regain full control over the number of cores that are used. In addition to my own parallelizations, GDAL also runs commands in parallel / multiple times. Is it possible to set the number of workers that are being started?

In detail, I have the call

require(gdalUtils)
mosaic_rasters(gdalfile = list.of.two.files, dst_dataset = ftemp,
               gdalwarp_index = 2, of = "GTiff")

This results in all of my available cores starting an instance of gdal_translate. I want to limit this.

I could not find anything about this topic in the GDAL configuration files, and passing co = "NUM_THREADS=2" has no effect - rightfully so I think.

Vince
  • 20,017
  • 15
  • 45
  • 64
  • 1
    Try using config=“NUM_THREADS=2”. The co-parameter is for format specific configuration and the config-parameter is for gdal configuration. You might also try using GDAL_NUM_THREADS instead of NUM_THREADS – Dataform May 30 '20 at 05:08
  • Thanks for your pointers, I had somehow only looked at https://trac.osgeo.org/gdal/wiki/ConfigOptions which does not list this option. However, calling GDAL directly in the terminal, neither of the following has any effect: "GDAL_NUM_THREADS=2 gdal_translate TCI_T32.jp2 out.tif" or "gdal_translate --config GDAL_NUM_THREADS 2 TCI_T32.jp2 out.tif". I'm guessing this is simply because this setting applies to different routines? – Georg Falter May 30 '20 at 08:20
  • I think you are right. Just found this answer: https://gis.stackexchange.com/questions/241806/does-gdal-translate-support-multi-thread – Dataform May 30 '20 at 10:28
  • Ok thanks, guess I'm out of luck then. I'll keep fiddling around and update if I find something. – Georg Falter May 30 '20 at 19:21

0 Answers0