[GRASS-dev] [grass-code I][328] v.in.ascii: skip= does not work

code I item #328, was opened at 2007-03-09 21:47
Status: Open
Priority: 3
Submitted By: Maciej Sieczka (msieczka)
Assigned to: Nobody (None)
Summary: v.in.ascii: skip= does not work
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: vector
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD): 070309

Initial Comment:
Try this example:

echo "a rubbish comment line
L 5 1
591336 4927369 1224
594317 4925341 1292
599356 4925162 1469
602396 4926653 1235
607524 4925431 1216
1 321 " | v.in.ascii -n skip=1 out=line format=standard

In spite of skip=1, the module yields and error:

WARNING: Error reading ascii file: [a rubbish comment line]

Another thing is that although the nature of the error is fatal, the module proceeds anyway and exits with status 0. An ERROR should be issued instead of WARNING, and v.in.ascii should exit immadietly with status 1.

FWIW, the same information is formatted differently in GRASS 6.2.2 CVS:

Error reading ascii file:
[a rubbish comment line]

(no trailing "WARNING:"). Besides this, the module still tries to continue it's work and exits with 0 in spite of failure, as in 6.3 CVS.

Maciek

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=328&group_id=21

grass-codei@wald.intevation.org wrote:

code I item #328, was opened at 2007-03-09 21:47

..

Summary: v.in.ascii: skip= does not work

..

Try this example:

echo "a rubbish comment line
L 5 1
591336 4927369 1224
594317 4925341 1292
599356 4925162 1469
602396 4926653 1235
607524 4925431 1216
1 321 " | v.in.ascii -n skip=1 out=line format=standard

In spite of skip=1, the module yields and error:

WARNING: Error reading ascii file: [a rubbish comment line]

skip= only works in points mode, it's there to skip over column headings
in a .csv file. I'm not sure how it should work in combination with the
-n flag for standard mode.

In standard mode you need to start comment lines with a hash (#).

Another thing is that although the nature of the error is fatal, the
module proceeds anyway and exits with status 0. An ERROR should be
issued instead of WARNING, and v.in.ascii should exit immadietly with
status 1.

a2b.c uses G_warning() and return 0 instead of G_fatal_error().

perhaps that is so it will load as much as it can, stop when it finds an
error, and cleanly build and close the ok data before that in the vector
map? the return 0 should probably be return 1 for starters.

Hamish