[GRASS-dev] r.in.gdal slow with input of type=UInt16

Frank Warmerdam warmerdam at pobox.com
Fri May 25 10:07:44 EDT 2007

Jachym Cepicky wrote:
> Hi,
> when I try to import map, which was previously exported using r.out.gdal
> type=UInt16, it takes too long:
> GRASS 6.3.cvs (spearfish60):~ > g.region -dp
> projection: 1 (UTM)
> zone:       13
> datum:      nad27
> ellipsoid:  clark66
> north:      4928010
> south:      4913700
> west:       589980
> east:       609000
> nsres:      30
> ewres:      30
> rows:       477
> cols:       634
> cells:      302418
> GRASS 6.3.cvs (spearfish60):~ > r.out.gdal in=soils out=/tmp/soils.tif
> type=UInt16
>  100%
> r.out.gdal hotovo.
> GRASS 6.3.cvs (spearfish60):~ > time r.in.gdal in=/tmp/soils.tif -o
> out=tmp --o
>  100%
> real    0m42.631s
> user    0m41.239s
> sys     0m0.120s
> While "brk(brk(0x8445000)                          = 0x8445000)",
> processor is on 100% and this is the place, where it takes so long.
> Anybody could give me some advice?


What is the size of soils.tif?  brk() is the memory allocated which suggests
to me that the process may be taking an unreasonable amount of memory and that
this is causing problems.

If you hadn't just created it with r.out.gdal, I'd suspect that soils.tif
was a dangerous sort of file, such as a 1bit fax compressed file all in
one strip.  But that clearly can't be the case.

The fact that things stall just after creating the histogram file makes
me wonder if it has something to do with histogram creation.  But I can't
see any obvious reason creating a histogram of a 16bit file should be slow.

You might want to actually run r.in.gdal in gdb, and break and get
tracebacks a few times.  I find this a useful technique to identify
what a program is doing when it appears unexpectedly stalled.

I presume a "gdal_translate soils.tif soils2.tif" is fast?  If so, that
suggests it isn't the actual GDAL operation that is slow.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the grass-dev mailing list