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: NOAA/PMEL > Keywords: 199403072257.AA04665 Hi Willa, > I'm having problem with creating netCDF file on a HP when the file name > is more than 14 characters long. (I don't have no probelm when the > file name is less than 14 characters.) The problem is that instead of > generating one output file, several output files will be generated. > Here is the output result of my program which writes some global > attribute, axes and 2 variables: > > - ------------------------------------------------------------------------- > Output file: > > 1. file1_file2_ctd_data.cdf > > This is the file I asked to create, but it only contains following > these lines: > > netcdf file1_file2_ctd_data { > > variables: > } > > 2. file1_file2_ctSS > > This file contains dimenstions, variables and data for axes, and also > contains global attributes. > > 3. file1_file2_ctTy > > This file contains every thing in above file plus variables and data > for the first variable. > > 4. file1_file2_ct > > This file contains every thing in above file plus variables and data > for the second variable. This file is exactly what I want except the > file name is not right. > > - ------------------------------------------------------------------------- > > > I tried ncgen program, it works fine no matter how long the output file > name is. Can anyone give me some suggestion what might be wrong? > Thanks. 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 that adds four lines to the file netcdf/libsrc/local_nc.h before rebuilding 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 If it still doesn't work after applying this patch, please let us know. Thanks. >Date: Tue, 8 Mar 94 10:32:24 PST >From: address@hidden (Willa Zhu) >Russ, >The patch does fix the problem. Thanks. - Willa __________________________________________________________________________ Russ Rew UCAR Unidata Program