[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20000911: netCDF question (fwd)
- Subject: Re: 20000911: netCDF question (fwd)
- Date: Mon, 11 Sep 2000 11:22:31 -0600
>To: address@hidden
>From: Juliana Rew <address@hidden>
>Subject: netCDF question (fwd)
>Organization: UCAR/Unidata
>Keywords: 200009072135.e87LZNN11083
Hi,
> We received the following question from an SCD user. I verified that
> his script runs on our Compaq platform, but when I try to run it
> on our SGI or IBM SP (blackforest), it doesn't build a netcdf file at all
> (much less a corrupted one, as he is reporting). Can you advise on how
> we can debug this? Thanks,
I suspect you would have to adjust the location of the library
directory and maybe also the include directory and name of the Fortran
compiler in the following line of the script:
xlf -o test -I/usr/local/include test.f -L/usr/local/lib32/r4i4/ -lnetcdf
to get it to run on the SGI or IBM SP.
We don't have NCL installed here so we can't reproduce the error
exactly. But Steve has a login on blackforest, so I'll forward this
to him.
--Russ
From address@hidden Wed Sep 6 15:39:21 2000
From: "Marat Khairoutdinov" <address@hidden>
Date: Wed, 6 Sep 2000 15:39:16 -0600
To: address@hidden, address@hidden
Subject: netcdf problem on blackforest
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Length: 2701
Hi,
I have the following problem with netcdf fortran calls on blackforest. I was
able to strip it down to a simple fortran code generated by the script attached
below. Some of the data get corrupted while written in netcdf file. I tested
the same code on SGI and prospect (Compaq) - everything is just fine. Please
could you pass this code to somebody to check what's going on. Thanks.
-Marat
-------------------------------------
Run the script below on blackforest. Note that although all elements of
variables are set to zero, the Q2 variable contains garbage.
#! /usr/bin/csh
set echo
cat >! test.f << EOF
implicit none
include 'netcdf.inc'
character name*10
integer nzm, ntime, hbuf_length
real f(2000)
integer i,k
integer vdimids(2), ndimids
integer ncid,err,zid,timeid,varid
f=0.
nzm=64
ntime=31
err = NF_CREATE('tmp.nc', NF_CLOBBER, ncid)
err = NF_REDEF(ncid)
err = NF_DEF_DIM(ncid, 'time', ntime, timeid)
err = NF_DEF_DIM(ncid, 'z', nzm, zid)
err = NF_ENDDEF(ncid)
ndimids=2
vdimids(1) = zid
vdimids(2) = timeid
do while(.true.)
read(5,fmt=*,err=1000,end=1000) name
write(6,'(a10)') name
err = NF_REDEF(ncid)
err = NF_DEF_VAR(ncid,name,NF_FLOAT,
& ndimids,vdimids,varid)
err = NF_ENDDEF(ncid)
err = NF_PUT_VAR_REAL(ncid, varid, f)
end do
1000 continue
err = NF_CLOSE(ncid)
end
EOF
cat >! input.txt << EOM
PRES
U
V
UOBS
VOBS
RHO
MSE
DSE
SSE
THETAE
THETA
THETAV
THETAL
TABS
TABSOBS
TL
QT
QV
S
QVOBS
TTEND
QTEND
QC
QI
QR
QS
QG
QN
QP
QSAT
QCOND
PRECIP
RELH
TLFLUX
TLFLUXS
TVFLUX
QTFLUX
QTFLUXS
QCFLUX
QIFLUX
QPFLUX
QPFLUXS
SW
SWSB
UW
UWSB
VW
VWSB
RADLWUP
RADLWDN
RADSWUP
RADSWDN
RADQRLW
RADQRSW
RADQR
RADQRS
RADQRC
Q1C
Q2
U2
V2
W2
EOM
# compile and run:
xlf -o test -I/usr/local/include test.f -L/usr/local/lib32/r4i4/ -lnetcdf
test < input.txt
#-----------------------------------------------------
# read netcdf file:
cat >! read.ncl << EOF
f=addfile("./tmp.nc","r")
names = getfilevarnames(f)
do i=0,dimsizes(names)-1
print(names(i)+" sum of all elements: "+sum(f->\$names(i)\$))
end do
EOF
ncl < read.ncl
--
\\|||//
| ^ ^ |
( o o )
_______oOOo______-______oOOo__
Marat F. Khairoutdinov, Ph.D.
Department of Atmospheric Science
Colorado State University
Fort Collins, CO 80523, U.S.A.
phone: (970) 491-8591
fax: (970) 491-8693 or 491-8428
address@hidden
http://kiwi.atmos.colostate.edu/group/marat