Problem with self-made binary files

Andrea Storto andrea.storto at TISCALI.IT
Wed Jan 26 03:04:02 EST 2005


I tried many changes, and now the code does work!
The main problem regards the ctl file (!!!):

>  vars      2
>     u 1 33,100 Eastward wind [m/s]
>     v 1 34,100 Northward wind [m/s]
>  endvars

Modifying variable code, whose meanings I underestimated,
from, for istance, 33,100 to 0, it's OK, even if the program had
cycle indices changed in function write.
Thank you anyway

Andrea

----- Original Message -----
From: "Sestak, Dr. Michael" <michael.sestak at FNMOC.NAVY.MIL>
To: <GRADSUSR at LIST.CINECA.IT>
Sent: Tuesday, January 25, 2005 3:27 PM
Subject: Re: Problem with self-made binary files


> First, you could check that the files are the size you expect them to be.
> Since you said smaller files work with the same code, maybe there is some
> kind of limit on file size on your system.
>
> -----Original Message-----
> From: Andrea Storto [mailto:andrea.storto at TISCALI.IT]
> Sent: Tuesday, January 25, 2005 12:54 AM
> To: GRADSUSR at LIST.CINECA.IT
> Subject: Re: Problem with self-made binary files
>
>
> It doesn't seem to be the problem:
> GrADS still does not work, and I get the same message
> (Was expecting 2 records, found 0)
> Thank you anyway!
>
> Andrea
>
> ----- Original Message -----
> From: Charles Seman
> To: GRADSUSR at LIST.CINECA.IT
> Sent: Monday, January 24, 2005 11:15 PM
> Subject: Re: Problem with self-made binary files
>
>
> Dear Andrea,
>
> Could you try:
>
>       WRITE (7,REC=1) U
>       WRITE (7,REC=2) V
>
> for unformatted output (number of elements are specified in your "open"
> statement)?  This works for our codes... If you had an NDZ, then put the
> write statements in a vertical loop, and assign data to 2D "U" and "V" for
> each level (or modify the RECL and array dimensions).
>
> I hope this helps,
> Chuck
>
> Andrea Storto wrote:
> Hi everybody,
> I'm trying to create binary files for GrADS with Fortran:
>
> ...
>       PARAMETER (NDY=16,NDX=116)
> ...
>       REAL U(NDY,NDX)
>       REAL V(NDY,NDX)
> ...
> C  Reading from files:
>
>       do 2 i=1,NDY
>           read(3,*) (U(i,k),k=1,NDX)
>           read(4,*) (V(i,k),k=1,NDX)
> 2     continue
> ...
> C  Writing on standard output to test:
>
>       WRITE (*,*) 'U variables:'
>       WRITE (*,*) ((U(K,L),L=1,NDX),K=1,NDY)
>       WRITE (*,*) '   '
>       WRITE (*,*) 'V variables:'
>       WRITE (*,*) ((V(K,L),L=1,NDX),K=1,NDY)
>
> C  Writing binary files:
>
>       OPEN (7,FILE='uv_uhiX1.dat' ,FORM='UNFORMATTED',
>      &ACCESS='DIRECT',RECL=NDY*NDX)
> C For Linux pgf77 just change the last row in:
> C   &ACCESS='DIRECT',RECL=NDY*NDX*4)
>
>       WRITE (7,REC=1) ((U(K,L),L=1,NDX),K=1,NDY)
>       WRITE (7,REC=2) ((V(K,L),L=1,NDX),K=1,NDY)
>       CLOSE(7)
> ...
>
> and ctl file songs like:
>
>  dset   ^uv_uhiX1.dat
>  title   Prova
>  undef    1e+20
>  xdef          16 linear   1.206897       2.413793
>  ydef         116 linear   1.031250       2.062500
>  zdef      1 levels 0
>  tdef      1 linear 0Z2jan1987 1dy
>  vars      2
>     u 1 33,100 Eastward wind [m/s]
>     v 1 34,100 Northward wind [m/s]
>  endvars
>
> I compiled with Visual Fortran: OK
> Built .exe: OK
> Verified Standard output and file existence: OK
> Tested the same command :
>        OPEN (7,FILE='uv_uhiX1.dat' ,FORM='UNFORMATTED',
>      &ACCESS='DIRECT',RECL=NDY*NDX)
>        WRITE (7,REC=1) ((U(K,L),L=1,NDX),K=1,NDY)
>        WRITE (7,REC=2) ((V(K,L),L=1,NDX),K=1,NDY)
>        CLOSE(7)
> : OK for smaller matrices and manual initialization
> for U and V(!!!)
> Tested ctl structure: OK
> But when I type "open uv_uhiX1.ctl" I get:
>
> Scanning description file:    uv_uhiX1.ctl
> Open Error: Unexpected EOF reading variables
> Was expecting 2 records. Found 0.
>   The data file was not opened.
>
> I don't know why I get this messsage, since I used the same
> fortran code (but initializing variables not from file but in Fortran
> itself!!!).
> Moreover, I can see in standard output correct values for my variables
> (even if some of them have exponential notation, others fixed notation)
> Have you ever had my problem?
> Thank you in advance
>
> Andrea Storto
>
>
>
> --
>
> ********************************************************************
>  Charles Seman                                Charles.Seman at noaa.gov
>  Geophysical Fluid Dynamics Laboratory / NOAA
>  Princeton University                          voice: (609) 452-6547
>  P.O. Box 308                                    fax: (609) 987-5063
>  Princeton, NJ  08542-0308            http://www.gfdl.noaa.gov/~cjs/
> ********************************************************************
>
> "The contents of this message are mine personally and do not reflect
> any position of the Government or NOAA."
>



More information about the gradsusr mailing list