[GRASS-dev] Option 'band' in r.external

Nikos Alexandris nik at nikosalexandris.net
Wed Dec 5 16:40:24 PST 2018


Dear list,

given a VRT built after
```
gdalbuildvrt -separate landsat8.vrt LC08_L1TP_184033_20181028_20181028_01_RT_B1[10].TIF
```

which then is structured like
```
gdalinfo landsat8.vrt |grep -e 'Band\|TIF'
       LC08_L1TP_184033_20181028_20181028_01_RT_B10.TIF
       LC08_L1TP_184033_20181028_20181028_01_RT_B11.TIF
Band 1 Block=128x128 Type=UInt16, ColorInterp=Undefined
Band 2 Block=128x128 Type=UInt16, ColorInterp=Undefined
```

the following works:
```
r.external input=landsat8.vrt -e out=B --o
WARNING: Unknown compression method <ZSTD>, using default ZLIB
WARNING: Imagery group <B> already exists and will be overwritten.
Reading band 1 of 2...
r.external complete. Link to raster map <B.1> created.
Reading band 2 of 2...
r.external complete. Link to raster map <B.2> created.
Default region for this location updated
Region for the current mapset updated
Imagery group <B> created
```

Both bands are imported.  The same does `r.in.gdal` with or without the
'band' option, i.e. it imports both bands 1 and 2:
```
r.in.gdal input=landsat8.vrt -e band=1,2 out=B --o
WARNING: Unknown compression method <ZSTD>, using default ZLIB
Importing 2 raster bands...
WARNING: Raster map <B.1> already exists and will be overwritten
Importing raster map <B.1>...
 100%
WARNING: Raster map <B.2> already exists and will be overwritten
Importing raster map <B.2>...
 100%
Default region for this location updated
Region for the current mapset updated
```

Why does the 'band' option to `r.external` not behave as expected? See:
```
r.external input=landsat8.vrt -e band=1,2 out=B --o
WARNING: Unknown compression method <ZSTD>, using default ZLIB
Reading band 1 of 2...
r.external complete. Link to raster map <B> created.
Default region for this location updated
Region for the current mapset updated
```

It links only to band 1 of 2. Is it a bug?

Nikos


More information about the grass-dev mailing list