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

[netCDF #GAJ-689004]: Corrupted netCDF when adding dimension



I did a quick test with the current master and using HDF5 1.10.3.
It seems to work ok. I think some work was done on the handling
of coordinate variables and dimensions recently, so that  may
have inadvertently fixed the problem. You might try again with
release netcdf 4.6.3.



> Package Version: netCDF 4.6.2, HDF5 1.8.21
> Operating System: Linux
> Hardware:
> Description of problem: I find a strange error when adding a dimension to an 
> already existing netCDF file.
> 
> Using the attached "step1-generate.c" code, I generate a small netCDF file. 
> It contains just a coordinate variable inside the "data" group. So far, 
> everything is ok. This is the output from "ncdump":
> 
> netcdf output {
> group: data {
> dimensions:
> coordinate_variable = 10 ;
> variables:
> short coordinate_variable(coordinate_variable) ;
> data:
> coordinate_variable = _, _, _, _, _, _, _, _, _, _ ;
> } // group data
> }
> 
> Afterwards, I append the file and insert a new dimension and its 
> corresponding variable, using "step2-append.c".
> 
> Both programs are apparently successful, because they do not throw any error. 
> However, when I try "ncdump" I get the following error:
> 
> netcdf output {
> dimensions:
> coordinate_variable = 10 ;
> variables:
> NetCDF: Invalid dimension ID or name
> Location: file ncdump.c; line 1740
> short my_var
> [AND NO MORE LINES!]
> 
> Some comments:
> * the "coordinate_variable" was created inside the "data" group, not at root 
> level.
> * The problem seems to be directly related to the existence of a coordinate 
> variable ("variable" and "dimension" having the same name).
> * netCDF commands ("ncdump", "nccopy") do not work.
> * HDF5 commands work well (for example, "h5repack").
> * This test presented here has been implemented in C, but the same happens in 
> Python.
> 
> Therefore:
> * This issue seems to be related to netCDF and not HDF5.
> * This issue requires the existence of at least a coordinate variable.
> * When all dimensions and variables are located at root level, it works well. 
> This issue requires the coordinate variable to be in a group.
> * The behavior is erratic. When the variable ("my_var") in "step2-append.c" 
> is not added (because that code is commented out), then simply "my_dim" 
> dimension is invisible when using "ncdump".
> 
> Thank you in advance.
> 
> 

=Dennis Heimbigner
  Unidata


Ticket Details
===================
Ticket ID: GAJ-689004
Department: Support netCDF
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.