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

[netCDF #LNB-396427]: Help in the netcdf library



Hi Edson,

You have commented out the Fortran statement in the example program

      include 'netcdf.inc'

but this statement is necessary to define the value of constants such as 
NF_FLOAT, which specifies the type of the variable as 32-bit real.  Without the 
include statement, NF_FLOAT is 0, which does not correspond to any netCDF type, 
so you get the error

  Error: 4
  Not a netCDF data type or _FillValue type mismatch

All the following errors are a result of this problem.    

The file netcdf.inc should be installed in /usr/local/netcdf/include/  so that 
the f77 compiler can find it when you run the command

  f77 -c -I/usr/local/netcdf/include writenc.f

Using  /usr/local/netcdf/include/netcdf.inc the compiler will see the 
statements 
       integer nf_float
and
       parameter (nf_float = 5)
which will give the value 5 to NF_FLOAT instead of 0, and then your example 
program should work.

Similarly, your original program did not contain the necessary
 
      include 'netcdf.inc'

statement, so the constants NF_GLOBAL, NF_CLOBBER, NF_NOERR, NF_REAL, NF_INT,  
were not properly defined and were all given the value 0 in your program, 
though many of these have nonzero values as defined in the netcdf.inc include 
file.  

When you installed netCDF, running "make install" should have installed tthe 
netcdf.inc file either in /usr/local/include or wherever you specified with the 
--prefix argument to the configure script.  If it's not there, you can copy 
netcdf.inc from the source distribution fortran/netcdf.inc to 
/usr/local/include/netcdf.inc before compiling your netCDF program.

It's possible that your read program worked OK without netcdf.inc becasue you 
didn't need any of these constants.

--Russ
                      


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



Ticket Details
===================
Ticket ID: LNB-396427
Department: Support netCDF
Priority: Urgent
Status: Closed