[netcdfgroup] How to inquire JUST the number of groups in a netcdf4 file?

Hello,

I use the Fortran90 interface to netCDF and I want to inquire about the number 
of groups in a file so I can allocate various bits appropriately.

The nf90_inq_grps() function interface is:

  function nf90_inq_grps(ncid, numgrps, ncids)
    integer, intent(in) :: ncid
    integer, intent(out) :: numgrps
    integer, dimension(:), intent(out) :: ncids
    integer :: nf90_inq_grps

    nf90_inq_grps = nf_inq_grps(ncid, numgrps, ncids)
  end function nf90_inq_grps

What I want to do is to get the value returned in "numgrps" so I can then 
allocate an array inwhich I can hold the "ncids" values, like this:

nf90_stat = nf90_inq_grps(ncid, numgrps=n_groups)
allocate(group_ids(n_groups))
nf90_stat = nf90_inq_grps(ncid, ncids=group_ids)

I can't do this since neither the numgrps nor ncids dummy arguments are optional

My first question is: Why aren't these dummy arguments optional?

My real question is: How do I do the above with the current Fortran90 interface?

Have I missed something fundamental here? Is this just an oversight in the 
Fortran90 interface (i.e. just a f90-style layer on top of the f77 one), or is 
it because no-one has gotten around to doing it yet? (I guess I'm volunteering 
if it's the latter)

cheers,

paulv


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