[Thread Prev][Thread Next][Index]

Re: [ferret_users] Read value from text file



Hi,
I have one suggestion for asking questions: If you're seeing an error message, say what that error is.  Maybe there's a problem reading the text file, or maybe it's something else, but we can't tell from the question.

You may already know all this from reading documentation, but here are some things people run into as new users. In using Ferret to access data files, Ferret itself can often help you know what's going on.

When you open datasets,
yes? use ....nc
yes? file/var="dpt,tm" input.dat
so far you've pointed to these files, but not yet read in any data.  For a netCDF file, "use" will open the file and read the header, getting variable names, attributes, and grid information.  For ascii files, the FILE command only checks that the file exists, and gets the number of records, but hasn't read in any data.  So, get Ferret to tell you what you've got open:
yes? show data
This lists the information from the netCDF file, and will show the number of records in "input.dat".  Now, read some data.
yes? list/i=1:10 dpt,tm
Is there any data?  If not, then the error message will help.  (Maybe you need a /SKIP= on the FILE command.)  If dpt and tm are ok, then it looks to me as if you need grave accents to evaluate the numbers
yes? fill/k=`dpt[i=1,d=1]`/l=`tm[i=1,d=1]`
-Ansley

On 10/13/2015 9:32 PM, Gayatri Vani wrote:
Dear sir,
I have already tried that way of reading the value from file but i get a syntax while executing..

use ....nc
file/var="dpt,tm" input.dat
fill/k=dpt[d=1]/l=tm[d=1]  ....

as you said .. now i even tried
fill/k=dpt[i=1,d=1]/l=tm[i=1,d=1] ...

still there is an error... so is this the way or any other way of reading the value is my doubt...


regards

On Tue, Oct 13, 2015 at 10:22 PM, Ryo Furue <furue@xxxxxxxxxx> wrote:
Hi,

> But now i want my script to take the values from a text file which contains
> the ascii values of the specifications (like lat, lon, time, level and
> so).

In that case, I suggest you consult the Ferret manual about reading
ascii data.  And then:

  !--- Read your ASCII file ---
   file/var="Kval,Lval, . . ."/  . . . your-ascii-file.txt
   !-- Plot ---
   fill/L=`Lval[i=1,d=1]`/K=`Kval[i=1,d=1]`/ . . . .

Ryo



--
Gayatri Vani K
Project Engineer
Computational Earth Sciences (CES) Group
Centre for Development of Advanced Computing (CDAC), Pune
Mobile: +91-9527615716
Email: gayatrivanik@xxxxxxx


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement