[gradsusr] opening text file data

Muhammad Rahiz muhammad.rahiz at ouce.ox.ac.uk
Tue Feb 8 03:35:54 EST 2011


Galebonwe,

I'm using GrADS on linux and as far as I know, if your text file is in the same directory as your script, you don't have to put in the full path.
I'm not sure if it's different on Windows although I doubt so. I presume 
you've checked your code?

Muhammad Rahiz
Researcher & DPhil Candidate (Climate Systems & Policy)
School of Geography & the Environment
University of Oxford

On Tue, 8 Feb 2011, Galebonwe Ramaphane wrote:

> I have a similar but minor problem. My calling script does not see the text file. I tried putting the text file in the same directory as the calling script. I still failed to read the text file. Do I include the full path of the text file?
>
> Galebonwe Ramaphane
> Department of Meteorological Services
> P.O. BOX 10100
> Gaborone
> Botswana
> Tel: +267 3612200
>  Mobile: +267 74435261
>
> -----Original Message-----
> From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Muhammad Rahiz
> Sent: Monday, February 07, 2011 6:32 PM
> To: GrADS Users Forum
> Subject: Re: [gradsusr] opening text file data
>
> James, you can try the following.
>
> *****
>
> 'sdfopen ifile.nc'
>
> * ttot = number of lines in text file
> ttot = 755
> tx = 1
> while(tx<=ttot)
> fname ='7hA01.out.txt'
>  rec = read(fname)
>  IO = sublin(rec,1)
>   if(IO = 1)
>    say fname' > File open error'
>    'quit'
>   endif
>  if(IO = 0)
>    t1 = subwrd(rec,2)
>    t2 = subwrd(rec,3)
>   endif
> say ''t1' 't2''
>
> tx = tx +1
> endwhile
>
> *****
>
> -- 
> Muhammad Rahiz
> Researcher & DPhil Candidate (Climate Systems & Policy)
> School of Geography & the Environment
> University of Oxford
>
> On Mon, 7 Feb 2011, James Ciarlo` wrote:
>
>> Hi,
>> I have several text files such as the one I attached and I need to open them
>> which GrADS but I cannot understand how to do so. Can someone help me
>> please?
>>
>> James
>>
>>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


More information about the gradsusr mailing list