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.
Charlie- So I did some checking and here is the situation as I understand it. The original ncgen program treats single char constants as bytes, not chars. so :x = 'a', 'b'; will have type NC_BYTE. The same is true for ncgen4. The ncgen4 program, when creating a netcdf-4 file, currently treats :x="abc"; as creating an attribute with type NC_STRING. In the same situation, the original ncgen assumes the type NC_CHAR. This is a backward compatability problem and I will fix it shortly so ncgen4 acts like ncgen. The consequence of this is that if one wants to create an attribute whose type is NC_STRING, then one must explicitly type the attribute like so: string :x="abc"; It turns out however that there is an error in ncdump related to this. If I create a .nc file using the above string :x="abc"; and then dump it, it appears that ncdump outputs :x="abc"; instead of the typed string :x="abc"; If the ncdump output were then passed again to ncgen4, x would end up typed as NC_CHAR instead of NC_STRING. =Dennis Heimbigner Ticket Details =================== Ticket ID: KOM-880811 Department: Support netCDF Priority: Normal Status: Open