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.
> Organization: NCAR / ATD > Keywords: 199502022355.AA29198 Hi Jeff, > I've come across a case in which ncredef apparently works differently under > HP-UX (A.09.01) then under SunOS (4.1.3) and Solaris (5.3). I have a program > in which I want to write out a global attribute whose value I don't know until > I have finished processing all my data. So the way I handled this was to > use the sequence > ncredef > ncattput > ncendef > at the end of my program (or before I closed the file if my program was > generating multiple NetCDF files). This worked fine with SunOS and Solaris. > But on an HP, it would only work if the NetCDF file was in the directory that > I was executing the program in. Otherwise, it would give the error message > ncredef: filename "": No such file or directory > . Is, in fact, the usage of ncredef limited to the current directory? Here's something that might be relevant from our netCDF FAQ list: IS THERE A KNOWN BUG WITH NETCDF UNDER HPUX? The current version of the HPUX operating system provides an incorrect definition of the FILENAME_MAX macro. This results in the symptom that the ncredef() function does not work properly when invoked from a directory other than the one the open netCDF file is in. A workaround is to apply the following patch to the file netcdf/libsrc/local_nc.h before building the library: diff -c -r1.39 local_nc.h *** /tmp/T0a004uN Tue Mar 8 11:14:12 1994 --- local_nc.h Wed Feb 9 15:56:36 1994 *************** *** 12,17 **** --- 12,21 ---- #include <stddef.h> /* size_t */ #include <stdio.h> /* FILENAME_MAX */ + #if defined(_HPUX_SOURCE) && FILENAME_MAX < 255 + /* Arrgh. HP thinks FILENAME_MAX is _POSIX_NAME_MAX */ + #undef FILENAME_MAX + #endif #ifndef FILENAME_MAX #define FILENAME_MAX 255 #endif Please let me know if this doesn't fix the problem. ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden P.O. Box 3000 http://www.unidata.ucar.edu/ Boulder, CO 80307-3000 ______________________________________________________________________________