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

[netCDF #YRC-237402]: netcdf4 dimensions output comment out



Wanchun,

> I used the simple C code: simple_xy_nc4_wr.c
> 
> <http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-tutorial/simple_005fxy_005fnc4_005fwr_002ec.html#simple_005fxy_005fnc4_005fwr_002ec>
> 
> http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-tutorial/simple_005fxy_005fnc4_005fwr_002ec.html#simple_005fxy_005fnc4_005fwr_002ec
> 
> But generated nc file simple_xy_nc4.nc has x and y besides data when I
> viewed it in hdfview, but I only want data, not x and y.
> 
> Can you tell me in which part of netcd4 source code do those dimensions
> like x and y get written out?   I want to disable them or comment them
> out so that only data is kept in file.  I searched netcdf4 src directory
> and can not pinpoint which is the correct code to change.

What you're asking for is not possible, because of a mismatch between the 
netCDF-4
data model and the HDF5 datamodel.  NetCDF-4 has "shared dimensions" such as x
and y that can be shared among multiple variables, to indicate a common grid.  
HDF5,
used as the storage layer for netCDF-4, lacks the concept of shared dimensions, 
but 
provides a different mechanism. "dimension scales", on which netCDF-4 shared 
dimensions are implemented.  An HDF5 dimension scale is a special type of HDF5
dataset, and must always be used for every netCDF-4 dimension, because it is the
only HDF5 mechanism available for modeling shared dimensions.

If netCDF-4 had "anonymous dimensions" such as HDF5 dataspaces, which cannot be
shared among variables, then you could define a variable that had its own 
dataspace,
with unnamed and unsharable dimensions.  If you must store just the data but 
not the 
metadata about dimensions, you probably want to use HDF5 rather than netCDF-4.

For more on netCDF-4 dimensions versus HDF5 dimension scales, see these blogs 
by John
Caron, explaining the issues:

   http://www.unidata.ucar.edu/blogs/developer/en/entry/dimensions_scales
   http://www.unidata.ucar.edu/blogs/developer/en/entry/dimension_scale2
   http://www.unidata.ucar.edu/blogs/developer/en/entry/dimension_scales_part_3
   
http://www.unidata.ucar.edu/blogs/developer/en/entry/netcdf4_shared_dimensions

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: YRC-237402
Department: Support netCDF
Priority: Normal
Status: Closed