Fri, Dec 3 2004
07:15:54
|
|
Request created by guest
|
|
Subject: v.in.ascii auto-detection too strict
Platform: GNU/Linux/i386
grass obtained from: Mirror of Trento site
grass binary for platform: Compiled from Sources
GRASS Version: 5.7-cvs_nov04
Hi,
when using v.in.ascii it automatically decides column type, even if you
specify with 'columns=' e.g.:
columns='x double precision, y double precision, cat int, name varchar(10)'
problem I am having:
I have an input column with data like:
001
002
003
004
005
etc.
I want to load that as a string column, not an int column (even though
they are all numbers). I use 'id_num varchar(3)' but it gives an error
that column type does not match input data type. :(
problem two:
I want to input "nan" into a double precision column, it complains
"column foo defined as double has string values"
'nan' and 'inf' are valid IEEE float/double values;
scanf "%f" reads them, etc.
thanks,
Hamish
|
|
Fri, Dec 3 2004
11:45:41
|
|
Mail sent by blazek@itc.it
|
|
Return-Path |
<blazek@itc.it>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Message-ID |
<41B043CF.3020907@itc.it>
|
Date |
Fri, 03 Dec 2004 11:45:35 +0100
|
From |
Radim Blazek <blazek@itc.it>
|
User-Agent |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113
|
X-Accept-Language |
en-us, en
|
MIME-Version |
1.0
|
To |
Request Tracker <grass-bugs@intevation.de>
|
Cc |
grass5@grass.itc.it
|
Subject |
Re: [GRASS5] [bug #2763] (grass) v.in.ascii auto-detection too strict
|
References |
<20041203061554.5A21A100179@lists.intevation.de>
|
In-Reply-To |
<20041203061554.5A21A100179@lists.intevation.de>
|
Content-Type |
text/plain; charset=us-ascii; format=flowed
|
Content-Transfer-Encoding |
7bit
|
X-Spam-Status |
No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
|
X-Spam-Level |
|
Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=2763
> -------------------------------------------------------------------------
>
> Subject: v.in.ascii auto-detection too strict
>
> Platform: GNU/Linux/i386
> grass obtained from: Mirror of Trento site
> grass binary for platform: Compiled from Sources
> GRASS Version: 5.7-cvs_nov04
>
> Hi,
>
> when using v.in.ascii it automatically decides column type, even if you
> specify with 'columns=' e.g.:
>
> columns='x double precision, y double precision, cat int, name varchar(10)'
>
>
> problem I am having:
>
> I have an input column with data like:
> 001
> 002
> 003
> 004
> 005
> etc.
>
> I want to load that as a string column, not an int column (even though
> they are all numbers). I use 'id_num varchar(3)' but it gives an error
> that column type does not match input data type. :(
For me it works:
cat pok.txt
0|1|1|001
2|3|2|002
4|5|3|003
cat pok.txt | v.in.ascii output=pok columns="x double precision, y
double precision, cat int, name varchar(10)" catcol=3
db.describe schema1.pok
...
column:name
description:
type:CHARACTER
len:10
> problem two:
> I want to input "nan" into a double precision column, it complains
> "column foo defined as double has string values"
>
> 'nan' and 'inf' are valid IEEE float/double values;
> scanf "%f" reads them, etc.
Added to my TODO > 6.0
Radim
|
|
Fri, Sep 2 2005
17:44:55
|
|
Mail sent by msieczka
|
|
Gentlemen,
What is the status of this problem?
Thank you,
Maciek |
|
Tue, Jul 4 2006
15:05:11
|
|
Mail sent by mneteler
|
|
Hamish,
please try 'NULL' instead of 'nan'.
Markus |
|
Wed, Jul 5 2006
16:35:59
|
|
Mail sent by hamish_nospam@yahoo.com
|
|
Return-Path |
<hamish_nospam@yahoo.com>
|
Delivered-To |
grass-bugs@lists.intevation.de
|
Date |
Thu, 6 Jul 2006 02:35:55 +1200
|
From |
Hamish <hamish_nospam@yahoo.com>
|
To |
Markus Neteler via RT <grass-bugs@intevation.de>
|
Subject |
Re: [bug #2763] (grass) v.in.ascii auto-detection too strict
|
Message-Id |
<20060706023555.5ad89ac3.hamish_nospam@yahoo.com>
|
In-Reply-To |
<20060704130511.9FE321005B9@lists.intevation.de>
|
References |
<20060704130511.9FE321005B9@lists.intevation.de>
|
X-Mailer |
Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
|
X-Face |
M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
|
Mime-Version |
1.0
|
Content-Type |
text/plain; charset=US-ASCII
|
Content-Transfer-Encoding |
7bit
|
X-Virus-Scanned |
by amavisd-new at intevation.de
|
X-Spam-Status |
No, hits=-1.499 tagged_above=-999 required=4 tests=[AWL=1.406, BAYES_00=-5, FORGED_YAHOO_RCVD=2.095]
|
X-Spam-Level |
|
> please try 'NULL' instead of 'nan'.
nan, inf are valid float/double values and should be scanned as such
from incoming raw float data. sscanf does, AFAIK, read it as a valid %f.
It's the v.in.ascii column type scanning which is buggy.
http://en.wikipedia.org/wiki/IEEE_754
I haven't tried, but I expect "NULL" is harder to parse and "more wrong"
(unless it has some special SQL meaning I am not aware of).
"" on the other hand does work. My current work around is:
sed -e 's/nan//g'
Hamish
|
|
Sat, Jul 8 2006
21:31:54
|
|
Mail sent by mneteler
|
|
I guess that this could be solved in v.in.ascii by
using
char * G_str_replace(char* buffer, char* old_str, char* new_str)
/* Replace all occurencies of old_str in buffer with new_str */
buffer: incoming line
old_str: nan
new_str: ''
Markus |
|