[netcdfgroup] What is the "standard" way to use NetCDF from Fortran 90?

Hi!

I wanted to start using binary I/O for my model code, being written in Fortran 
90 (95, 2003 in parts).
Now, having used NetCDF before (with C++, though writing my own set of wrapper 
classes over the C api), I naturally wanted to use it here, too.

I first started with the include file that contains the f77 interface, then 
switched to the netcdf module as that's what is actually described in the 
NetCDF Fortran 90 guide (the nf90_ symbols).
It offers some nice convenience with overloading functions for the different 
types, and, apart from my trouble realizing that writing text array attributes 
won't fly (I faintly remember that I circumvented that one before, in C), it 
works fine.

I had the test code runnning on a GNU/Linux system with the gfortran compiler 
corresponding to the GCC that compiled the whole system (well, at least NetCDF 
for sure), so it worked fine to use /usr/include/netcdf.mod .
But now I am on a different system where we work with intel fortran, or even 
with gfortran, which seems to be a different gfortran than that that compiled 
netcdf a long time ago.

Problem: The .mod file with the Fortran 90 interface is not portable across 
compilers, architectures, or even different releases of the same compiler.
In a related way, this came up in fedora packaging, and subsequently on the 
gfortran mailing list:
http://gcc.gnu.org/ml/fortran/2007-10/msg00304.html

So... my question is: What should I do to use the Fortran 90 interface of 
NetCDF?
Seems like the only safe way is to include a copy of the source of that module 
from NetCDF sources and compile that together with my other code. Is that The 
Right Way(tm)?
Or, should one rather have the OS distribution install the fortran module 
source in /usr/include (or some other place where you can pull in the source 
from)?

What is the NetCDF folks' angle on this?


Alrighty then,

Thomas.

-- 
Dipl. Phys. Thomas Orgis
Atmospheric Modelling
Alfred-Wegener-Institute for Polar and Marine Research



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: