[gradsusr] [BULK] Re: opening text file data

Galebonwe Ramaphane GRamaphane at gov.bw
Tue Feb 8 06:44:57 EST 2011


Muhammad,

I'm also running GrADS on linux. I have gone over the code several times. It's one of those annoying problems. I'll attach the sample script and the text file for your inspection.

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: Tuesday, February 08, 2011 10:36 AM
To: GrADS Users Forum
Subject: [BULK] Re: [gradsusr] opening text file data
Importance: Low

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
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cities.txt
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20110208/1129ffb9/attachment-0003.txt 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: city_plot.gs
Type: application/octet-stream
Size: 1517 bytes
Desc: city_plot.gs
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110208/1129ffb9/attachment-0003.obj 


More information about the gradsusr mailing list