-
Notifications
You must be signed in to change notification settings - Fork 179
NetCDF-java enum data type problems #901
Comments
The error might be in the netCDF-java reader, and not in the writer, as netCDF-C's ncdump returns the exepcted output:
While netCDF-java's ncdump returns the following CDL (notice the data type of the variable is the same as the variable name):
Edit cwardgar: formatting |
Which version of netcdf-java are you using? |
This doesn't appear to be a problem with NetCDF-Java v5.0.0. Can you try using that? |
I made some changes in 5.0 re enums (and I think a couple of other things) in 5.0, |
Unfortunately it keeps happening to me with the latest ToolsUI (toolsUI-5.0.0-20170721.123717-202.jar):
I used netCDF-java-4.6.6.jar with netCDF-C 4.4.0 for writting the file (in Windows) and the latest THREDDS (4.6.9) and ToolsUI for reading. As explained, ncdump from netCDF-C 4.2.1.1 does read the dataset correctly, so the writing seems to be ok. I have uploaded the netCDF dataset to an FTP (ftp:https://ftp.eumetsat.int/pub/EUM/out/USC/JRG/test.nc). It will be available for 30 days. Please let me know if I can do any other test. Thanks! |
This is all beginning to ring some bells. For a long time, there was a problem |
Okay, I was able to reproduce the error. The problem seems to be buried in I assume that the association between @joaquinrgu As you mentioned, NetCDF-C does not suffer this problem. It may interest you to know that NetCDF-Java can be configured to use libnetcdf (if installed) to read datasets, instead of its own classes. Maybe you could use that as a workaround until we get this fixed. See this page about runtime configuration. As an example, I have the following config at <nj22Config>
<Netcdf4Clibrary>
<libraryPath>/opt/netcdf-4.4.1/lib</libraryPath>
<libraryName>netcdf</libraryName>
<useForReading>true</useForReading>
</Netcdf4Clibrary>
</nj22Config> |
Also, see this page for general instructions on how to load libnetcdf in NetCDF-Java. |
I didn't know about this option! thanks a lot, I will test it. |
One way to see what is happening is to do the h5dump command on the .nc file. |
I have to amend my comment. The appearance of e.g. an enum twice may be an artifact of theh5dump program. It is unclear if inside the hdf5 file, the enum is actually duplicated. |
I retract my retraction. Netcdf files do duplicate the type definitions. I hypothesize that this |
The netCDF-java library does not properly write netCDF4 variables of data type enum from an NcML template. The following java code is used to illustrate the problem:
Test.ncml only contains a variable, with data type enum:
The netCDF4 dataset is succesfully generated, however the variable type is incorrect, according to :
A) NetCDF-java NCdumpW: no enumTypeDef shown.
!$ java -Xmx1g -classpath toolsUI-4.6.jar ucar.nc2.NCdumpW test.nc -ncml
B) ToolsUI (NcML tab): enumTypeDef boolean not referenced in variable
THREDDS also fails to provide OPENDAP access to the file, returning the following error:
cwardgar edit: formatting
The text was updated successfully, but these errors were encountered: