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

20010209: variable attributes problems



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_ ??