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] How to write fortran90 derived type to netcdf compound type

Dear all,

I found the thread "Compound type and Fortran90" in the 2013 mailing list archive, where it is said that you cannot write an entire fortran90 derived type into a compound type. But it is also said that you can write the individual components ... unfortunately, there is no example for this.

Here is my case:

type foo
  INTEGER :: a
  INTEGER :: b
  REAL    :: c
end type foo

TYPE(foo), DIMENSION(ndim) :: datafield
...
nf90_def_compound(ncid, 2*INTSIZE + REALSIZE, "triple", typeid)
nf90_insert_compound(ncid, typeid, "a", 0, NF90_INT)
nf90_insert_compound(ncid, typeid, "b", INTSIZE, NF90_INT)
nf90_insert_compound(ncid, typeid, "c", 2*INTSIZE, NF90_FLOAT)
nf90_def_var(ncid, "data", typeid, dimid, varid)

nf90_put_var(ncid, varid, datafield) ! this is not possible
...

What is the right way to put my data from the derived type array datafield into the netcdf compound type?

Cheers,
Hendryk

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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