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.
Russ Rew wrote:
Russ: I realize you can use a array of shape ndim,8 to store an array of ndim 8 character strings. Thats the way I've done it with netcdf-3 - it just feels clunky. A typical use case for me is station data, where you want to store the name of the station. I end up the with an array of characters shaped (nstations,ncars) - in fortran I read it into an (nstations,nchars) character(len=1) array (after first finding out what both nstations and nchars are), then reshape it into a (nstations) character(len=nchars) array. I'd rather just read it into a character(len=nchars) array straight off. Not a show stopper for sure, but it would be more convenient. I realize that specifying the data type would be tricky, instead of NC_CHAR, do you have a bunch of new types NC_CHAR1, NC_CHAR2, ... NC_CHAR120? Or a new function datatype = nc_set_chartype(nchars)? However, I bet it would get used a lot more than the esoteric datatypes you have in netcdf-4 already (enums and opaque for example). By the way, while I'm ranting ... Another potential problem is see is nested user-defined types. Since this is allowed in netcdf-4, I can see the potential for creating horribly complicated files with compounds of vlens containing compounds containing enums etc. Don't think many people would be crazy enough to use it, but it makes it very hard to create client code to read arbitrary netcdf-4 files, since you have to check for all those possibilities in general. I wonder whether it might not be wise to sacrifice some generality for simplicity and just say that user-defined types can only be composed of primitive data types.Hi Jeff,In netcdf-4.0, I don't see how to create variables which are arrays of strings with length > 1. I see how to create arrays of single-characters, and arrays of variable-length strings, but not strings of a specified length....Maybe Russ or Ed can tell me whether this is possible in netcdf-4.0? Being limited to single character arrays in netcdf-3 was one of things I really wanted netcdf-4 to overcome. Variable length strings are nice, but they don't map well to commonly used data structures (i.e. arrays) in fortran or python.The distinction between an N-dimensional array of chars and an (N-1)-dimensional array of fixed-length strings is pretty subtle, and it looks like we assumed you could use the former if you needed the latter. Multidimensional arrays of chars are supported in netCDF-4 just as in netCDF-3. Maybe a few convenience functions that treat an N-dimensional array of chars as an (N-1)-dimensional array of strings that happen to be fixed length are all that's needed. If not, we may need a more detailed use case that would make clear why that's inadequate. --Russ
My 0.02$, thanks for listening. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ============================================================================== To unsubscribe netcdfgroup, visit: http://www.unidata.ucar.edu/mailing-list-delete-form.html ==============================================================================
netcdfgroup
archives: