[Thread Prev][Thread Next][Index]

Re: Quicker loading into fortran?

Hello Richard,

> I'm currently loading data into Fortran to do some fiddly analysis and
> then dumping out again. Currently I'm saving to Fortran using:
> The data I have is on a grid with i=1:41, j=1:19, k=1:1 and l=1:7200
> After plenty of looking through the archive to find a way to load in
> and out of fortran, my method is to:
> 1) Dump into fortran format using:
> list/file=jet.dat/format=unformatted/order=z mag[i=1:41,j=1:19,l=1:7200]
> 2) Read into fortran using:
> 	parameter(ix=41,iy=19,it=7200)
> 	dimension u(ix,iy,it)
> 	open(11,file="c:jet.dat",form="unformatted",access="direct")
> 	do l=1,it
> 	do j=1,iy
> 	do i=1,ix
> 	read(11) u(i,j,l)
> 	end do
> 	end do
> 	end do
> However - the reading in of the data seems to take quite a while. Does
> anybody know of a quicker method for reading ferret data into fortran?

There are several things wrong with your Fortran code.  First, you
should declare the record length with RECL= when you open a file with
ACCESS='DIRECT'.  Second, you should specify the record being read in
the read statement, with REC=, when the file is open with
ACCESS='DIRECT'.  Third, maybe you should open the file with sequential
access anyway.  It depends how Ferret's list command writes to the file.
Fourth, it would be much faster to read the file in one READ statement
instead of 5608800 READ statements, getting rid of the DO loops:

       dimension u(ix,iy,it)
       READ(11) u

(provided that sequential access is correct and provided that you can
write the file with list to have only one record).

Michel Béland (beland@CERCA.UMontreal.CA)  téléphone   : (514) 369-5223
analyste en calcul scientifique            télécopieur : (514) 369-3880
RQCHP (Réseau québécois de calcul de haute performance)  www.rqchp.qc.ca
CERCA (Centre de recherche en calcul appliqué)    www.cerca.umontreal.ca
5160, boul. Décarie, bureau 400(423), Montréal (Québec), Canada, H3X 2H9

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement