[STATSGRASS] v.in.ascii
Hamish
hamish_nospam at yahoo.com
Fri Jan 27 19:18:49 EST 2006
> > I try to import an ascii file which is, I think, very simple:
> > x,y,z
> > 276.0447173760,10.1098557284,1030.7103
...
> > 276.0428361340,10.1088463903,840.5004
> > 276.0426783175,10.1088861157,796.0822
> > etc.........
> >
> > in total arround 869000 lines of x,y,z values.
> > I tried this:
> > v.in.ascii input=theinputfile.txt output=theoutput fs=',' -z z=3
> > but didn't work. I've got the message:
> > Maximum input row length: 39
> > Maximum number of columns: 3
> > Minimum number of columns: 3
> > ERROR: x column is not of number type
> > That's not verbose enought for me to find what's wrong.
> > Does anybody have an idear ?
> > Thanks
>
> I ad such a problem once, there was a space at the end of the line
> somewhere.
> You may filter the data like this:
>
> cat theinputfile.txt | sed 's+ ++g' > theinputfile_clean.txt
fyi & iirc, G_strip() isn't used on the input lines as the first or last
column may be text, in which case the leading/trailing whitespace may be
significant. "%10s"
> then import
> v.in.ascii input=theinputfile_clean.txt output=theoutput fs=',' -z z=3
>
> In fact the message should indicate the offending line, but I
> don't know how to implement that. Maybe the author of v.in.ascii
> knows.
>
> Please let us know if this trick helped.
another thing to watch: make sure there is not a blank line at the end
of the file.
You could turn on debugging:
g.gisenv set="DEBUG=5"
Which (after a while) will show you where it broke.
> > ERROR: x column is not of number type
..
> In fact the message should indicate the offending line, but I
> don't know how to implement that.
The column is scanned, and if it contains non-numeric data anywhere it
is flagged for varchar(). It is only an error on that line if you set
column type expicitly to double or int with the columns= option*. I
guess x= y= z= should imply that.
[*] while this probably should be the case, I am not sure if it triggers
an error currently, probably not.
Hamish
More information about the grass-stats
mailing list