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.
>To: address@hidden >cc: address@hidden >From: Paul LE TEXIER <address@hidden> >Subject: max_var_dims & max-dims ? >Organization: CEA/CESTA >Keywords: 199809211702.LAA01141 Hi Paul, > Why in the implementation limits you fix > for the fortran version binding (same for C & C++): > > nf_max_var_dims = nf_max_dims = 100 > and > nf_max_vars = 2000 > > It seems to me that I've missed something ! > Ok for, nf_max_var_dims = 100 > but why, nf_max_dims = 100 ? => Only 100 dims in a DATASET ! > > Maybe it should be better if: > nf_max_dims = nf_max_vars X nf_max_var_dims Usually variables in a single dataset share some of their dimensions, for example if multiple variables are defined on the same grid. If each variable has dimensions that are completely disjoint from every other variable, it might be better to store them in separate datasets. However, I conceded that NF_MAX_DIMS may be set too low for some of the datasets for which netCDF would be useful. The only reason there is any limit at all is for making it easier to write generic netCDF applications in languages like Fortran 77 that don't permit dynamic memory allocation. If NF_MAX_DIMS were set to 200000, such applications would be bloated for most uses. But as it says in the comments in netcdf.h: /* * These maximums are enforced by the interface, to facilitate writing * applications and utilities. However, nothing is statically allocated to * these sizes internally. */ #define NC_MAX_DIMS 100 /* max dimensions per file */ ... So you can set NC_MAX_DIMS in libsrc/netcdf.h and the parameter NF_MAX_DIMS in fortran/netcdf.inc to a much higher number, if you like, and rebuild the library. It will still work fine, but it's possible that if you write a netCDF dataset with more than 100 dimensions, someone else who has the library compiled with the smaller limit may not be able to read it without recompiling their library with the larger limits too. If you are using many dimensions for character array variables, you can use fewer dimensions at the cost of some extra space in the file by using a single maxstringlen dimension instead of a lot of custom stringlen dimensions for each string variable. Please let us know if you need more information. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu