[GRASS-dev] ascii export and import, large file problem

Jerry Nelson gnelson at uiuc.edu
Fri Apr 13 12:43:09 EDT 2007

An update on ascii export and import. When we set decimals to 16 in the
export and import commands, the difference worked as expected; that is,
there is no difference between the original and the exported/imported/ new
version. Is this something that needs to be put in the documentation? Jerry

-----Original Message-----
From: Glynn Clements [mailto:glynn at gclements.plus.com] 
Sent: Thursday, April 12, 2007 5:58 PM
To: Jerry Nelson
Cc: 'grass-dev'
Subject: RE: [GRASS-dev] ascii export and import, large file problem

Jerry Nelson wrote:

> > > I'm using grass6.3 updated today so the large file support for the
> > > commands is included. I export a file using r.out.arc and then read it
> > > in using r.in.arc. The attached jpg shows the original raster on the
> > > The screen on the left is the original raster minus the exported and
> > > imported version. The bottom two thirds or so of the left raster is
zero, as
> > > it should be, but the top 1/3 has a bunch of small values (range is -
> > > +2.9).
> > 
> > My first guess is that the export->import process is changing the
> > vertical extent of the map slightly, so the calculation in the upper
> > portion of the map is using cells which are off by one row.
> > 
> > What does r.info say about the bounds of the two maps?
> To provide more info, 
> The 'after' info

> Rows:         21048

> Res: 119.047796

> The 'before' info

> Rows:         21048   

> Res: 119.05225396

119.05225396 - 119.047796 = 0.00445796
0.00445796 * 21048 = 93.8311421

So, the imported map has shrunk by almost a whole cell. That would
certainly explain the results.

Ah, I see where the problem lies:

> The 'before' info

> Res: 119.05225396
> Res: 119.04779557

Your cells aren't square, but the ArcGrid format doesn't appear to
allow for non-square cells (single "cellsize" value rather than
separate x/y values). r.out.arc uses the horizontal resolution for the
cellsize value; if the vertical resolution is different, you lose.

This specific issue can't be fixed. However, if the original data had
square cells, something is going wrong on the initial import.

We might want to add a check for this to r.out.arc. We can't actually
do anything beyond warn you that exporting will lose information,
although that's better than nothing.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list