[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #SXF-400193]: NetcdfFileWriter's global Attributes



Hi Jin,

I'm glad you finally got this working. However, I'm not sure if I understand 
correctly this last question. Is this a different issue or if it's somehow 
related with the "vinfo null" problems. Do you mean you've changed the array 
type from short to int and it worked? or have you changed the variable type too?

The different behavior is caused by the underlying Input Output Service 
Provider (IOSP). 
NetcdfFileWriter, is high level APIs for writing files that expose a common API 
for the different supported formats (NetCDF3 and NetCDF4) and hide to the user 
the specific features of each one. At a lower level, this class use an IOSP for 
writing the files and the IOSP they use depends on the format of the file you 
want to write. 
If you write NetCDF3 files the IOSP is pure JAVA and when writing it does not 
check that the dataType of the variable matches the dataType of the data array 
(perhaps it should, or at least issue a warning) and it does not fail but there 
might be some loss of information if those types do not match (for instance 
writing a double array in a variable with type short) and it is always a good 
practice to make those dataTypes match. 
On the other hand, the NetCDF4 IOSP uses the NetCDF4-C libraries through JNA 
and if does fail if the types don't agree.

This common API is how the default chunking and deflate rate are added to the 
NetCDF4 files and is totally hidden to the client so you don't have to worry 
about it. If you need some other chunking strategies you can use this method:
http://www.unidata.ucar.edu/software/netcdf-java/v4.3/javadocAll/ucar/nc2/NetcdfFileWriter.html#createNew(ucar.nc2.NetcdfFileWriter.Version,
 java.lang.String, ucar.nc2.jni.netcdf.Nc4Chunking)
that takes a Nc4Chunking parameter:
http://www.unidata.ucar.edu/software/netcdf-java/v4.3/javadocAll/ucar/nc2/jni/netcdf/Nc4Chunking.html

And here you can see some information about chunking and deflating in NetCDF-4:
http://www.unidata.ucar.edu/software/netcdf/workshops/2012/nc4chunking/index.html
  

Cheers!
Marcos Hermida.





Ticket Details
===================
Ticket ID: SXF-400193
Department: Support netCDF Java
Priority: Normal
Status: Open