text file reading, FORTRAN

Dave Allured dave.allured at NOAA.GOV
Tue Jan 3 20:36:22 EST 2006


Huamei,

I am confused about your first message.  Do you want to read the comma
delimited text file in FORTRAN, or in Grads?  Your message only talked
about FORTRAN.

I believe this problem can be solved in either language.  However, it is
not trivial.  You will have to write a small parser.  Scan the whole
input line from left to right, one character at a time.  Whenever you
find a comma, get the substring between the previous comma and the one
you just found.  Both languages have syntax to accomplish this.

--Dave A.
NOAA/CIRES Climate Diagnostics Center

Huamei Yin wrote:

> Hi,
>
> Thanks for the reply. But I actually have tons of files to read. The
> files are
> daily. So I cannot do it manually. And another issue is I have to
> display the
> station names and my boss wants me to avoid special characters in the
> station
> name.
>
> Any other ideas? Thank you.
>
> Huamei
>
>
>> A simple solution is replacing all space with _
>>
>> Youhua
>>
>> On Tue, 3 Jan 2006, Huamei Yin wrote:
>>
>>
>> Hi,
>>
>> I am reading a comma delimited text file. I used FORTRAN free format
>> to read
>> since the fields lengths change. It works well for most cases. But in
>> some
>> cases the station names have space in it and FORTRAN think space
>> means the end
>> of a field too, so it truncates the station name and the fields after
>> that will
>> be messed up. Dose anyone know how to solve this problem? Thank you
>> very much.
>>
>> Happy New Year!
>> Huamei
>>



More information about the gradsusr mailing list