[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
970804: netCDF-3 compatability issues
- Subject: 970804: netCDF-3 compatability issues
- Date: Mon, 04 Aug 97 14:25:47 -0600
Mark,
[Russ forwarded your problem to me.]
>Date: 04 Aug 1997 10:51:22 -0600
>From: Mark Borges <address@hidden>
>Organization: CIRES, University of Colorado
>To: Russ Rew <address@hidden>
>Subject: Re: netCDF-3 compatability issues
>Keywords: 199708041651.KAA10971
In the above message, you wrote:
> I'm afraid this apparently came up short, too.
>
> The attached stub program, stub.F, compiled against v3 libraries,
> gives a different result than when compiled against v2
> libraries. Unless I'm missing some global flag that turns on v2
> compatibility mode...
>
> ----------------------------------------
> ### Version 3 include file and library
> $ f77 -I/usr/local/include stub.F -o stub -lnetcdf
> /tmp/cpp.09455.0.f:
> MAIN:
> $ ldd ./stub
> libnetcdf.so => /usr/local/lib/libnetcdf.so
> libF77.so.3 => /usr/local/sun/SUNWspro/lib/libF77.so.3
> libc.so.1 => /usr/lib/libc.so.1
> libdl.so.1 => /usr/lib/libdl.so.1
> $ ./stub
> stub
> iErr= -51
> NCENOTNC= 19
>
> ### Version 2 include file and library
> $ f77 -I/scratch/mdb/netcdf-2.4-backup/include stub.F -o stub.old -R
> /usr/lib -lnetcdf
> /tmp/cpp.09647.0.f:
> MAIN:
> $ ldd ./stub
> libF77.so.3 => /usr/local/sun/SUNWspro/lib/libF77.so.3
> libc.so.1 => /usr/lib/libc.so.1
> libdl.so.1 => /usr/lib/libdl.so.1
> $ ldd ./stub.old
> libnetcdf.so => /usr/lib/libnetcdf.so
> libF77.so.3 => /usr/lib/libF77.so.3
> libc.so.1 => /usr/lib/libc.so.1
> libdl.so.1 => /usr/lib/libdl.so.1
> $ ./stub.old
> stub
> iErr= 19
> NCENOTNC= 19
> $
>
> ----------------------------------------
>
> i.e., the RCODE (iErr in the above) returned from NCOPN() in version 3
> does not agree with the RCODE returned in version 2.
>
>
> --Multipart_Mon_Aug__4_10:50:47_1997-1
> Content-Type: application/octet-stream
> Content-Disposition: attachment; filename="stub.F"
> Content-Transfer-Encoding: 7bit
>
> c stub.f -
> c
> character*80 chWork
> c .. the system-wide include file ..
> #include <netcdf.inc>
>
> read(*,'(a)') chWork
> c .. open binary file, which can either be MDB or netCDF format ..
> call NCGOPT(iNCerr)
> call NCPOPT(0)
> ncID=NCOPN(chWork,NCNOWRIT,iErr)
> call NCPOPT(iNCerr)
>
> print*,'iErr=',iErr
> print*,'NCENOTNC=',NCENOTNC
> stop
> end
>
> --Multipart_Mon_Aug__4_10:50:47_1997-1--
You're correct, the netCDF version 3 Fortran API isn't quite source-code
compatible with the version 2 API. I've modified the values of the
Fortran error-code parameters in the file "netcdf.inc" to reflect their
netCDF version 3 values. This should make the error codes source-level
compatible. The modified codes passes our tests.
This modification will be part of the next release.
Would you please apply the enclosed patch to the file
"fortran/netcdf.inc" in your netCDF distribution and let me know of any
problems.
--------
Steve Emmerson <http://www.unidata.ucar.edu>
--------Begin patch
*** /upc/netcdf/src/fortran/netcdf.inc Wed Jun 4 08:40:10 1997
--- upc/netcdf-3/src/fortran/netcdf.inc Mon Aug 4 13:28:45 1997
***************
*** 1188,1236 ****
!
! No Error
! PARAMETER(NCNOERR = 0)
! Not a netcdf id
! PARAMETER(NCEBADID = 1)
! Too many netcdfs open
! PARAMETER(NCENFILE = 2)
! netcdf file exists && NCNOCLOB
! PARAMETER(NCEEXIST = 3)
! Invalid Argument
! PARAMETER(NCEINVAL = 4)
! Write to read only
! PARAMETER(NCEPERM = 5)
! Operation not allowed in data mode
! PARAMETER(NCENOTIN = 6)
! Operation not allowed in define mode
! PARAMETER(NCEINDEF = 7)
! Coordinates out of Domain
! PARAMETER(NCECOORD = 8)
! MAXNCDIMS exceeded
! PARAMETER(NCEMAXDS = 9)
! String match to name in use
! PARAMETER(NCENAME = 10)
! Attribute not found
! PARAMETER(NCENOATT = 11)
! MAXNCATTRS exceeded
! PARAMETER(NCEMAXAT = 12)
! Not a netcdf data type
! PARAMETER(NCEBADTY = 13)
! Invalid dimension id
! PARAMETER(NCEBADD = 14)
! NCUNLIMITED in the wrong index
! PARAMETER(NCEUNLIM = 15)
! MAXNCVARS exceeded
! PARAMETER(NCEMAXVS = 16)
! Variable not found
! PARAMETER(NCENOTVR = 17)
! Action prohibited on NCGLOBAL varid
! PARAMETER(NCEGLOB = 18)
! Not a netcdf file
! PARAMETER(NCENOTNC = 19)
! PARAMETER(NCESTS = 20)
! PARAMETER (NCENTOOL = 21)
PARAMETER(NCFOOBAR = 32)
! PARAMETER(NCSYSERR = -1)
!
! Global options variable. Used to determine behavior of error handler.
--- 1188,1236 ----
!
! No Error
! PARAMETER(NCNOERR = NF_NOERR)
! Not a netcdf id
! PARAMETER(NCEBADID = NF_EBADID)
! Too many netcdfs open
! PARAMETER(NCENFILE = -31) ! NC_SYSERR
! netcdf file exists && NCNOCLOB
! PARAMETER(NCEEXIST = NF_EEXIST)
! Invalid Argument
! PARAMETER(NCEINVAL = NF_EINVAL)
! Write to read only
! PARAMETER(NCEPERM = NF_EPERM)
! Operation not allowed in data mode
! PARAMETER(NCENOTIN = NF_ENOTINDEFINE )
! Operation not allowed in define mode
! PARAMETER(NCEINDEF = NF_EINDEFINE)
! Coordinates out of Domain
! PARAMETER(NCECOORD = NF_EINVALCOORDS)
! MAXNCDIMS exceeded
! PARAMETER(NCEMAXDS = NF_EMAXDIMS)
! String match to name in use
! PARAMETER(NCENAME = NF_ENAMEINUSE)
! Attribute not found
! PARAMETER(NCENOATT = NF_ENOTATT)
! MAXNCATTRS exceeded
! PARAMETER(NCEMAXAT = NF_EMAXATTS)
! Not a netcdf data type
! PARAMETER(NCEBADTY = NF_EBADTYPE)
! Invalid dimension id
! PARAMETER(NCEBADD = NF_EBADDIM)
! NCUNLIMITED in the wrong index
! PARAMETER(NCEUNLIM = NF_EUNLIMPOS)
! MAXNCVARS exceeded
! PARAMETER(NCEMAXVS = NF_EMAXVARS)
! Variable not found
! PARAMETER(NCENOTVR = NF_ENOTVAR)
! Action prohibited on NCGLOBAL varid
! PARAMETER(NCEGLOB = NF_EGLOBAL)
! Not a netcdf file
! PARAMETER(NCENOTNC = NF_ENOTNC)
! PARAMETER(NCESTS = NF_ESTS)
! PARAMETER (NCENTOOL = NF_EMAXNAME)
PARAMETER(NCFOOBAR = 32)
! PARAMETER(NCSYSERR = -31)
!
! Global options variable. Used to determine behavior of error handler.