NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdfgroup] Fortran90 interface

Karsten Bolding wrote:
Hi Dave

On Tue, Mar 31, 2009 at 11:06:09 -0600, Dave Allured wrote:
Karsten,

That function has five arguments. Your function call has six arguments. I believe this will cause that exact error message.

You are right I should have checked that.

I actually find it a pitty that there is a difference between the F77
and F90 argument list for this function.

I started using the F90 interface several years ago. I soon got used to it and decided it was superior to the F77 interface in several ways. Most significant is combining many obscure function call types into single generic functions.

I used to allocate and array like:
integer :: dims(4)

that could be re-used like:
dims(1) = lon_dim
iret = nf_def_var(ncid,'lon',NF_REAL,1,dims,lon_id)

dims(1) = lon_dim
dims(2) = lat_dim
dims(3) = time_dim
iret = nf_def_var(ncid,'sst',NF_REAL,3,dims, sst_id)
call check_err(iret)

i.e. the number of dimensiosn for a specific variable is given
explicitly and not determined by the size of the dimids vector.

Instead I now have to do like:
integer :: dims_3(3)
integer :: dims_4(4)

That's not too bad. Frequently I use things like dims_sst, dims_precip, etc. This does not usually overload memory. <g>

Alternatively you could try this. The arg list is only slightly longer than the F77 args. The dim number is merely transposed into the range expression.

iret = nf90_def_var(ncid,'sst',NF90_FLOAT, dims(1:3), sst_id)

--Dave

This is a Fortran 90 thing. When a generic interface is used, any mismatch in number of arguments, arg type, or dimensionality can trigger a "no matching specific function" error.

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/psd1/


Karsten




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