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.
Hi Doug, > I am a new user of netCDF and wish you could help me with my questions. > 1. Within one netCDF file, can variables have different dimensions? In my > imagination, netCDF stores one variable (array) in one layer. Each layer may > not have relation with others. In this way, variables in one netCDF can have > different dimensions. No, a single variable is defined to be a specific shape, determined by the list of dimensions it uses. However, netCDF-4 files have named "groups", and each group may have dimensions and variables with the same names but different sizes or shapes as dimensions and variables in other groups. It is analogous to the situation with files in directories, where the same name can refer to different files in different directories of a hierarchical file system. So maybe what you are calling "layers" are like netCDF-4 "groups". > 2. When we create a netCDF file, do we have to put all data in the CDL file? > It may not be complex but time consuming. Can we link a well-defined external > file to the CDL file? For example, indicate the external fiel location on the > hard drive. No, you don't need to use CDL files (which are human-readable text files). NetCDF files (which are binary files) may be created directly with custom programs or utilities. Typically, you either use a CDL file to create metadata, then the ncgen utility to turn that into a binary netCDF file. Or you use a program to create e netCDF file, then use ncdump to see that as a CDL file. But you don't need to manually modify a CDL file to keep it consistent with a netCDF file (which I think you are asking about, if I understand your question). There is no standard or convention for including data by reference or linking in a binary netCDF file, although you could store file names as values of string type attributes or variables. However, netCDF Java supports NcML files, which can store links to external data in one or more other files, which can be netCDF files. For more information about NcML, and especially the use of NcML for aggregation, here: http://www.unidata.ucar.edu/software/netcdf/ncml/ --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: MKO-964114 Department: Support netCDF Priority: Normal Status: Closed