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

access to netCDF fill values from Fortran



Peggy,

This is weird, but it looks like the following declarations and COMMON block
statement were left out of netcdf.inc, and that you're the first to report
it:

      DOUBLE PRECISION FILDOUB
      INTEGER FILLONG
      REAL FILFLOAT
      INTEGER*2 FILSHORT
      INTEGER*1 FILCHAR,FILBYTE
      COMMON /ncfils/ FILDOUB,FILLONG,FILFLOAT,FILSHORT,FILCHAR,FILBYTE

actually, the INTEGER*1 and INTEGER*2 declarations should be whatever is
appropriate for the platform, and hence should be generated at build time
the same way the ftest.f test program is generated from the ftest.src file
using the macros BYTE_INT for INTEGER*1 and SHORT_INT for INTEGER*2.

It was intended that this be in netcdf.inc, but apparently it's not and no
one has noticed.

I have just fixed this in the sources, so it will be in the next release,
but it looks like we should also add tests for the fill-value stuff from
Fortran to make sure this works on all the platforms.

I did find the following note in netcdf-support archives:

  >    I have been having trouble including the defined externals for
  > netcdf on a CRAY here at Los Alamos.  The systems guys looked into it,
  > and it appears that netcdf.inc is out-of-sync with the 2.3 release, 
  > since the defined externals don't match with what's in the C-version of the
  > file netcdf.h  Is there a patched version of the include file for Fortran?

  We tested the platform-independent netcdf.inc that comes with netCDF 2.3.2
  on a Cray YMP running UNICOS 6.1.6, and it seemed to work OK.  However, our
  testing didn't include doing anything with the default fill values that used
  to be defined in platform-specific ways in netcdf.inc.  These are now
  defined only in the C layer, but you can access them from Fortran with the
  /ncfils/ common block:

        DOUBLE PRECISION FILDOUB
        INTEGER FILLONG
        REAL FILFLOAT
        INTEGER*2 FILSHORT
        INTEGER*1 FILCHAR,FILBYTE
        COMMON /ncfils/ FILDOUB,FILLONG,FILFLOAT,FILSHORT,FILCHAR,FILBYTE

  These statements should arguably be in netcdf.inc to always give Fortran
  programs access to the predefined default fill values.  If adding these
  statements to netcdf.inc doesn't fix the problem, please send a more detailed
  description of the problem symptoms to address@hidden.  (If the
  nonstandard INTEGER*2 and INTEGER*1 declarations are unacceptable to your
  FORTRAN compiler, you may have to define the FILSHORT, FILCHAR, and FILBYTE
  values with a PARAMETER statement instead.)