Re: csv files

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Fri Aug 06 2010 - 10:31:32 MDT

Ben,

Try this script:

strs = asciiread("tst.txt", -1, "string")
delim = str_get_tab()
c1 = str_get_field(strs(1:), 1, delim)
c2 = str_get_field(strs(1:), 2, delim)

print(c1)
print(c2)

(Certainly, you need to change tst.txt to your own file name).

Regards,

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Aug 6, 2010, at 10:00 AM, Benjamin Lamptey wrote:

> Hello,
> I have some .csv file which looks like the following
>
>
> Date RR
> 1-Jan-60 0
> 2-Jan-60 0
> 3-Jan-60 0
> 4-Jan-60 0
> 5-Jan-60 0
> 6-Jan-60 0
> 7-Jan-60 0
> 8-Jan-60 0
> 9-Jan-60 0
> 10-Jan-60 0
> 11-Jan-60 0
> 12-Jan-60 0
> 13-Jan-60 0
> 14-Jan-60 0
> 15-Jan-60 3.8
> 16-Jan-60 0
> 17-Jan-60 0
> 18-Jan-60 0
> 19-Jan-60 0
> 20-Jan-60 0
> 21-Jan-60 0
> 22-Jan-60 0
> 23-Jan-60 0
> 24-Jan-60 0
> 25-Jan-60 0
> 26-Jan-60 0
> 27-Jan-60 0
> 28-Jan-60 0
> 29-Jan-60 0
> 30-Jan-60 0
> 31-Jan-60 0
> 1-Feb-60 0
> 2-Feb-60 0
> 3-Feb-60 0
> 4-Feb-60 3.8
>
>
> I have tried using the examples on the reading csv files page
> without success.
> The date is not read in properly.
>
> Could someone kindly help me out?
>
> Thanks
> Ben
>
> Benjamin Lamptey, PhD
> Senior Lecturer
> Nautical Science Department
> Regional Maritime University
> P.O. Box GP 1115, Accra Ghana
>
> and
>
> Scientist (Meteorologist and Geoscientist)
> International Water Management Institute
> PMB CT 112, Cantonments, Accra Ghana
> FAX: +233 030 2 784752
>
> Cell: +233(0)273135062
> bllamptey@gmail.com
> http://www.rap.ucar.edu/~lamptey
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 6 10:31:53 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 17 2010 - 15:33:24 MDT