|
From: Dan M. <Mo...@co...> - 2002-06-11 07:08:15
|
James, Has anyone responded to you yet? I'm sorry I did not respond earlier. Can you tell me what messages were written to your screen when you ran your program? The reason I ask, is that usually, the word "stop" tells the program (and all subsequent subroutines) to do just that - stop. I noticed your "convert" subroutine has "stop" instead of "return", and although you have a line with the label "20", nothing refers to it, so your subroutine will never skip the "stop" statement, and thus will never return to the main program. As a result, the v5dclose function is never called. This particular function does more than just close the file, and calling it is necessary for the file to be in the proper format. Let me know if this helps. Regards, Dan McCormick James Lamm wrote: >Hi, I am using vis5d and tried to create a very simple vis5d file >with your foo_to_v5d.f program. I filled in missing pieces about as >simply as I could. It compiles and ran fine. Unfortunately, when >I say vis5d outfile.v5d it returns and says: > > >Error: not a v5d file >Error: datafile outfile.v5d not found > >any suggestions? Thanks very much for your help. > >Note: another person said to add -DLITTLE to CFLAGS since this is on >linux. It did not help. > > > > program foo_to_v5d > implicit none > include "../src/v5df.h" > integer iargc >c Local vars > integer n > real*4 G(MAXROWS, MAXCOLUMNS, MAXLEVELS) > character*100 outname > integer i,j,k > > > integer nr, nc, nl > integer numtimes > integer numvars > character*10 varname(MAXVARS) > integer dates(MAXTIMES) > integer times(MAXTIMES) > real northlat > real latinc > real westlon > real loninc > real bottomhgt > real hgtinc > > >c initialize the variables to missing values > data nr,nc,nl / IMISSING, IMISSING, IMISSING / > data numtimes,numvars / IMISSING, IMISSING / > data (varname(i),i=1,MAXVARS) / MAXVARS*" " / > data (dates(i),i=1,MAXTIMES) / MAXTIMES*IMISSING / > data (times(i),i=1,MAXTIMES) / MAXTIMES*IMISSING / > data northlat, latinc / MISSING, MISSING / > data westlon, loninc / MISSING, MISSING / > data bottomhgt, hgtinc / MISSING, MISSING / > > outname= 'outfile.v5d' > > nr = 40 > nc = 80 > nl = 20 > numtimes = 1 > numvars = 1 > > varname(1) = 'zzzz' > > dates(1) = 93001 > times(1) = 140000 > > northlat = 32.0 > latinc = 0.2 > westlon = 88.0 > loninc = 0.125 > bottomhgt = 0.0 > hgtinc = 100.0 > >c Create the v5d file. > n = v5dcreatesimple( outname, numtimes, numvars, nr, nc, nl, > * varname, times, dates, > * northlat, latinc, westlon, loninc, > * bottomhgt, hgtinc ) > if (n .eq. 0) then > write(*,*)'EE problem with create' > stop > endif > if (n .ne. 0) then > write(*,*)'no problem with create' > endif > >c enter the conversion subroutine > call convert( nr, nc, nl, numtimes, numvars, G ) > >c close the v5d file and exit > n = v5dclose() > if (n .eq. 0) then >c failed > write(*,*) 'EE error on close' > call exit(1) > else >c success > call exit(0) > write(*,*) ' closed file o.k.' > endif > > end > > > > >c Read 3-D grids from input file, write them to the output file. > > subroutine convert( nr, nc, nl, numtimes, numvars, G ) > implicit none > include "../src/v5df.h" >c Arguments > integer nr > integer nc > integer nl > integer numtimes > integer numvars > real*4 G(nr, nc, nl) >c Local vars > integer it, iv, n, valc,levc,latc,lonc > > > do it=1,numtimes > do iv=1,numvars > > > do levC = 1,nl > do latC = 1,nc > do lonC = 1,nr > G(lonc,latc,levc) = 6.0 > enddo > enddo > enddo > > >c write the 3-D grid to the v5d file > n = v5dwrite( IT, IV, G ) > if (n .eq. 0) then >c error > write(*,*) 'EE died on write' > call exit(1) > stop > endif > enddo > enddo > > stop > 20 continue > write(*,*)'EE read problem' > stop > end > > > > |