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.

[netcdfgroup] ragged (variable length) arrays in Fortran 90? example?

I've been trying to implement a ragged array of floating point numbers
in Fortran 90, but I've been having trouble actually writing data to
it.  Declaring the variable length type seems to work okay, and I can
declare the vector of variable length vectors okay, but I can't seem
to figure out how to write data to it...

The Fortran 90 interface guide lists a function called:

NF90_PUT_VLEN_ELEMENT(INTEGER NCID, INTEGER XTYPE,
             CHARACTER*(*) VLEN_ELEMENT, INTEGER LEN, DATA)

...but when I try to actually use this, my compiler acts as though it
doesn't even exist (and yes, the rest of the HDF5/NetCDF 4.0 commands
work, so it's not due to compiling without HDF5):

----------
gfortran   -I../public -I../private -I../../include -Wunused-value
-Wuninitialized -Werror -W -fimplicit-none   -O2 -fbounds-check  -g -c
-ffree-form -I/Users/jshine/Documents/work/netcdf-4.0/include
../private/log_netcdf.f
../private/log_netcdf.f:457.11:

  status = nf90_put_vlen_element(ncid, typeid, ind, nz, val)
          1
Error: Function 'nf90_put_vlen_element' at (1) has no IMPLICIT type
make: *** [log_netcdf.o] Error 1

/Users/jshine/Documents/hobbies/astro/astro_software/mesa/star/make
FAILED
----------

Also, when I grep for this function name, I can't find it anywhere
except the documentation -- it doesn't seem like it exists in the
NetCDF code itself.  Does anyone have an example of how to go about
writing to a variable-length array in Fortran 90?  I would really
appreciate it, as I've been banging my head against this all day...

Thanks!
-Jon


--
Jonathan Tomshine
PhD Candidate
University of Minnesota
Dept. of Chemical Engineering and Materials Science
Box 78, Amundson Hall
421 Washington Ave SE
Minneapolis, MN  55455
jtomshine@xxxxxxxxx



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