Details Ticket 2997


Comment | Reply | Take | Open


Serial Number 2997
Subject v.in.ascii: add skip header lines option
Area wish
Queue grass
Requestors hamish_nospam@yahoo.com
Owner none
Status resolved
Last User Contact Fri Feb 18 18:14:36 2005 (4 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Wed Sep 27 14:59:51 2006 (2 yr ago)
Created Tue Feb 15 06:51:54 2005 (4 yr ago)

Transaction History Ticket 2997


Tue, Feb 15 2005 06:51:54    Request created by hbowman  
Subject: v.in.ascii: add skip header lines option

(points mode)
It would be nice if v.in.ascii had a skip=int option to skip the top n lines
of an input file. Often a .csv file will have a comment and column headings at
the start of the file and data will start on line 3-5. Resaving without is a
pain and leaves behind .csv data files which are impossible to figure out even
just an hour later (at least for me).


Hamish
Fri, Feb 18 2005 18:14:36    Mail sent by guest  
... I have already implemented that:

RCS file: /grassrepository/grass6/vector/v.in.ascii/in.c,v
retrieving revision 1.19
diff -u -r1.19 in.c
--- in.c        8 Feb 2005 12:57:38 -0000       1.19
+++ in.c        18 Feb 2005 17:13:40 -0000
@@ -16,7 +16,7 @@
        struct Option *old, *new, *delim_opt, *columns_opt, *xcol_opt,
                *ycol_opt, *zcol_opt, *catcol_opt, *format_opt;
        int    xcol, ycol, zcol, catcol, format;
-       struct Flag *zcoorf, *t_flag, *e_flag;
+       struct Flag *zcoorf, *t_flag, *e_flag, *noheader_flag;
        char   *table;
        char   *fs;
        int    zcoor=WITHOUT_Z, make_table;
@@ -109,7 +109,11 @@
        e_flag = G_define_flag();
        e_flag->key              = 'e';
        e_flag->description      = "Create a new empty map and exit. Nothing
is read from input.";
-
+
+        noheader_flag = G_define_flag();
+        noheader_flag->key          = 'n';
+        noheader_flag->description  = "Don't expect a header when reading in
standard format";
+
        if (G_parser (argc, argv))
                exit(-1);

@@ -370,7 +374,8 @@
            fclose (tmpascii);
        } else {
             /* FORMAT_ALL = standard mode */
-           read_head(ascii, &Map);
+           if ( ! noheader_flag->answer )
+                   read_head(ascii, &Map);
            asc_to_bin(ascii, &Map) ;
        }


To me it does not look intrusive. I can submit whenever
desired. Please suggest.

Markus
Tue, Feb 22 2005 04:22:37    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Tue, 22 Feb 2005 16:22:23 +1300
From Hamish <hamish_nospam@yahoo.com>
To grass-bugs@intevation.de
Cc grass5@grass.itc.it
Subject Re: [GRASS5] [bug #2997] (grass) v.in.ascii: add skip header lines option
Message-Id <20050222162223.7ea40283.hamish_nospam@yahoo.com>
In-Reply-To <20050218171436.85B52102C28@lists.intevation.de>
References <20050218171436.85B52102C28@lists.intevation.de>
X-Mailer Sylpheed version 1.0.0 (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-Spam-Status No, hits=-4.0 tagged_above=-999.0 required=3.0 tests=BAYES_00, FORGED_YAHOO_RCVD
X-Spam-Level
>> Subject: v.in.ascii: add skip header lines option
>>
>> (points mode)
>> It would be nice if v.in.ascii had a skip=int option to skip the top
>> n lines of an input file. Often a .csv file will have a comment and
>> column headings at the start of the file and data will start on line
>> 3-5. Resaving without is a pain and leaves behind .csv data files
>> which are impossible to figure out even just an hour later (at least
>> for me).
>>
Markus wrote:
>
> ... I have already implemented that:
> 
..
> +        noheader_flag = G_define_flag();
> +        noheader_flag->key          = 'n';
> +        noheader_flag->description  = "Don't expect a header when reading
in standard format";
[...]
> -           read_head(ascii, &Map);
> +           if ( ! noheader_flag->answer )
> +                   read_head(ascii, &Map);
>             asc_to_bin(ascii, &Map) ;



That will be nice for scripts, but I was talking about the header info
in points mode when dealing with .csv files with column headings:

in.txt:
------------
Test data collected 22 Feb 2005.

cat,x,y,distance (m),data1
1,12345,67890,2.4,0.002
2,12352,67012,6.8,0.014
3,12326,66587,10.2,0.102
...
-------------

here I want to have "skip=3" so it starts reading data on the 4th line.



Hamish


Sun, Oct 16 2005 06:16:32    Status changed to resolved by dcalvelo  
Tue, Sep 26 2006 17:52:10    Comments added by guest  
Good Luck! http://xoomer.alice.it/pik0/poker-rooms/
Tue, Sep 26 2006 21:09:29    Comments added by guest  
Cool design http://xoomer.alice.it/pik0/razz-poker/
Wed, Sep 27 2006 00:05:57    Comments added by guest  
Great work on website. <a href="http://xoomer.alice.it/pik0/rules-of-poker/">rules
of poker</a> [url=http://xoomer.alice.it/pik0/rules-of-poker/]rules of poker[/url]
http://xoomer.alice.it/pik0/rules-of-poker/
Wed, Sep 27 2006 03:06:55    Comments added by guest  
Great web site <a href="http://xoomer.alice.it/pik0/blackjack-mountain/">blackjack
mountain</a> [url=http://xoomer.alice.it/pik0/blackjack-mountain/]blackjack mountain[/url]
http://xoomer.alice.it/pik0/blackjack-mountain/
Wed, Sep 27 2006 06:04:36    Comments added by guest  
Thank you... <a href="http://xoomer.alice.it/pik0/yahoo-games-poker/">yahoo games
poker</a> [url=http://xoomer.alice.it/pik0/yahoo-games-poker/]yahoo games poker[/url]
http://xoomer.alice.it/pik0/yahoo-games-poker/
Wed, Sep 27 2006 09:00:17    Comments added by guest  
Great work on website. <a href="http://xoomer.alice.it/pik0/free-online-poker-site/">free
online poker site</a> [url=http://xoomer.alice.it/pik0/free-online-poker-site/]free
online poker site[/url] http://xoomer.alice.it/pik0/free-online-poker-site/
Wed, Sep 27 2006 12:02:19    Comments added by guest  
Thank you... <a href="http://xoomer.alice.it/pik0/poker-games-for-pc/">poker
games for pc</a> [url=http://xoomer.alice.it/pik0/poker-games-for-pc/]poker games
for pc[/url] http://xoomer.alice.it/pik0/poker-games-for-pc/
Wed, Sep 27 2006 14:59:51    Comments added by guest  
VERY GOOD I THINK <a href="http://xoomer.alice.it/pik0/card-poker-ME/">card poker
ME</a> [url=http://xoomer.alice.it/pik0/card-poker-ME/]card poker ME[/url] http://xoomer.alice.it/pi
k0/card-poker-ME/
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request