|
From: James L. <la...@me...> - 2002-05-24 16:06:05
|
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 one person (because I was using Linux) suggested to add -DLITTLE
to CFLAGS in the makefile. This did not solve the problem however.
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
|