NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


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

Re: ncgen, netcdf attributes ?



>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.