Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error in netCDF function

Lamine06F
Novice
1,501 Views

Hello,

I think that I have recently link netCDF to my Fortran program (here is the link of the discussion https://community.intel.com/t5/Intel-Fortran-Compiler/Include-netCDF-in-my-Fortran-projet/m-p/1531893#M168548). But here another challenge I have encountered "error #6784: The number of actual arguments cannot be greater than the number of dummy arguments. [NF90_OPEN]" after loading a file in my program, which is something bizarre since netCDF works fine. In [NF90_OPEN], I have passed 5 arguments which is less than the number of arguments that can be passed in [NF90_OPEN], read section 2.6 of this document https://docs.unidata.ucar.edu/netcdf-fortran/current/f90_datasets.html).

Can someone help me figure it out.

@mfinnis 

here is a screenshot.

Lamine06F_0-1697792523840.png

 

 

0 Kudos
11 Replies
mfinnis
New Contributor II
1,489 Views

Regardless of the documentation, if you look at the library souce code the interface of nf90_open is

function nf90_open(path, mode, ncid, chunksize)
  character (len = *), intent(in   ) :: path
  integer,             intent(in   ) :: mode
  integer,             intent(  out) :: ncid
  integer, optional,   intent(inout) :: chunksize
  integer                            :: nf90_open

 

0 Kudos
Lamine06F
Novice
1,471 Views

So, where can I find this function (probably in NC4F.sln) and change it is possible?

 

0 Kudos
mfinnis
New Contributor II
1,458 Views

Search for nf90_open in the solution but, no, it is not possible to change it - not in any meaningful way. I imagine the version you have is dictated by the version of netCDF binaries you have installed when configuring and generating the VS solution in CMake. I would try installing a dfferent version of https://downloads.unidata.ucar.edu/netcdf/ and reconfiguring and building netcdff but it's not something I have done.

0 Kudos
Lamine06F
Novice
1,363 Views

Ok, I will be waiting for you.

0 Kudos
mfinnis
New Contributor II
1,348 Views

I'm afraid you have missunderstood me. I was suggesting that you might try installing different netCDF libraries before rebuilding netcdff. Though, if it is not essential for you to read or write netCDF-4/HDF5 format files or to use parallel i/o I'd be inclined to stick with what you have.

 

0 Kudos
Lamine06F
Novice
1,241 Views

Hello @mfinnis ,

I resolved it after trying different combinations.

Thank really for your help.

0 Kudos
Vipin_Singh1
Moderator
1,455 Views

Hi Diallo, we are routing your query to the respective team for the further help. They will get back to you as soon as possible.


0 Kudos
Dave_Allured
New Contributor I
1,277 Views

@Lamine06F, it appears you are linking to the wrong version of Netcdf.  nf90_open has 4 arguments in netcdf-3, and 9 arguments in netcdf-4.  Your error message suggests you are linking to netcdf-3.  Please change to a recent version of netcdf-4.

0 Kudos
JohnNichols
Valued Contributor III
1,267 Views

@Dave_Allured , your last post brought a smile to my mind, and my face probably, the ability to count is best taught in preschool and if done properly has a 50% reduction in overall incarceration rates.  I listened to a lecture on this last week. I had counted the arguments in the posted pictures and your answer seems to provide the reason. 

I love programmers who make changes to standard functions like open between releases. A classic example is the binary and other data now routinely stored in DXF files, which used to be easy to replicate in Fortran, but is now tedious. 

 

As Alan Perlis once said

I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customers got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun.

and also

Every program has (at least) two purposes: the one for which it was written and another for which it wasn't.

 

The one who finds the second usually makes the money. 

0 Kudos
Dave_Allured
New Contributor I
1,253 Views

@JohnNichols, thank you.  The OP's problem is excusable.  Their counting analysis was correct and insightful.  The real problem was more subtle; API change and multiple versions lurking under the bridge.  A nice troll trap for novices.  

Mfinnis's mistake was also understandable, with insufficiently labeled function prototypes plastered all over the internets.  

I might not be a very good programmer.  I am still waiting for that second purpose and the accompanying money.

0 Kudos
JohnNichols
Valued Contributor III
1,225 Views

@Dave_Allured , enjoyed the comments. 

 

The real problem is the money that is made from standard programs that stop growing and just charge a lot.  

The beauty of Fortran is we can avoid this pit in the road, because one can develop one's own code.  

Of course if you work at a large place, the IT will limit your options.  

It is not that IT are bad, merely challenging.  

 

 

0 Kudos
Reply