This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Len, > To: address@hidden > cc: address@hidden > From: "Len Makin, CSIRO Maths & Info Sci, Melbourne." <address@hidden> > Subject: netCDF3.3.1 on Cray:problem > Organization: Australia/CSIRO > Keywords: 199708180113.TAA28638 In the above message, you wrote: > Hello all, > One of our users found this bug a couple of weeks back. > I have done some tracking but will have to leave it to you to fix. > Output on our Cray Y-MP looks like: > With netCDF 2.4.3 > ./nct2 > A -1, 0, 1 > With netCDF 3.3.1 > ./nct3 > A 4294967295, 0, 1 > It's the same for cf77 or f90. > Problem seems to be that in jackets for the version 2 compatibility stuff, > the INTEGER only gets sign extended to 32 bits > (4294967295 == 0xffffffff) instead of 64. > > Here is a shar archive of the test case: > - ---------------------------8<--Snip here--->8----------------------- > #!/bin/sh > # This is a shell archive (produced by GNU sharutils 4.2). > # To extract the files from this archive, save it to some FILE, remove > # everything before the `!/bin/sh' line above, then type `sh FILE'. > # > # Made on 1997-08-18 11:01 EST by <address@hidden>. > # Source directory was `/staff/len/cray/csmrd'. > # > # Existing files will *not* be overwritten unless `-c' is specified. > # > # This shar contains: > # length mode name > # ------ ---------- ------------------------------------------ > # 1015 -rw------- ncerr/Makefile > # 983 -rw------- ncerr/nctest.F > # 139 -rw------- ncerr/test.cdl > # > save_IFS="${IFS}" > IFS="${IFS}:" > gettext_dir=FAILED > locale_dir=FAILED > first_param="$1" > for dir in $PATH > do > if test "$gettext_dir" = FAILED && test -f $dir/gettext \ > && ($dir/gettext --version >/dev/null 2>&1) > then > set `$dir/gettext --version 2>&1` > if test "$3" = GNU > then > gettext_dir=$dir > fi > fi > if test "$locale_dir" = FAILED && test -f $dir/shar \ > && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) > then > locale_dir=`$dir/shar --print-text-domain-dir` > fi > done > IFS="$save_IFS" > if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED > then > echo=echo > else > TEXTDOMAINDIR=$locale_dir > export TEXTDOMAINDIR > TEXTDOMAIN=sharutils > export TEXTDOMAIN > echo="$gettext_dir/gettext -s" > fi > touch -am 1231235999 $$.touch >/dev/null 2>&1 > if test ! -f 1231235999 && test -f $$.touch; then > shar_touch=touch > else > shar_touch=: > echo > $echo 'WARNING: not restoring timestamps. Consider getting and' > $echo "installing GNU \`touch', distributed in GNU File Utilities..." > echo > fi > rm -f 1231235999 $$.touch > # > if mkdir _sh00869; then > $echo 'x -' 'creating lock directory' > else > $echo 'failed to create lock directory' > exit 1 > fi > # ============= ncerr/Makefile ============== > if test ! -d 'ncerr'; then > $echo 'x -' 'creating directory' 'ncerr' > mkdir 'ncerr' > fi > if test -f 'ncerr/Makefile' && test "$first_param" != -c; then > $echo 'x -' SKIPPING 'ncerr/Makefile' '(file already exists)' > else > $echo 'x -' extracting 'ncerr/Makefile' '(text)' > sed 's/^X//' << 'SHAR_EOF' > 'ncerr/Makefile' && > PROG2=nct2 > PROG3=nct3 > PROGRAMS=${PROG2} ${PROG3} > # Note: Use the preprocessor to vary the include file > SRCS=nctest.F > OBJ2=nctest2.o > OBJ3=nctest3.o > OBJS=${OBJ2} ${OBJ3} > # Specify location of netCDF library version 2.4.3 > LIB2=-L/usr/local/lib -lnetcdf2 > # Specify location of netCDF library version 3.3.1 > LIB3=-L/usr/local/lib -lnetcdf > # Two separate include files (netcdf2.inc , netcdf.inc) here > INCS=-I/usr/local/include > CDL=test.cdl > DATA=test.nc > RM=/bin/rm > CF=f90 > FFLAGS=-g -Rabcs -ei -Ca > OBJNAMEFLAG=-b > #CF=cf77 > #FFLAGS=-g -Wf"-Rabc -ei -ca" > #OBJNAMEFLAG=-Wf-b > X > all: ${PROGRAMS} ${DATA} > X @ echo "With netCDF 2.4.3" > X ./${PROG2} > X @ echo "With netCDF 3.3.1" > X ./${PROG3} > ${PROG2}: ${OBJ2} > X ${CF} -o$@ ${LIB2} ${OBJ2} > ${PROG3}: ${OBJ3} > X ${CF} -o$@ ${LIB3} ${OBJ3} > ${DATA}: ${CDL} > X ncgen -b ${CDL} > ${OBJ2}: ${SRCS} > X ${CF} -c ${OBJNAMEFLAG}$@ ${FFLAGS} -DNETCDFVERSION=2 ${INCS} ${SRCS} > ${OBJ3}: ${SRCS} > X ${CF} -c ${OBJNAMEFLAG}$@ ${FFLAGS} -DNETCDFVERSION=3 ${INCS} ${SRCS} > clean: > X ${RM} ${DATA} ${OBJS} ${PROGRAMS} *.T > SHAR_EOF > $shar_touch -am 0818105797 'ncerr/Makefile' && > chmod 0600 'ncerr/Makefile' || > $echo 'restore of' 'ncerr/Makefile' 'failed' > if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ > && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then > md5sum -c << SHAR_EOF >/dev/null 2>&1 \ > || $echo 'ncerr/Makefile:' 'MD5 check failed' > 8e75dd307fbfcc71424340c1db34b00b ncerr/Makefile > SHAR_EOF > else > shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ncerr/Makefile'`" > test 1015 -eq "$shar_count" || > $echo 'ncerr/Makefile:' 'original size' '1015,' 'current size' > "$shar_count!" > fi > fi > # ============= ncerr/nctest.F ============== > if test -f 'ncerr/nctest.F' && test "$first_param" != -c; then > $echo 'x -' SKIPPING 'ncerr/nctest.F' '(file already exists)' > else > $echo 'x -' extracting 'ncerr/nctest.F' '(text)' > sed 's/^X//' << 'SHAR_EOF' > 'ncerr/nctest.F' && > X program nctest > X > ! Illustrate error in Cray netcdf3 library > ! The input file test.nc is generated from the following CDL file > X > ! netcdf test { > ! dimensions: > ! x = 3 ; > ! variables: > ! float x(x) ; > ! short a(x) ; > ! data: > ! x = 1., 2., 3. ; > ! a = -1, 0, 1 ; > ! } > X > X implicit none > #if NETCDFVERSION == 3 > X include 'netcdf.inc' > #else > X include 'netcdf2.inc' > #endif > X integer n, start, count > X parameter ( n = 3 ) > X integer*2 a(n) > X integer ncid, vid, ierr > X > X ncid = ncopn('test.nc', NCNOWRIT, ierr) > X if ( ierr .ne. 0 ) then > X print*, ' Error ', ierr > X stop > X end if > X vid = ncvid ( ncid, 'a', ierr ) > X if ( ierr .ne. 0 ) then > X print*, ' Error ', ierr > X stop > X end if > X > X start = 1 > X count = 3 > X > X call ncvgt( ncid, vid, start, count, a, ierr) > X if ( ierr .ne. 0 ) then > X print*, ' Error ', ierr > X stop > X end if > X > X print*, ' A ', a > X end > SHAR_EOF > $shar_touch -am 0815120397 'ncerr/nctest.F' && > chmod 0600 'ncerr/nctest.F' || > $echo 'restore of' 'ncerr/nctest.F' 'failed' > if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ > && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then > md5sum -c << SHAR_EOF >/dev/null 2>&1 \ > || $echo 'ncerr/nctest.F:' 'MD5 check failed' > c0c0fa87ace0a20b77e2fc0321903b10 ncerr/nctest.F > SHAR_EOF > else > shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ncerr/nctest.F'`" > test 983 -eq "$shar_count" || > $echo 'ncerr/nctest.F:' 'original size' '983,' 'current size' > "$shar_count!" > fi > fi > # ============= ncerr/test.cdl ============== > if test -f 'ncerr/test.cdl' && test "$first_param" != -c; then > $echo 'x -' SKIPPING 'ncerr/test.cdl' '(file already exists)' > else > $echo 'x -' extracting 'ncerr/test.cdl' '(text)' > sed 's/^X//' << 'SHAR_EOF' > 'ncerr/test.cdl' && > netcdf test { > dimensions: > X x = 3 ; > variables: > X float x(x) ; > X short a(x) ; > data: > X x = 1., 2., 3. ; > X a = -1, 0, 1 ; > } > SHAR_EOF > $shar_touch -am 0801103097 'ncerr/test.cdl' && > chmod 0600 'ncerr/test.cdl' || > $echo 'restore of' 'ncerr/test.cdl' 'failed' > if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ > && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then > md5sum -c << SHAR_EOF >/dev/null 2>&1 \ > || $echo 'ncerr/test.cdl:' 'MD5 check failed' > 0c68438eee352bfc0e1dcc651f215fc8 ncerr/test.cdl > SHAR_EOF > else > shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ncerr/test.cdl'`" > test 139 -eq "$shar_count" || > $echo 'ncerr/test.cdl:' 'original size' '139,' 'current size' > "$shar_count!" > fi > fi > rm -fr _sh00869 > exit 0 Great! UCAR got rid of it's Y-MP so we can't investigate your problem here. :-( Would you do me a favor and send me the output from executing the netCDF-3 configure script. It should help. -------- Steve Emmerson <http://www.unidata.ucar.edu>