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.
Edwin, lat:valid_min = -90.f; // note the "f" suffix Regards, Steve Emmerson <http://www.unidata.ucar.edu> --------Original Message: > To: address@hidden > From: "Edwin R Wolfe Jr." <address@hidden> > Subject: variable attributes problems > Organization: UCAR/Unidata > Keywords: 200102091837.f19IbPL07744 > > I just noticed a problem with how ncgen handles the attributes for a > variable, and am wondering if there's something I've missed, or is this a > bug: > > in the .cdl we have > > real lat(nvec); > lat:valid_min = -90; > > and ncgen -f begets > > iret = nf_def_var(ncid, 'lat', NF_REAL, lat_rank, lat_dims, lat_id) > intval(1) = -90 > iret = nf_put_att_int(ncid, lat_id, 'valid_min', NF_INT, 1, intval) > > I anticipate this causing problems with programs that compare values for > 'lat' with its 'valid_min' value. > > I changed the cdl to > lat:valid_min = -90.0; > > and ncgen -f begets: > doubleval(1) = -90 > iret = nf_put_att_double(ncid, lat_id, 'valid_min', NF_DOUBLE, 1, > doubleval) > > How can I get ncgen -f to use the put_att_type correspinding to the > put_var_ ??