[gradsusr] Open text file and output as a csv format in GRADS
James T. Potemra
jimp at hawaii.edu
Tue May 28 13:46:34 EDT 2013
Lyndon:
As suggested earlier, you should just use a script to do this, e.g., in awk:
awk 'BEGIN{FS="/"}{print $1, $2, $3, $4}' infile.dat > outfile.dat
Jim
On 5/28/13 7:24 AM, Lyndon Mark Olaguera wrote:
> I just want to get rid of the back slash..Wen i tried it fortran it
> only gives me an error..
>
>
>
> On Tue, May 28, 2013 at 10:52 PM, Sestak, Michael L CIV 63134
> <michael.l.sestak at navy.mil <mailto:michael.l.sestak at navy.mil>> wrote:
>
> The read function in the grads scripting language will open a text
> file, then you have to parse your dates using substr.
>
> But, all that can be done in fortran, and CSV usually means comma
> separated values, not columns.
>
> So, I'm not sure what you really want to do.
>
> Michael Sestak
> Fleet Numerical Meteorology and Oceanography Center
> Monterey, CA
>
> Message: 1
> Date: Tue, 28 May 2013 11:26:24 +0800
> From: Lyndon Mark Olaguera <olagueralyndonmark429 at gmail.com
> <mailto:olagueralyndonmark429 at gmail.com>>
> Subject: [gradsusr] Open text file and output as a csv format in GRADS
> To: GrADS Users Forum <gradsusr at gradsusr.org
> <mailto:gradsusr at gradsusr.org>>
> Message-ID:
>
> <CA+V+8dWb8qXJt37XMU=K-51hNC=NmuQ3fx27ApOXoPLopF+mgw at mail.gmail.com <mailto:NmuQ3fx27ApOXoPLopF%2Bmgw at mail.gmail.com>>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
> I have station data in a text file and I want to read it using
> grads and output as a csv file.
> The problem is the dates are separated by a backslash...
> here's a sample format:
>
> The text file contains the following data.
>
> yy/mm/dd/hh pressure rain
> TEMPERATURE wind speed
> 2012/08/06/00 10000 2.5
> 300 45
> ...
> ...
> ...
> ....
>
>
> I want to oputput this in a csv format such that the the years,
> months, days, and hours are in separated in columns...
> like:
>
> yy mm dd hh rain
> temperature wind speed
>
>
>
> I can't do it in fortran so i guess its easier to do this in GRADs..
>
>
> thanks for any help.
> Lyndon
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130528/a3beba77/attachment-0003.html
More information about the gradsusr
mailing list