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.
>From: address@hidden (Charlie Zender) >Organization: . >Keywords: 199410012218.AA02747 >hello people, >i'm trying to ncgen a cdl file that looks like > >netcdf ccm_labels { >variables: > float ALBD; > ALBD:long_name = "ALBD"; > ALBD:english = "ERBE all-sky albedo"; > ALBD:idl_tit_str = "!5Albedo: All Sky"; > ALBD:idl_units = "!5Fraction"; > ALBD:disp_scale = 1.e0; > ALBD:idl_symbol = "!8A!5"; > ALBD:idl_abbrev = "!5Albedo"; > ALBD:obs_src = "!5"; > >. >. about 100 more entries similar the above >. >} > >but i get the error msg: >/home/zender/netcdf: ncgen ccm_labels.cdl >ncgen: ccm_labels.cdl line 628: too many attributes >ncgen: ccm_labels.cdl line 629: too many attributes >ncgen: ccm_labels.cdl line 630: too many attributes >and eventually the a core dump. >i can't find a syntax error in the file so i'm wondering if i've overrun some >internal limit on the number of attributes a file can have. this hunch is >confirmed by splitting the file in two: each half separately compiles with >ncgen, but not the two together. is there such >a limit? ncgen is barfing after about attribute 500. if you think this hunch >is correct what can i do about it/are there any workarounds? i'd prefer not >to split the file up into smaller bits and pieces. >thanks, >charlie Yes, you have over-run an internal limit for number of attributes per variable. This is described in the netCDF users guide, and the limit itself is defined in the netcdf.h include file: /* * These maximums are enforced by the interface, to facilitate writing * applications and utilities. However, nothing is statically allocated to * these sizes internally. */ #define MAX_NC_DIMS 32 /* max dimensions per file */ #define MAX_NC_ATTRS 512 /* max global or per variable attributes */ #define MAX_NC_VARS 512 /* max variables per file */ #define MAX_NC_NAME 128 /* max length of a name */ #define MAX_VAR_DIMS MAX_NC_DIMS /* max per variable dimensions */ You may change the limits in your interface (and rebuild), however, you may run into trouble if you intend to exchange your data with others.