[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 19981230: Integer*2 and NC_short



>To: "Support Unidata" <address@hidden>
>From: "Steve Mauget" <address@hidden>
>Subject: Integer*2 and NC_short
>Organization: USDA/ARS
>Keywords: 199812301538.IAA00805

Hi Steve,

>       I have downloaded some sea-surface temperature data stored as 2-byte
> signed integers in netcdf format, but am having trouble reading it. I'm using
> version 3.3.1 on an SGI indigo 2 running Irix 6.5, and all of this is being
> attempted via a NAG f90 compiler. Problem is, when I attempt an NCVGT
> call to retrieve a 2-D slice of this data....
> 
> 
> NCVGT (ncid,ssta_id,start,counts,ssta,ierr)
> where ssta(ilat,ilon) is defined as integer*2 in the calling program....
> 
> 
> I get ----"Inconsistent data type for arg 5 in call to NCVGT". I know the data
> is signed I2 because an NCVINQ call retrieves vartyp = 3 (NC_Short), and
> through eyeballing the null values (32767) in an ncdump. This problem appears
> to be in the compiler-netcdf interface, because declaring and using Integer*2
> arrays in program works fine as long as I don't try to access them from a
> netcdf file.
> 
> 
> I browsed through the support e-mail archive (NC_short /  NC_short;f90 /
> NC_short;NAG) but couldn't find anything that seemed directly relevant to this
> problem. Did stumble across a similar(?) problem with someone trying to read
> NC_double on a Cray (../cgi-bin/mfs/70/3052?56#mfs), but when I looked at my
> configure.log (included below) it seems as if my installation checks out re:
> Integer*2 and NC_Short equivalences.
> 
>  At least it looks that way to me....
> 
> checking for FORTRAN "byte"... no
> checking for FORTRAN "integer*1"... yes  
> checking for FORTRAN "integer*2"... yes  <<<<<<<
> checking if FORTRAN "integer*1" is C "signed char"... yes
> checking if FORTRAN "integer*1" is C "short"... no
> checking if FORTRAN "integer*1" is C "int"... no
> checking if FORTRAN "integer*2" is C "short"... yes <<<<<<<
> checking if FORTRAN "integer*2" is C "int"... no
> checking if FORTRAN "integer" is C "int"... yes
> checking if FORTRAN "real" is C "float"... yes
> checking if FORTRAN "doubleprecision" is C "double"... yes
> checking for FORTRAN-equivalent to netCDF "byte"... integer*1
> checking for FORTRAN-equivalent to netCDF "short"... integer*2 <<<<<<<<<
> 
> 
> One posiible problem(?). Since I installed netcdf the OS as been upgraded (6.3
> to 6.5) and the C compiler has 
> been upgraded to MipsPro 7.2.1. As a result, this configure.log may be
> obsolete. I don't recall though whether or not I was ever able to read I*2
> from netcdf as I think this is the first time I've tried. Would sure
> appreciate any help or advice you folks might be able to offer on this one.

In trying to duplicate the problem, I rebuilt netCDF 3.3.1 on an IRIX
6.5 platform using /bin/cc and /bin/f90 compilers.  After running the
configure script and "make all", I ran "make test" and everything
worked fine.  In particular, the test of reading netCDF 16-bit data
into an array of integer*2 compiled and worked fine, from the
netcdf/src/fortran/ftest.F program.  This program, which tests all the
functions in the netCDF 2 Fortran interface that you are using
includes the following (I've excerpted only the relevant code):

  !    
  !     subroutine to test ncvgt and ncvgtc
  !
        subroutine tncvgt(cdfname)
  #include "netcdf.inc"
 ...
  !     arrays of data values to be read
 ...
        NCSHORT_T sarray(times), shval(times)
 ...
              call ncvgt (ncid, m, start, count, sarray, iret)

where the macro NCSHORT_T is defined in the include file nfconfig.inc
as "integer*2":

  #   define NCSHORT_T integer*2

My guess is that what you are seeing is a problem with using the NAG
f90 compiler in /usr/local/bin/f90, rather than the bundled f90
compiler in /bin/f90.  Since we don't have access to the NAG compiler
for IRIX platforms, I can't test this.  However, you can verify
whether this is the problem by running "make test" from the
"netcdf/src" directory to see if it works.  If not, you might try
rerunning "make test FC=/bin/f90" if you've got access to the /bin/f90
compiler and see if that solves the problem.

Another possible solution would be to get netCDF version 3.4 from

  ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.Z

and see if any of the bug fixes in that later version fix the
problem.

I'm also CC:ing Steve Emmerson on this, in case he's seen something
similar or can spot something in the appended configure or make output
you've sent that I missed ...

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu


>              ######UNAME - ENV - CONFIGURE.LOG - MAKE.LOG########
> 
> # Output of uname -a
> #
> IRIX lbk155 6.5 05190003 IP22
> #
> # Output of environment...
> #
> _=/usr/sbin/xwsh
> LANG=C
> PATH=.:/usr/local/bin:/usr/local/lib/f90:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X11:/usr/local/lib/grads:/usr/local/lib/grads/xample:/usr/etc:/usr/lib:/lib:/usr/local/lib/groff:/usr/freeware/bin
> NOMSGLABEL=1
> XUSERFILESEARCHPATH=/usr/people/mauget/.desktop-lbk155/%N:/usr/people/mauget/%N:/usr/people/mauget/.desktop-lbk155/0.0/%N
> LOGNAME=mauget
> MAIL=/usr/mail/mauget
> USER=mauget
> MSGVERB=text:action
> LASTLOGIN=Last login: Tue Dec 29 10:40:08 PST 1998 on :0
> DISPLAY=:0.0
> SHELL=/bin/csh
> HOME=/usr/people/mauget
> TERM=iris-ansi
> PWD=/temp/temp/netcdf-3.3.1/src
> TZ=PST8PDT
> WINEDITOR=/usr/sbin/jot -f
> NOMSGSEVERITY=1
> WINDOWID=71303172
> PS1=# 
> #
> # Configure.log
> #
> creating cache ./config.cache
> checking for m4... m4
> checking user-defined C compiler "/bin/c89"
> checking C compiler... works
> checking how to make dependencies... cc -M
> configure: warning: Empty CXX variable
> configure: warning: The C++ interface will not be built
> checking how to run the C preprocessor... /bin/c89 -E
> checking user-defined FORTRAN compiler "/usr/local/bin/f90"... works
> checking if FORTRAN compiler handles *.F files... no
> checking for FORTRAN preprocessor... /bin/c89 -E
> checking for C-equivalent to FORTRAN routine "SUB"... sub_
> checking for FORTRAN "byte"... no
> checking for FORTRAN "integer*1"... yes
> checking for FORTRAN "integer*2"... yes
> checking if FORTRAN "integer*1" is C "signed char"... yes
> checking if FORTRAN "integer*1" is C "short"... no
> checking if FORTRAN "integer*1" is C "int"... no
> checking if FORTRAN "integer*2" is C "short"... yes
> checking if FORTRAN "integer*2" is C "int"... no
> checking if FORTRAN "integer" is C "int"... yes
> checking if FORTRAN "real" is C "float"... yes
> checking if FORTRAN "doubleprecision" is C "double"... yes
> checking for FORTRAN-equivalent to netCDF "byte"... integer*1
> checking for FORTRAN-equivalent to netCDF "short"... integer*2
> checking for math library
> checking for -lc... no
> checking for -lm... yes
> checking for ar... ar
> checking for ranlib... :
> checking for stdlib.h... yes
> checking for sys/types.h... yes
> checking for strerror... yes
> checking for ftruncate... yes
> checking for st_blksize in struct stat... yes
> checking whether cross-compiling... no
> checking for IEEE floating point format... yes
> checking for ANSI C header files... yes
> checking for size_t... yes
> checking for off_t... yes
> checking for ssize_t... yes
> checking for ptrdiff_t... yes
> checking for uchar... no
> checking whether char is unsigned... yes
> checking whether byte ordering is bigendian... yes
> checking size of short... 2
> checking size of int... 4
> checking size of long... 4
> checking size of float... 4
> checking size of double... 8
> checking size of off_t... 4
> checking size of size_t... 4
> checking for manual-page index command... 
> checking binary distribution directory... /home/ftp/pub/binary/dummy_system
> updating cache ./config.cache
> creating ./config.status
> creating macros.make
> udcreating fortran/netcdf-cpp.inc
> creating libsrc/ncconfig.h
> #
> # 'All.log' (=Make.log?)
> #
> 
> Making `all' in directory /temp/netcdf-3.3.1/src/libsrc
> 
>       /bin/c89 -c -g -I.   attr.c
>       /bin/c89 -c -g -I.   dim.c
>       /bin/c89 -c -g -I.   error.c
>       /bin/c89 -c -g -I.   -DVERSION=`cat ../VERSION` libvers.c
>       /bin/c89 -c -g -I.   nc.c
>       /bin/c89 -c -g -I.   ncio.c
>       /bin/c89 -c -g -I.   ncx.c
>       /bin/c89 -c -g -I.   putget.c
>       /bin/c89 -c -g -I.   string.c
>       /bin/c89 -c -g -I.   v1hpg.c
>       /bin/c89 -c -g -I.   v2i.c
>       /bin/c89 -c -g -I.   var.c
>       ar cru   libnetcdf.a attr.o  dim.o  error.o  libvers.o  nc.o  ncio.o  
> ncx.o 
> putget.o  string.o  v1hpg.o  v2i.o  var.o
>       : libnetcdf.a
> 
> Returning to directory /temp/netcdf-3.3.1/src
> 
> 
> Making `all' in directory /temp/netcdf-3.3.1/src/fortran
> 
>       /bin/c89 -c -g -I../libsrc   fort-attio.c
>       /bin/c89 -c -g -I../libsrc   fort-control.c
>       /bin/c89 -c -g -I../libsrc   fort-dim.c
>       /bin/c89 -c -g -I../libsrc   fort-genatt.c
>       /bin/c89 -c -g -I../libsrc   fort-geninq.c
>       /bin/c89 -c -g -I../libsrc   fort-genvar.c
>       /bin/c89 -c -g -I../libsrc   fort-lib.c
>       /bin/c89 -c -g -I../libsrc   fort-misc.c
>       /bin/c89 -c -g -I../libsrc   fort-v2compat.c
>       /bin/c89 -c -g -I../libsrc   fort-vario.c
>       /bin/c89 -c -g -I../libsrc   fort-var1io.c
>       /bin/c89 -c -g -I../libsrc   fort-varaio.c
>       /bin/c89 -c -g -I../libsrc   fort-varmio.c
>       /bin/c89 -c -g -I../libsrc   fort-varsio.c
>       ar cru   ../libsrc/libnetcdf.a fort-attio.o      fort-control.o  
> fort-dim.o     
> fort-genatt.o  fort-geninq.o   fort-genvar.o   fort-lib.o      fort-misc.o    
> fort-v2compat.o        fort-vario.o    fort-var1io.o   fort-varaio.o   
> fort-varmio.o  
> fort-varsio.o
>       : ../libsrc/libnetcdf.a
> 
> Returning to directory /temp/netcdf-3.3.1/src
> 
> 
> Making `all' in directory /temp/netcdf-3.3.1/src/ncdump
> 
>       /bin/c89 -c -g -I../libsrc   ncdump.c
>       /bin/c89 -c -g -I../libsrc   vardata.c
>       /bin/c89 -c -g -I../libsrc   dumplib.c
>       /bin/c89 -o ncdump -g  ncdump.o vardata.o dumplib.o -L../libsrc 
> -lnetcdf  
> 
> Returning to directory /temp/netcdf-3.3.1/src
> 
> 
> Making `all' in directory /temp/netcdf-3.3.1/src/ncgen
> 
>       /bin/c89 -c -g -I../libsrc -I.   main.c
>       /bin/c89 -c -g -I../libsrc -I.   load.c
>       /bin/c89 -c -g -I../libsrc -I.   ncgentab.c
>       /bin/c89 -c -g -I../libsrc -I.   escapes.c
>       /bin/c89 -c -g -I../libsrc -I.   getfill.c
>       /bin/c89 -c -g -I../libsrc -I.   init.c
>       /bin/c89 -c -g -I../libsrc -I.   genlib.c
>       /bin/c89 -o ncgen -g  main.o load.o ncgentab.o escapes.o  getfill.o 
> init.o
> genlib.o ../libsrc/libnetcdf.a  
> 
> Returning to directory /temp/netcdf-3.3.1/src
> 
> Not making `cxx/all' because no C++ compiler