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.
Hi Kent, > Although this issue is confirmed by nccopy, it may be something worth to > take an action on how to handle the dimension scale inside the netCDF-4 > library. > > netCDF-4 version: netCDF-4.3.0 > > 1) The netCDF-3 file: > > ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/ymuqun/temp/netcdf-4-dim-scale-issue/outfile-n3-GLAH.gz OK, I got it, thanks. > 2) nccopy error-message: > > ./nccopy -k 4 -d 1 outfile-n3-GLAH outfile-n4conv-GLAH > > You should see the following error message: > "NetCDF: HDF error Location: file nccopy.c; line 1437" > The line is NC_CHECK(nc_enddef(ogrp)); I can't duplicate the error with any of the versions of nccopy I have built, including 4.3.0, 4.2.1.1, or 4.1.3. In each case, nccopy completes with no error message, and the size of the resulting output file is as expected, for example: $ NCDIR=/machine/russ/installs/nc430 ; ${NCDIR}/bin/nccopy -k 4 -d 1 GLAH.nc GLAH.nc4 ; ls -l GLAH.nc GLAH.nc4 -rw-rw-r-- 1 russ ustaff 225935448 Sep 17 13:36 GLAH.nc -rw-rw-r-- 1 russ ustaff 36385878 Sep 17 14:00 GLAH.nc4 Is it possible the error message only appears when built with some non-default configure flag, that the version of nccopy you are using is older (unfortunately it doesn't have a --version flag), or that the error only occurs when built with a newer version of HDF5 than 1.8.11? --Russ > Curiously, nccopy continues generating a netCDF-4 file. It seems that this > file is valid. > > 3) Some hints: > A more detailed log message shows that: > attach_dimscales: attaching scale for dimid 3 to var BROWSE_Image_00 > ERROR: file nc4hdf.c, line 1994. > > In line nc4hdf.c 1994, it shows that H5DSattach_scale fails. > > A more careful investigation of the variable BROWSE_Image_00 shows that > it has an attribute CLASS = IMAGE > > If you check the HDF5 dimension scale source code, you will find that > CLASS = IMAGE is reserved for HDF5 image. H5DSattach_scale will fail if it > finds this HDF5 dataset is an HDF5 IMAGE. It doesn't make sense to provide > a dimension scale for an image. > > In fact, this netcdf-3 file is converted from an HDF5 file that indeed has > HDF5 IMAGE objects. This can be verified by using HDFView to check the > original HDF5 file. > > So a possible solution may be not to attach dimension scales if netCDF-4 > finds an attribute CLASS = IMAGE. > > The detailed log message can be found under > > ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/ymuqun/temp/netcdf-4-dim-scale-issue/n4conv-error-message > > The original HDF5 file can be found under > ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/fileout_netcdf/data/GLAH13_633_2103_001_1317_0_01_0001.h5 > > Kent > > -- > Kent Yang The HDF Group > 1800 So. Oak St., Suite 203, Champaign, IL 61820 > 217.531.6107 > http://hdfgroup.org http://hdfeos.org > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: KES-987451 Department: Support netCDF Priority: Normal Status: Closed