This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Ed: The fundamental problem I have is this. For languages other than C > (such as python and fortran), structured arrays don't necessarily have > the same alignment as the default for the C compiler. In order the > write structured arrays from python using the netcdf C lib, I need to be > able to specify arbitrary offsets, and have the library actually use > those offsets when I write the data. Reading is not a problem, since I > can intrepret the offsets that I read from the file to construct a > structured array to hold the data. If you can tell me how to write > structured data with arbitrary offsets (usually packed) with netcdf, > I'll be happy. If I can't do this, I'm afraid netcdf compound types > will be practically useless for languages other than C. In F90 there is a way to insist that the Fortran compiler use the same (default) layout as the C compiler. This is not implemented in netCDF-4 yet, but it will be as soon as I can get around to replacing the current fortran APIs. Now I see what you are getting at. I can think of at least one hackish way to get what you need. Let me ponder and see if there is a more elegant way... Thanks, Ed Ticket Details =================== Ticket ID: LRS-412716 Department: Support netCDF Priority: Normal Status: Open