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.
Bin, > Thanks for the quickly response. The DEM files are at > ftp://landsc1.nascom.nasa.gov/outgoing/c6_dem/sin_1km/ You can download any > HDF file over there to test. > Actually, I can use ncdump to open the file header without any problem. > However, nc_open is not working.... OK, thanks, when I use ncdump -sh on one of the files, I get a segmentation violation trying to access chunk sizes, due to a bug in nc_inq_chunking() when reading HDF4 files like these DEM files. We're working on a fix, and have a created an issue for the problem: https://bugtracking.unidata.ucar.edu/browse/NCF-272 --Russ > -----Original Message----- > From: Unidata netCDF Support [mailto:address@hidden] > Sent: Friday, May 30, 2014 11:52 AM > To: Tan, Bin (GSFC-619.0)[SIGMA SPACE CORPORATION] > Cc: address@hidden > Subject: [netCDF #CPW-270700]: compile error > > Bin, > > > Thanks Russ! I finally got the netcdf library successfully built and > > installed. > > However, I met another problem when using the libraries. I tried to open > > HDF4 data in a C program with the following lines: > > > > retval = nc_open("DEM_SN_H.h32v07.006_0.hdf", NC_NOWRITE, &ncid); > > ERR(retval); > > > > I always got segmentation fault on this line. > > > > Should I use nc_open to open HDF4 files? > > Your nc_open call is correct for HDF4 files. And the netCDF library should > not get a segmentation fault when it can't read an HDF4 file. > It's been reported as a bug that some netCDF library functions fail on HDF4 > file inquiries for compression or chunking parameters, but I haven't seen any > reports of a segmentation fault on just calling nc_open on an HDF4 file. > > You should be able to use netCDF-4 on HDF4 SD (Scientific Data) files. > The netCDF library calls the HDF4 library underneath, so you have to build > netCDF so that it knows where the HDF4 library is installed: > > http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#build_hdf4 > > If you've done this and it still fails, and you know the file you're trying > to open is an HDF4 SD file, please make the file available to us so we can > try to reproduce the problem here. > > Thanks. > > --Russ > > > -----Original Message----- > > From: Unidata netCDF Support [mailto:address@hidden] > > Sent: Thursday, May 29, 2014 10:54 PM > > To: Tan, Bin (GSFC-619.0)[SIGMA SPACE CORPORATION] > > Cc: address@hidden > > Subject: [netCDF #CPW-270700]: compile error > > > > Bin, > > > > > However, the program still compiled with old HDF5 libraries. Do you have > > > any idea what else I should revise? > > > > It might also be helpful to try these instructions that get output when you > > successfully install the netCDF libraries: > > > > If you ever happen to want to link against installed libraries in a > > given directory, LIBDIR, you must either use libtool, and specify the > > full pathname of the library, or use the `-LLIBDIR' flag during > > linking and do at least one of the following: > > > > - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during > > execution > > - add LIBDIR to the `LD_RUN_PATH' environment variable during linking > > - use the `-Wl,-rpath -Wl,LIBDIR' linker flag > > - have your system administrator add LIBDIR to `/etc/ld.so.conf' > > > > See any operating system documentation about shared libraries for more > > information, such as the ld(1) and ld.so(8) manual pages. > > > > --Russ > > > > Russ Rew UCAR Unidata Program > > address@hidden http://www.unidata.ucar.edu > > > > > > > > Ticket Details > > =================== > > Ticket ID: CPW-270700 > > Department: Support netCDF > > Priority: Normal > > Status: Closed > > > > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > > > Ticket Details > =================== > Ticket ID: CPW-270700 > Department: Support netCDF > Priority: Normal > Status: Closed > > > Hi, Russ > > Thanks for the quickly response. The DEM files are at > ftp://landsc1.nascom.nasa.gov/outgoing/c6_dem/sin_1km/ You can download any > HDF file over there to test. > Actually, I can use ncdump to open the file header without any problem. > However, nc_open is not working.... > > Bin > > -----Original Message----- > From: Unidata netCDF Support [mailto:address@hidden] > Sent: Friday, May 30, 2014 11:52 AM > To: Tan, Bin (GSFC-619.0)[SIGMA SPACE CORPORATION] > Cc: address@hidden > Subject: [netCDF #CPW-270700]: compile error > > Bin, > > > Thanks Russ! I finally got the netcdf library successfully built and > > installed. > > However, I met another problem when using the libraries. I tried to open > > HDF4 data in a C program with the following lines: > > > > retval = nc_open("DEM_SN_H.h32v07.006_0.hdf", NC_NOWRITE, &ncid); > > ERR(retval); > > > > I always got segmentation fault on this line. > > > > Should I use nc_open to open HDF4 files? > > Your nc_open call is correct for HDF4 files. And the netCDF library should > not get a segmentation fault when it can't read an HDF4 file. > It's been reported as a bug that some netCDF library functions fail on HDF4 > file inquiries for compression or chunking parameters, but I haven't seen any > reports of a segmentation fault on just calling nc_open on an HDF4 file. > > You should be able to use netCDF-4 on HDF4 SD (Scientific Data) files. > The netCDF library calls the HDF4 library underneath, so you have to build > netCDF so that it knows where the HDF4 library is installed: > > http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#build_hdf4 > > If you've done this and it still fails, and you know the file you're trying > to open is an HDF4 SD file, please make the file available to us so we can > try to reproduce the problem here. > > Thanks. > > --Russ > > > -----Original Message----- > > From: Unidata netCDF Support [mailto:address@hidden] > > Sent: Thursday, May 29, 2014 10:54 PM > > To: Tan, Bin (GSFC-619.0)[SIGMA SPACE CORPORATION] > > Cc: address@hidden > > Subject: [netCDF #CPW-270700]: compile error > > > > Bin, > > > > > However, the program still compiled with old HDF5 libraries. Do you have > > > any idea what else I should revise? > > > > It might also be helpful to try these instructions that get output when you > > successfully install the netCDF libraries: > > > > If you ever happen to want to link against installed libraries in a > > given directory, LIBDIR, you must either use libtool, and specify the > > full pathname of the library, or use the `-LLIBDIR' flag during > > linking and do at least one of the following: > > > > - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during > > execution > > - add LIBDIR to the `LD_RUN_PATH' environment variable during linking > > - use the `-Wl,-rpath -Wl,LIBDIR' linker flag > > - have your system administrator add LIBDIR to `/etc/ld.so.conf' > > > > See any operating system documentation about shared libraries for more > > information, such as the ld(1) and ld.so(8) manual pages. > > > > --Russ > > > > Russ Rew UCAR Unidata Program > > address@hidden http://www.unidata.ucar.edu > > > > > > > > Ticket Details > > =================== > > Ticket ID: CPW-270700 > > Department: Support netCDF > > Priority: Normal > > Status: Closed > > > > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > > > Ticket Details > =================== > Ticket ID: CPW-270700 > Department: Support netCDF > Priority: Normal > Status: Closed > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: CPW-270700 Department: Support netCDF Priority: Normal Status: Closed