[Thread Prev][Thread Next][Index]

Re: [ferret_users] reading FORTRAN sequential access data - simplequestion



Except for the 'access=sequential' part (which I have no idea about), I write unformatted fortran in just the same way (an entire grid on one record) to read into ferret all the time, both on Sun Solaris and Mac OSX. Never any problem. I think Steve's comment about the need for the /COLUMNS= qualifier is the exactly what's needed. That is how Ferret knows that there is more than 1 variable/record.

I guess I can't speak to the 'type=r8' thing, either.

Billy K

On Jul 6, 2006, at 6:07 PM, tomas@ucar.edu wrote:

Thanks for the reply Steve.

I brought up the issue of the loop because in the FORTRAN code
in the example, the writing was structure something like:

do i = 1,100
do j = 1,100
do k = 1,100
write(10)array(i,j,k)
enddo
enddo
enddo

If I am correct, each time the write statement is executed, a new
record is written, and along with it, an end of record "string".

Now I am writing using a structure like

write(10) array

In this case only a single big record and single end of record "string" is
written.

I am writing and reading on the same linux box, by the way.

I *think* I tried the columns = appropriate number but can't be sure
now. I'll try again tomorrow to be sure.

Bob

Hi Bob,

FORTRAN unformatted output is not really a standard. It is system and
compiler dependent how the concept of a "record" is implemented. So for
a start if the data are written on one system architecture and are being
read on another then all bets are off.

The second thing is that the existence of the loop in your code
shouldn't be a factor in successfully reading the first output record.
Reading this first record, alone, should be your first target. See Ch2
Sec4.1.1. "Records of uniform length" in the on-line users guide.

At a glance I think the problem in your command may be that you need to
include /COLUMNS=`128*64*19`. (It has been years since I have used this
capability.)

yes? file/var=hrmean/grid=gg/type=r8/format=unf/COL=`128*64*19`
HRMEAN.sst-2Xna-ctrl-04_001_280_emean.dat

If this works, then move onto the time looping. Define the time axis as
part of your grid, but do not change the /COLUMNS argument. /COLUMNS
tells how many values are on each record as I recall.

- steve

=================================

Bob Tomas wrote:

Jaison,

I looked at the examples and unfortunately the one provided doesn't
address the
case I have because the FORTRAN write is imbedded inside do loops and
single array elements are written with each "write". In my case, I
write out the whole darn array using a single write.

In Ferret I tried:

define axis/x=1:128:1 x128
define axis/y=1:64:1 y64
define axis/z=1:19:1 z19
define grid/x=x128/y=y64/z=z19 gg
file/var=hrmean/grid=gg/type=r8/format=unf
HRMEAN.sst-2Xna-ctrl-04_001_280_emean.dat

show data
currently SET data sets:
1> ./HRMEAN.sst-2Xna-ctrl-04_001_280_emean.dat (default)
name title I J
K L
HRMEAN HRMEAN 1:128 1:64
1:19 ...

fill hrmean[k=19]
sfe: formatted io not allowed
apparent state: unit 62 named
./HRMEAN.sst-2Xna-ctrl-04_001_280_emean.dat
lately reading sequential formatted external IO
Abort

Bob






On Fri, 7 Jul 2006, Jaison Kurian wrote:

Hi Bob,
See the examples given in this mail :

http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2004/ msg00372.html


Regards,

Jaison


On Thu, 6 Jul 2006, Bob Tomas wrote:

Hello,

I tried to sort this out using the documentation but I wasn't able
so...

I created a binary file using FORTRAN using something like:

       real*8 hrmean(19,64,128)
    open(unit=10,access='sequential',form='unformatted',...)
       write(10)hrmean

If someone can provide an example, I'd be very thankful.

Bob



--
º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤º¤ø,¸¸,ø¤º

Steve Hankin, NOAA/PMEL -- Steven.C.Hankin@noaa.gov
7600 Sand Point Way NE, Seattle, WA 98115-6349
ph. (206) 526-6080, FAX (206) 526-6744






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement