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.
> Subject: Re: 970624: Restriction of variable name in ncgen? Glenn, > > It seems that the allowed "-" in variable names would cause a problem > > in c and fortran code. > > Is this situation handled differently? > > > > --Tom > > You are right, it causes a problem. > > netcdf test { > variables: float theta-0; > } > > produces > > ... > /* variable ids */ > int theta-0_id; > > Which can't be compiled. I've just checked in the ncgen fixes for this, so now it generates syntactically correct code for C and Fortran when dimensions, attributes, or variables have names that include one or more "-" or "." characters. The fixes will be in the next minor release, but I've appended a patch file in case you want to try them out now. I also had to change libsrc/string.c to permit "." in netCDF component names. > Russ Rew, the author of ncgen (and thus cdl syntax solomon) is on > vacation this week. In my previous message, I was trying to rationally > deduce the reasoning behind the cdl syntax. Since we are now into the > realm of channeling, I'll have to defer further discussion of this > until his return. > > When/if he fixes the above problem, > perhaps he will be willing to add the '.' syntax you request. You did a fairly good job of channeling :-). I still can't permit a leading "." or "-" in names because of grammar ambiguities with floating constants, but otherwise, it seems to work. Thanks for the suggestion. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu [patch deleted to save space]