[Thread Prev][Thread Next][Index]

Re: [ferret_users] Reading from an ASCII file



Hi -
Yes, you can read this data using a Fortran format which reads pairs of records in a single read.
define axis/x=1:132:1 x132
define axis/y=1:145:1 y145
define grid/x=x132/y=y145 xygrid

file/skip=1/format=(80f1.0/52f1.0)/columns=132/grid=xygrid/var=input_var filename.dat
shade input_var
Because all variables in Ferret are represented as floating point data, you use the F format. 

Ansley


On 3/7/2011 7:10 AM, Szymon Roziewski wrote:
Hello Ferreters,
I have following data in a file:

       132       145
11111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111111111111111111111111011111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111111111111111111111110000011111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000001111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000000111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111000111111111111111110000000000000001111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
11111111111100010111111111111000000000000000000111111111111111111000000111111111
1111111111111111111111111111111111111111111111111111
11111111111100000001111111111000000000000000000011111111111111111000000011111111
1111111111111111111111111111111111111111111111111111
...


The problem is how to read it? The first row I can skip, because I don't
need to read this 132 and 145 values.
But then I have 80 intereger (0,1) values and in the next row is another 52
integer values.
The question is how to read this data and make an array 132x145 from that.
I am wondering whether I can use ferret for that purpose or just switch to
another language.
But I'd rather use ferret because I wouldn't change data files.
To make it I think I sould read one vector with 80 values and then the next
vector with 52 values, then merge altogether those data and put it into as
row(1x132) in matrix 132x145.
And then just repeat this action. But I don't very familiar with ferret and
It looks like not to be done easily in ferret for me.

Kind regards,
Szymon Roziewski


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

Privacy Policy | Disclaimer | Accessibility Statement