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, > From: "Edwin R Wolfe Jr." <address@hidden> > Subject: Re: 20010209: variable attributes problems > Organization: University of Michigan > Keywords: 200102091837.f19IbPL07744 netCDF variable attributes The above message contained the following: > Thanks -- this helps. I've found, by experiment that > 1.2f > 1s > 1b > > also work (note no <.> in the last 2). I can't seem to find this in the > documentation -- is there a document I'm missing? The specification for CDL data constants may be found in secion 10.3 of the "NetCDF-3 User's Guide for Fortran 77", which is available at <http://www.unidata.ucar.edu/packages/netcdf/docs.html> > A couple more questions, if I may: > > 1) > I find that using 1s begets > > iret = nf_put_att_int(ncid, ms_time_id, 'missing_value', NF_INT2, > 11, int2val) > > which seems an inconsistency in that I'd expect the put routine to be > put_att_int2 ?? The routine "nf_put_att_int" is used to write values that are stored as INTEGER-s in memory. The "1" value in the above is such an integer. The routine "nf_put_att_int2" would be used to write values that are stored as INTEGER*2-s in memory. You need to understand the distinction between a external netCDF type (e.g. NF_INT2) and the internal, in-memory representational type (e.g. INTEGER). In general, they needn't be the same. > 2) > using 1s in the data section of the .cdl doesn't seem to similarly change > the code in the writerec subroutine of the fortran code generated. How can > I accomplish this ? I'm afraid that I don't understand the question. Please explain. > 3) > when defining character strings, such as > char ut_date(nvec, date_len); > data: > ut_date = "1999000" ; > > I get > > iret = nf_put_vara_text(ncid, ut_date_id, ut_date_start, ut_date_c 1ount, '1999000') > > instead of using the variable name like it does for anything other than > chars? Is there a way to get ncgen to use the variable name instead of > the actual text? I'm afraid that I don't understand the question. Please explain. > 4) > I find, in order to get any put_var code in the generated writerec > subroutine, I need to specify data for each variable. Is there a way to > specify, in the .cdl, the equivalent of > > lat / 75 * -1.f / other than to actually enter -1 75 times? Sorry. There are no such syntactic short-cuts in CDL. Regards, Steve Emmerson <http://www.unidata.ucar.edu>