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

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

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.


  • Subject: [netCDFJava #SXF-400193]: NetcdfFileWriter's global Attributes
  • Date: Wed, 27 Mar 2013 08:10:54 -0600

Hi Jin,

thanks for your thorough description.
I think the issue might be you are using a NetcdfDataset for finding the 
variables in the NetcdfFileWriter write method:  
target.write(targetDs.findVariable(varNameA), origin, arrayA);

The NetcdfDataset does not hold an exact copy of the objects (dimensions, 
variables) in the file but it is a sort of shallow copy of those contents and 
adds some enhancements for managing coordinate systems. So, when you create the 
NetcdfDataset the information in the variables needed by the Input Output 
Service Provider (IOSP) for actually writing the variables is lost. 
I think you could try to write the variables in the same way you write the 
dimensions:
target.write(target.findVariable(dimName), array);
and use this:
target.write(target.findVariable(varNameA), origin, arrayA);
instead of: 
target.write(targetDs.findVariable(varNameA), origin, arrayA);

Hope it helps,
Marcos Hermida.

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