Opened 12 years ago
Closed 6 years ago
#1685 closed defect (wontfix)
r.in.ascii -s for SURFER does not work in grass7
Reported by: | helena | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 7.0.7 |
Component: | Raster | Version: | svn-trunk |
Keywords: | raster import, Surfer, r.in.ascii | Cc: | |
CPU: | OSX/Intel | Platform: | All |
Description
r.in.ascii -s for SURFER gives ERROR: Unable to seek in GRASS7
same file can be imported using r.in.gdal
should we keep the -s flag in r.in.ascii and fix the bug or leave r.in.ascii for GRASS ascii rasters only?
Helena
Attachments (1)
Change History (10)
follow-up: 2 comment:1 by , 12 years ago
Keywords: | r.in.ascii added |
---|---|
Platform: | MacOSX → All |
comment:2 by , 12 years ago
Replying to hamish:
the error message in g7 lib/gis/seek.c is now just "Unable to seek"; it's not a fundamental limitation just a regular bug AFAICT.
In GRASS 6.x, r.in.ascii would have the same bug if it would check the return value of fseek() (it might be a good idea to check the return value of fread() as well). The attached fix is simply to not fseek after the last row has been read from the input file, that must fail if direction < 0. For sz == 0, fseek from SEEK_CUR has no effect anyway.
Markus M
comment:4 by , 10 years ago
I suppose this is still valid, patch was not applied:
- grass/trunk/raster/r.in.ascii/main.c?rev=63013
Any SURFER file which could be used for a test?
comment:5 by , 9 years ago
Milestone: | 7.0.0 → 7.0.5 |
---|
comment:6 by , 8 years ago
Ping, data for testing is needed otherwise I suggest to close ticket as 'wontfix'
comment:7 by , 8 years ago
Milestone: | 7.0.5 → 7.0.6 |
---|
comment:8 by , 7 years ago
Milestone: | 7.0.6 → 7.0.7 |
---|
comment:9 by , 6 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
the error message in g7 lib/gis/seek.c is now just "Unable to seek"; it's not a fundamental limitation just a regular bug AFAICT.
I found a binary Surfer6 grid file sitting on an old drive, and could convert it to an ascii grid:
and I can reproduce your error. It happens in r.in.ascii/main.c on this G_fseek(), while processing the last row of the map.
G_ftell(ft) reports the position as 1308 but G_fseek() wants to move sz=-2616 bytes (negative as surfer ascii grids are stored bottom to top), and runs past the end (i.e. start) of the file. note 1308*2 = 2616. I presume the array is off by 1 row and the first line of data is either repeated or empty.
here is row, nrows, sz, and on the newline G_ftell() position for the last few rows:
The import works fine in grass 6.x.
Hamish