ncdinq question

Hello anyone,

I was wondering if anyone can help me with a problem I've been  
experiencing while trying to use ncdinq.  Here is my code :

      include '/usr/local/src/netcdf/fortran/netcdf.inc'

      parameter (ndims=1)
c      parameter (maxncnam = 36)

      integer cdfid, rcode, start(ndims), count(ndims)
      integer pid, tid, dpid, rhid, timeid, times

      character file*30, timename*36

      print *,'Please enter netCDF file name :'
      read *,file
      print *,'Processing ',file,' ...'

C  (1)NetCDF subroutine to open netCDF file.
      cdfid = ncopn(file, ncnowrit, rcode)

C  (2)NetCDF subroutines to find out ID and size of time dimension.
      timeid = ncdid(cdfid,'time ',rcode)
      call ncdinq(cdfid,timeid,timename,times,rcode)

......

C  (7)NetCDF subroutine to close open netCDF file.
      call ncclos(cdfid, rcode)


      end

The program compiles alright, but the problem is I keep getting this  
message when trying to run it :
NCDINQ: string won't fit in CHARACTER variable provided

I have done print statements to verify that cdfid and timeid are being  
returned correctly, and they are.

I have tried making the character variable timename as big as 100000, and  
I still get this message.  I'm also curious about the role of "maxncnam"  
in all this.  The manual says that "The maximum possible length, in  
characters, of a dimension name is given by the predefined constant  
maxncnam.  As you can see by the parameter statement commented out above,  
I thought maybe this was something I was supposed to specify, and I tried  
it, but to no avail.  Any ideas what I'm doing wrong?

A second more general question I have is the netCDF files I'm using  
(atmospheric soundings) all have differing dimensions for the time  
variable.  Thus, I'm trying to use the routines in the above segment of  
code to identify the size of the time dimension, to subsequently use as  
the size of the other variables' arrays (ie pressure, temperature, etc.) I  
want to read off the file.  The problem here is my compiler complains  
about using dummy arrays as adjustable arrays, since the size of the  
arrays has not really been defined at the time of compilation.  Any way  
around this?  Should I just write the rest of the program as a subroutine,  
and not declare pressure, temperature, etc., as reals in the main program?

Thanks for your help,
Douglas Cripe


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