trouble with s.in.ascii

Hello,

I have trouble trying to import a simple ascii site file (X Y) into Grass5b8.
Using s.in.ascii I always get the error message: "WARNING: error scanning
floating point attribute".

What am I doing wrong ?

Moritz

On Mon, 18 Sep 2000 mlennert@club.worldonline.be wrote:

Hello,

I have trouble trying to import a simple ascii site file (X Y) into Grass5b8.
Using s.in.ascii I always get the error message: "WARNING: error scanning
floating point attribute".

What am I doing wrong ?

I'm new to Grass, and had the same problem the first time I tried using
s.in.ascii (Grass 5beta7 compiled with EGCS 2.91.60 using glibc2). If
your problem has the same cause as mine, then there's a simple fix. The
manual page for s.in.ascii omits a fairly important detail of the ascii
sites file format. I think the format may be more completely documented
elsewhere in the manual pages. What follows I got from the source code.

Each line of the ascii input file should contain either two or three
coordinates (x,y and optionally z) separated by a user-selectable
field-delimiting character. After the coordinates there are optional
attribute fields separated from the coordinates and from each other with
the same user-selectable field delimiter.

The attribute field may be a category number, a decimal value or a string.
Category numbers must be preceded by the "#" character and string values
must be preceded by the "@" character. Floating point values may be
preceded by the "%" character but if there is no "#" or "@" preceding the
attribute then it is assumed to be a floating point value. Also, string
values that contain blanks must be quoted or the part of the string
following the first blank will be parsed as a separate field, which may
cause an error.

I received the error you describe by 1) not using the "@" symbol before a
string attribute (causing it to be parsed as a floating point value) and
2) not quoting the string, causing the second and later words of the
string to be parsed as separate fields.

I think the best way to avoid further problems with this would be to
either include more complete description of the format in the manual page
for s.in.ascii or to provide a reference in the s.in.ascii man page to the
page that does contain the complete description.

As I said, I'm quite new at Grass so please correct me if I'm wrong.

Roger Miller

sites_format5.0.txt:

The GRASS 5.0 internal sites format in "sites_list/" is:

easting|northing|[z|[d4|]...][#category_int][[@attr_text OR %flt]...]

such as:
739865.8|4279785.5|#2965 %396685 %194919 %160392 %10941 %2.473222 @"St.Louis" @MO @city

There can be many dimensions between pipes (|), but no #%@.
There can be only one cat, preceded by #, then there may be
many FP or text attributes.
--------------

I personally think the necessity for quotes is a bug :wink: Also, while
your attributes after the optional #<cat_int> can be in any order, they
are guaranteed to be rearranged with all the numbers first. Notice, you
can have multiple 'z' dimenensions. However, not too much code will use
it, yet!

--
/bin/sh ~/.signature:
Command not found

Hi Roger, hi all,

using your comments and an internal format description I have
updated the man-page of s.in.ascii (for GRASS 5 beta9, on the server
(HTML) by tomorrow).

Thanks for the hint!

Markus

On Mon, Sep 18, 2000 at 12:29:31PM -0400, LWA Albuquerque wrote:

On Mon, 18 Sep 2000 mlennert@club.worldonline.be wrote:

> Hello,
>
> I have trouble trying to import a simple ascii site file (X Y) into Grass5b8.
> Using s.in.ascii I always get the error message: "WARNING: error scanning
> floating point attribute".
>
> What am I doing wrong ?

I'm new to Grass, and had the same problem the first time I tried using
s.in.ascii (Grass 5beta7 compiled with EGCS 2.91.60 using glibc2). If
your problem has the same cause as mine, then there's a simple fix. The
manual page for s.in.ascii omits a fairly important detail of the ascii
sites file format. I think the format may be more completely documented
elsewhere in the manual pages. What follows I got from the source code.

Each line of the ascii input file should contain either two or three
coordinates (x,y and optionally z) separated by a user-selectable
field-delimiting character. After the coordinates there are optional
attribute fields separated from the coordinates and from each other with
the same user-selectable field delimiter.

The attribute field may be a category number, a decimal value or a string.
Category numbers must be preceded by the "#" character and string values
must be preceded by the "@" character. Floating point values may be
preceded by the "%" character but if there is no "#" or "@" preceding the
attribute then it is assumed to be a floating point value. Also, string
values that contain blanks must be quoted or the part of the string
following the first blank will be parsed as a separate field, which may
cause an error.

I received the error you describe by 1) not using the "@" symbol before a
string attribute (causing it to be parsed as a floating point value) and
2) not quoting the string, causing the second and later words of the
string to be parsed as separate fields.

I think the best way to avoid further problems with this would be to
either include more complete description of the format in the manual page
for s.in.ascii or to provide a reference in the s.in.ascii man page to the
page that does contain the complete description.

As I said, I'm quite new at Grass so please correct me if I'm wrong.

Roger Miller

--
Dipl.-Geogr. Markus Neteler * University of Hannover
Institute of Physical Geography and Landscape Ecology
Schneiderberg 50 * D-30167 Hannover * Germany
Tel: ++49-(0)511-762-4494 Fax: -3984