- To: netcdfgroup@xxxxxxxxxxxxxxxx
- Subject: [netcdfgroup] How to write fortran90 derived type to netcdf compound type
- From: Hendryk Bockelmann <bockelmann@xxxxxxx>
- Date: Thu, 13 Feb 2014 11:06:49 +0100
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